@ram_28/kf-ai-sdk 1.0.10 → 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 +23 -13
- 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 +79 -70
- 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 +76 -49
- 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 +85 -75
- package/sdk/components/hooks/useForm/useForm.ts +160 -40
- 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 -6327
package/sdk/types/base-fields.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Resolves to: string
|
|
4
4
|
* Use this for all ID-type fields (user IDs, order IDs, etc.)
|
|
5
5
|
*/
|
|
6
|
-
export type
|
|
6
|
+
export type IdFieldType = string;
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* String field with optional literal type constraint and length limits
|
|
@@ -14,11 +14,11 @@ export type IdField = string;
|
|
|
14
14
|
* Storage: VARCHAR in database
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* StringFieldType // => string
|
|
18
|
+
* StringFieldType<'active' | 'inactive'> // => 'active' | 'inactive'
|
|
19
|
+
* StringFieldType<string, 1, 100> // => string with length constraints
|
|
20
20
|
*/
|
|
21
|
-
export type
|
|
21
|
+
export type StringFieldType<
|
|
22
22
|
T extends string = string,
|
|
23
23
|
_MinLength extends number = never,
|
|
24
24
|
_MaxLength extends number = never,
|
|
@@ -31,9 +31,9 @@ export type StringField<
|
|
|
31
31
|
* Use this for descriptions, comments, rich text content
|
|
32
32
|
*
|
|
33
33
|
* @example
|
|
34
|
-
*
|
|
34
|
+
* TextAreaFieldType // => string (multi-line)
|
|
35
35
|
*/
|
|
36
|
-
export type
|
|
36
|
+
export type TextAreaFieldType = string;
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Numeric field with optional precision constraints
|
|
@@ -43,10 +43,10 @@ export type TextAreaField = string;
|
|
|
43
43
|
* Use this for quantities, measurements, calculations
|
|
44
44
|
*
|
|
45
45
|
* @example
|
|
46
|
-
*
|
|
47
|
-
*
|
|
46
|
+
* NumberFieldType // => number
|
|
47
|
+
* NumberFieldType<2> // => number with 2 decimal places
|
|
48
48
|
*/
|
|
49
|
-
export type
|
|
49
|
+
export type NumberFieldType<_Precision extends number = never> = number;
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Large integer field for big numbers
|
|
@@ -55,9 +55,9 @@ export type NumberField<_Precision extends number = never> = number;
|
|
|
55
55
|
* Use this for large counters, timestamps, file sizes
|
|
56
56
|
*
|
|
57
57
|
* @example
|
|
58
|
-
*
|
|
58
|
+
* LongFieldType // => number (large integer)
|
|
59
59
|
*/
|
|
60
|
-
export type
|
|
60
|
+
export type LongFieldType = number;
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
* Boolean field
|
|
@@ -65,7 +65,7 @@ export type LongField = number;
|
|
|
65
65
|
* Storage: BOOLEAN in database
|
|
66
66
|
* Use this for true/false values, flags, toggles
|
|
67
67
|
*/
|
|
68
|
-
export type
|
|
68
|
+
export type BooleanFieldType = boolean;
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* Date field (date only, no time)
|
|
@@ -74,9 +74,9 @@ export type BooleanField = boolean;
|
|
|
74
74
|
* Use this for birth dates, due dates, calendar events
|
|
75
75
|
*
|
|
76
76
|
* @example
|
|
77
|
-
*
|
|
77
|
+
* DateFieldType // => Date (date only)
|
|
78
78
|
*/
|
|
79
|
-
export type
|
|
79
|
+
export type DateFieldType = Date;
|
|
80
80
|
|
|
81
81
|
/**
|
|
82
82
|
* DateTime field (date and time)
|
|
@@ -85,9 +85,9 @@ export type DateField = Date;
|
|
|
85
85
|
* Use this for created_at, updated_at, event timestamps
|
|
86
86
|
*
|
|
87
87
|
* @example
|
|
88
|
-
*
|
|
88
|
+
* DateTimeFieldType // => Date (with time)
|
|
89
89
|
*/
|
|
90
|
-
export type
|
|
90
|
+
export type DateTimeFieldType = Date;
|
|
91
91
|
|
|
92
92
|
// ============================================================
|
|
93
93
|
// COMPLEX FIELD TYPES
|
|
@@ -95,53 +95,53 @@ export type DateTimeField = Date;
|
|
|
95
95
|
|
|
96
96
|
/**
|
|
97
97
|
* Currency field supporting multiple value formats
|
|
98
|
-
* Resolves to:
|
|
98
|
+
* Resolves to: CurrencyValueType
|
|
99
99
|
* Storage: JSON/VARCHAR in database
|
|
100
100
|
* Use this for prices, monetary amounts, financial data
|
|
101
101
|
*
|
|
102
102
|
* @example
|
|
103
|
-
*
|
|
103
|
+
* CurrencyFieldType // => {value: number, currency: string} | string
|
|
104
104
|
*/
|
|
105
|
-
export type
|
|
105
|
+
export type CurrencyFieldType = CurrencyValueType;
|
|
106
106
|
|
|
107
107
|
/**
|
|
108
108
|
* Currency value format - supports both object and string representations
|
|
109
109
|
*/
|
|
110
|
-
export type
|
|
110
|
+
export type CurrencyValueType =
|
|
111
111
|
| { value: number; currency: string } // Object format: {value: 100.50, currency: "USD"}
|
|
112
112
|
| string; // String format: "100.50 USD" or "USD 100.50"
|
|
113
113
|
|
|
114
114
|
/**
|
|
115
115
|
* JSON field for structured data
|
|
116
116
|
* @template T - Expected JSON structure (optional)
|
|
117
|
-
* Resolves to: T or
|
|
117
|
+
* Resolves to: T or JSONValueType
|
|
118
118
|
* Storage: JSON/TEXT in database
|
|
119
119
|
* Use this for configurations, metadata, flexible schemas
|
|
120
120
|
*
|
|
121
121
|
* @example
|
|
122
|
-
*
|
|
123
|
-
*
|
|
122
|
+
* JSONFieldType // => JSONValueType (any valid JSON)
|
|
123
|
+
* JSONFieldType<{settings: {theme: string}}> // => {settings: {theme: string}}
|
|
124
124
|
*/
|
|
125
|
-
export type
|
|
125
|
+
export type JSONFieldType<T = JSONValueType> = T;
|
|
126
126
|
|
|
127
|
-
export type
|
|
127
|
+
export type ReferenceFieldType = string;
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
130
|
* Valid JSON value types
|
|
131
131
|
*/
|
|
132
|
-
export type
|
|
132
|
+
export type JSONValueType =
|
|
133
133
|
| string
|
|
134
134
|
| number
|
|
135
135
|
| boolean
|
|
136
136
|
| null
|
|
137
|
-
|
|
|
138
|
-
|
|
|
137
|
+
| JSONObjectType
|
|
138
|
+
| JSONArrayType;
|
|
139
139
|
|
|
140
|
-
export interface
|
|
141
|
-
[key: string]:
|
|
140
|
+
export interface JSONObjectType {
|
|
141
|
+
[key: string]: JSONValueType;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
export interface
|
|
144
|
+
export interface JSONArrayType extends Array<JSONValueType> {}
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
147
|
* Select field for single choice from predefined options
|
|
@@ -151,9 +151,9 @@ export interface JSONArray extends Array<JSONValue> {}
|
|
|
151
151
|
* Use this for status fields, categories, enum-like values
|
|
152
152
|
*
|
|
153
153
|
* @example
|
|
154
|
-
*
|
|
154
|
+
* SelectFieldType<'active' | 'inactive' | 'pending'> // => 'active' | 'inactive' | 'pending'
|
|
155
155
|
*/
|
|
156
|
-
export type
|
|
156
|
+
export type SelectFieldType<T extends string> = T;
|
|
157
157
|
|
|
158
158
|
/**
|
|
159
159
|
* Lookup field for references to other records
|
|
@@ -163,10 +163,10 @@ export type SelectField<T extends string> = T;
|
|
|
163
163
|
* Use this for foreign keys, relationships, references
|
|
164
164
|
*
|
|
165
165
|
* @example
|
|
166
|
-
*
|
|
167
|
-
*
|
|
166
|
+
* LookupFieldType // => string (referenced record ID)
|
|
167
|
+
* LookupFieldType<IdFieldType> // => string (typed as IdFieldType)
|
|
168
168
|
*/
|
|
169
|
-
export type
|
|
169
|
+
export type LookupFieldType<T extends string = string> = T;
|
|
170
170
|
|
|
171
171
|
// ============================================================
|
|
172
172
|
// CONTAINER AND UTILITY TYPES
|
|
@@ -180,11 +180,11 @@ export type LookupField<T extends string = string> = T;
|
|
|
180
180
|
* Use this for tags, categories, multiple selections
|
|
181
181
|
*
|
|
182
182
|
* @example
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
183
|
+
* ArrayFieldType<string> // => string[]
|
|
184
|
+
* ArrayFieldType<IdFieldType> // => string[]
|
|
185
|
+
* ArrayFieldType<SelectFieldType<'tag1' | 'tag2'>> // => ('tag1' | 'tag2')[]
|
|
186
186
|
*/
|
|
187
|
-
export type
|
|
187
|
+
export type ArrayFieldType<T> = T[];
|
|
188
188
|
|
|
189
189
|
/**
|
|
190
190
|
* Nested object field
|
|
@@ -194,9 +194,9 @@ export type ArrayField<T> = T[];
|
|
|
194
194
|
* Use this for complex nested structures, embedded documents
|
|
195
195
|
*
|
|
196
196
|
* @example
|
|
197
|
-
*
|
|
197
|
+
* ObjectFieldType<{ name: string; age: number }> // => { name: string; age: number }
|
|
198
198
|
*/
|
|
199
|
-
export type
|
|
199
|
+
export type ObjectFieldType<T extends Record<string, any>> = T;
|
|
200
200
|
|
|
201
201
|
/**
|
|
202
202
|
* Optional field wrapper
|
|
@@ -205,10 +205,10 @@ export type ObjectField<T extends Record<string, any>> = T;
|
|
|
205
205
|
* Use this for fields that may not have values
|
|
206
206
|
*
|
|
207
207
|
* @example
|
|
208
|
-
*
|
|
209
|
-
*
|
|
208
|
+
* OptionalFieldType<StringFieldType> // => string | undefined
|
|
209
|
+
* OptionalFieldType<NumberFieldType> // => number | undefined
|
|
210
210
|
*/
|
|
211
|
-
export type
|
|
211
|
+
export type OptionalFieldType<T> = T | undefined;
|
|
212
212
|
|
|
213
213
|
// ============================================================
|
|
214
214
|
// UTILITY TYPES FOR FIELD VALIDATION
|
|
@@ -218,4 +218,4 @@ export type OptionalField<T> = T | undefined;
|
|
|
218
218
|
* Utility type to extract the base type from a field type
|
|
219
219
|
* Useful for runtime validation and type guards
|
|
220
220
|
*/
|
|
221
|
-
export type
|
|
221
|
+
export type ExtractFieldTypeType<T> = T extends OptionalFieldType<infer U> ? U : T;
|
package/sdk/types/common.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Sort direction for API queries (matching API spec)
|
|
3
3
|
*/
|
|
4
|
-
export type
|
|
4
|
+
export type SortDirectionType = "ASC" | "DESC";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Sort configuration: array of field-direction mappings
|
|
8
8
|
* Format: [{ "fieldName": "ASC" }, { "anotherField": "DESC" }]
|
|
9
9
|
*/
|
|
10
|
-
export type
|
|
10
|
+
export type SortOptionType = Record<string, SortDirectionType>;
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Sort configuration: array of sort options
|
|
14
14
|
*/
|
|
15
|
-
export type
|
|
15
|
+
export type SortType = SortOptionType[];
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Condition operators for individual conditions (leaf nodes)
|
|
19
19
|
* Used in Condition.Operator
|
|
20
20
|
*/
|
|
21
|
-
export type
|
|
21
|
+
export type ConditionOperatorType =
|
|
22
22
|
| "EQ" | "NE" | "GT" | "GTE" | "LT" | "LTE"
|
|
23
23
|
| "Between" | "NotBetween" | "IN" | "NIN"
|
|
24
24
|
| "Empty" | "NotEmpty" | "Contains" | "NotContains"
|
|
@@ -28,81 +28,57 @@ export type ConditionOperator =
|
|
|
28
28
|
* Operators for combining conditions in a group (tree nodes)
|
|
29
29
|
* Used in ConditionGroup.Operator
|
|
30
30
|
*/
|
|
31
|
-
export type
|
|
31
|
+
export type ConditionGroupOperatorType = "And" | "Or" | "Not";
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* RHS value type for filter conditions
|
|
35
35
|
*/
|
|
36
|
-
export type
|
|
36
|
+
export type FilterRHSTypeType = "Constant" | "BOField" | "AppVariable";
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Leaf condition (actual field comparison)
|
|
40
40
|
*/
|
|
41
|
-
export interface
|
|
41
|
+
export interface ConditionType {
|
|
42
42
|
/** Optional ID for hook state management (omitted in API payload) */
|
|
43
43
|
id?: string;
|
|
44
44
|
/** Condition operator */
|
|
45
|
-
Operator:
|
|
45
|
+
Operator: ConditionOperatorType;
|
|
46
46
|
/** Left-hand side field name */
|
|
47
47
|
LHSField: string;
|
|
48
48
|
/** Right-hand side value */
|
|
49
49
|
RHSValue: any;
|
|
50
50
|
/** Right-hand side type (optional, defaults to Constant) */
|
|
51
|
-
RHSType?:
|
|
51
|
+
RHSType?: FilterRHSTypeType;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* Group combining conditions (recursive structure)
|
|
56
56
|
*/
|
|
57
|
-
export interface
|
|
57
|
+
export interface ConditionGroupType {
|
|
58
58
|
/** Optional ID for hook state management (omitted in API payload) */
|
|
59
59
|
id?: string;
|
|
60
60
|
/** Group operator (And, Or, Not) */
|
|
61
|
-
Operator:
|
|
61
|
+
Operator: ConditionGroupOperatorType;
|
|
62
62
|
/** Nested conditions (can be Condition or ConditionGroup) */
|
|
63
|
-
Condition: Array<
|
|
63
|
+
Condition: Array<ConditionType | ConditionGroupType>;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* Root filter type (alias for ConditionGroup)
|
|
68
68
|
*/
|
|
69
|
-
export type
|
|
70
|
-
|
|
71
|
-
// ============================================================
|
|
72
|
-
// LEGACY TYPE ALIASES (for backwards compatibility)
|
|
73
|
-
// ============================================================
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* @deprecated Use `Condition` instead
|
|
77
|
-
*/
|
|
78
|
-
export type FilterCondition = Condition;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* @deprecated Use `ConditionGroup` instead
|
|
82
|
-
*/
|
|
83
|
-
export type FilterLogical = ConditionGroup;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* @deprecated Use `ConditionGroupOperator` instead
|
|
87
|
-
*/
|
|
88
|
-
export type FilterOperator = ConditionGroupOperator;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* @deprecated Use `Condition | ConditionGroup` instead
|
|
92
|
-
*/
|
|
93
|
-
export type FilterNode = Condition | ConditionGroup;
|
|
69
|
+
export type FilterType = ConditionGroupType;
|
|
94
70
|
|
|
95
71
|
/**
|
|
96
72
|
* DateTime encoding format used by the API
|
|
97
73
|
*/
|
|
98
|
-
export interface
|
|
74
|
+
export interface DateTimeEncodedType {
|
|
99
75
|
$__dt__: number;
|
|
100
76
|
}
|
|
101
77
|
|
|
102
78
|
/**
|
|
103
|
-
* Date encoding format used by the API
|
|
79
|
+
* Date encoding format used by the API
|
|
104
80
|
*/
|
|
105
|
-
export interface
|
|
81
|
+
export interface DateEncodedType {
|
|
106
82
|
$__d__: string;
|
|
107
83
|
}
|
|
108
84
|
|
|
@@ -110,7 +86,7 @@ export interface DateEncoded {
|
|
|
110
86
|
* Standard paginated list response
|
|
111
87
|
* @template T - Type of items in the list
|
|
112
88
|
*/
|
|
113
|
-
export interface
|
|
89
|
+
export interface ListResponseType<T> {
|
|
114
90
|
/** Array of items for current page */
|
|
115
91
|
Data: T[];
|
|
116
92
|
}
|
|
@@ -119,7 +95,7 @@ export interface ListResponse<T> {
|
|
|
119
95
|
* Read API response wrapper
|
|
120
96
|
* @template T - Type of the data object
|
|
121
97
|
*/
|
|
122
|
-
export interface
|
|
98
|
+
export interface ReadResponseType<T> {
|
|
123
99
|
/** The data object */
|
|
124
100
|
Data: T;
|
|
125
101
|
}
|
|
@@ -127,7 +103,7 @@ export interface ReadResponse<T> {
|
|
|
127
103
|
/**
|
|
128
104
|
* Create/Update API response
|
|
129
105
|
*/
|
|
130
|
-
export interface
|
|
106
|
+
export interface CreateUpdateResponseType {
|
|
131
107
|
/** ID of the created/updated record */
|
|
132
108
|
_id: string;
|
|
133
109
|
}
|
|
@@ -135,7 +111,7 @@ export interface CreateUpdateResponse {
|
|
|
135
111
|
/**
|
|
136
112
|
* Delete API response
|
|
137
113
|
*/
|
|
138
|
-
export interface
|
|
114
|
+
export interface DeleteResponseType {
|
|
139
115
|
/** Status of the delete operation */
|
|
140
116
|
status: "success";
|
|
141
117
|
}
|
|
@@ -143,7 +119,7 @@ export interface DeleteResponse {
|
|
|
143
119
|
/**
|
|
144
120
|
* Count API response
|
|
145
121
|
*/
|
|
146
|
-
export interface
|
|
122
|
+
export interface CountResponseType {
|
|
147
123
|
/** Total count of matching records */
|
|
148
124
|
Count: number;
|
|
149
125
|
}
|
|
@@ -151,7 +127,7 @@ export interface CountResponse {
|
|
|
151
127
|
/**
|
|
152
128
|
* Options for list queries (API request format)
|
|
153
129
|
*/
|
|
154
|
-
export interface
|
|
130
|
+
export interface ListOptionsType {
|
|
155
131
|
/** Query type (defaults to "List") */
|
|
156
132
|
Type?: "List";
|
|
157
133
|
|
|
@@ -159,10 +135,10 @@ export interface ListOptions {
|
|
|
159
135
|
Field?: string[];
|
|
160
136
|
|
|
161
137
|
/** Filter criteria */
|
|
162
|
-
Filter?:
|
|
138
|
+
Filter?: FilterType;
|
|
163
139
|
|
|
164
140
|
/** Sort configuration */
|
|
165
|
-
Sort?:
|
|
141
|
+
Sort?: SortType;
|
|
166
142
|
|
|
167
143
|
/** Search query (separate from filters) */
|
|
168
144
|
Search?: string;
|
|
@@ -181,7 +157,7 @@ export interface ListOptions {
|
|
|
181
157
|
/**
|
|
182
158
|
* Metric aggregation function types
|
|
183
159
|
*/
|
|
184
|
-
export type
|
|
160
|
+
export type MetricTypeType =
|
|
185
161
|
| "Sum"
|
|
186
162
|
| "Avg"
|
|
187
163
|
| "Count"
|
|
@@ -196,31 +172,31 @@ export type MetricType =
|
|
|
196
172
|
/**
|
|
197
173
|
* Metric field configuration
|
|
198
174
|
*/
|
|
199
|
-
export interface
|
|
175
|
+
export interface MetricFieldType {
|
|
200
176
|
/** Field to aggregate */
|
|
201
177
|
Field: string;
|
|
202
178
|
/** Aggregation function type */
|
|
203
|
-
Type:
|
|
179
|
+
Type: MetricTypeType;
|
|
204
180
|
}
|
|
205
181
|
|
|
206
182
|
/**
|
|
207
183
|
* Options for metric/aggregate queries
|
|
208
184
|
*/
|
|
209
|
-
export interface
|
|
185
|
+
export interface MetricOptionsType {
|
|
210
186
|
/** Query type (always "Metric") */
|
|
211
187
|
Type: "Metric";
|
|
212
188
|
/** Fields to group by */
|
|
213
189
|
GroupBy: string[];
|
|
214
190
|
/** Metric definitions */
|
|
215
|
-
Metric:
|
|
191
|
+
Metric: MetricFieldType[];
|
|
216
192
|
/** Optional filter criteria */
|
|
217
|
-
Filter?:
|
|
193
|
+
Filter?: FilterType;
|
|
218
194
|
}
|
|
219
195
|
|
|
220
196
|
/**
|
|
221
197
|
* Response from metric endpoint
|
|
222
198
|
*/
|
|
223
|
-
export interface
|
|
199
|
+
export interface MetricResponseType {
|
|
224
200
|
/** Aggregated data rows */
|
|
225
201
|
Data: Record<string, any>[];
|
|
226
202
|
}
|
|
@@ -232,21 +208,21 @@ export interface MetricResponse {
|
|
|
232
208
|
/**
|
|
233
209
|
* Pivot table header item (hierarchical)
|
|
234
210
|
*/
|
|
235
|
-
export interface
|
|
211
|
+
export interface PivotHeaderItemType {
|
|
236
212
|
/** Header key/label */
|
|
237
213
|
Key: string;
|
|
238
214
|
/** Child headers for nested grouping */
|
|
239
|
-
Children?:
|
|
215
|
+
Children?: PivotHeaderItemType[] | null;
|
|
240
216
|
}
|
|
241
217
|
|
|
242
218
|
/**
|
|
243
219
|
* Pivot response data structure
|
|
244
220
|
*/
|
|
245
|
-
export interface
|
|
221
|
+
export interface PivotResponseDataType {
|
|
246
222
|
/** Row headers */
|
|
247
|
-
RowHeader:
|
|
223
|
+
RowHeader: PivotHeaderItemType[];
|
|
248
224
|
/** Column headers */
|
|
249
|
-
ColumnHeader:
|
|
225
|
+
ColumnHeader: PivotHeaderItemType[];
|
|
250
226
|
/** Value matrix [row][column] */
|
|
251
227
|
Value: (number | string | null)[][];
|
|
252
228
|
}
|
|
@@ -254,7 +230,7 @@ export interface PivotResponseData {
|
|
|
254
230
|
/**
|
|
255
231
|
* Options for pivot queries
|
|
256
232
|
*/
|
|
257
|
-
export interface
|
|
233
|
+
export interface PivotOptionsType {
|
|
258
234
|
/** Query type (always "Pivot") */
|
|
259
235
|
Type: "Pivot";
|
|
260
236
|
/** Row dimension fields */
|
|
@@ -262,17 +238,17 @@ export interface PivotOptions {
|
|
|
262
238
|
/** Column dimension fields */
|
|
263
239
|
Column: string[];
|
|
264
240
|
/** Metric definitions */
|
|
265
|
-
Metric:
|
|
241
|
+
Metric: MetricFieldType[];
|
|
266
242
|
/** Optional filter criteria */
|
|
267
|
-
Filter?:
|
|
243
|
+
Filter?: FilterType;
|
|
268
244
|
}
|
|
269
245
|
|
|
270
246
|
/**
|
|
271
247
|
* Response from pivot endpoint
|
|
272
248
|
*/
|
|
273
|
-
export interface
|
|
249
|
+
export interface PivotResponseType {
|
|
274
250
|
/** Pivot data including headers and values */
|
|
275
|
-
Data:
|
|
251
|
+
Data: PivotResponseDataType;
|
|
276
252
|
}
|
|
277
253
|
|
|
278
254
|
// ============================================================
|
|
@@ -282,7 +258,7 @@ export interface PivotResponse {
|
|
|
282
258
|
/**
|
|
283
259
|
* Response from draft operations
|
|
284
260
|
*/
|
|
285
|
-
export interface
|
|
261
|
+
export interface DraftResponseType {
|
|
286
262
|
/** Computed field values */
|
|
287
263
|
[fieldName: string]: any;
|
|
288
264
|
}
|
|
@@ -294,7 +270,7 @@ export interface DraftResponse {
|
|
|
294
270
|
/**
|
|
295
271
|
* Response from fields endpoint
|
|
296
272
|
*/
|
|
297
|
-
export interface
|
|
273
|
+
export interface FieldsResponseType {
|
|
298
274
|
/** Field metadata */
|
|
299
275
|
Data: Record<string, any>[];
|
|
300
276
|
}
|
|
@@ -306,7 +282,7 @@ export interface FieldsResponse {
|
|
|
306
282
|
/**
|
|
307
283
|
* Single option returned from fetch field endpoint
|
|
308
284
|
*/
|
|
309
|
-
export interface
|
|
285
|
+
export interface FetchFieldOptionType {
|
|
310
286
|
/** The value to be stored */
|
|
311
287
|
Value: string;
|
|
312
288
|
/** The display label */
|
|
@@ -316,7 +292,7 @@ export interface FetchFieldOption {
|
|
|
316
292
|
/**
|
|
317
293
|
* Response from fetch field endpoint
|
|
318
294
|
*/
|
|
319
|
-
export interface
|
|
295
|
+
export interface FetchFieldResponseType {
|
|
320
296
|
/** Array of field options */
|
|
321
|
-
Data:
|
|
322
|
-
}
|
|
297
|
+
Data: FetchFieldOptionType[];
|
|
298
|
+
}
|
package/sdk/types/index.ts
CHANGED
package/sdk/utils/formatting.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CurrencyValueType, JSONValueType } from '../types/base-fields';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Data formatting utilities for display and conversion
|
|
@@ -7,7 +7,7 @@ import type { CurrencyValue, JSONValue } from '../types/base-fields';
|
|
|
7
7
|
/**
|
|
8
8
|
* Format currency value for display
|
|
9
9
|
*/
|
|
10
|
-
export function formatCurrency(value:
|
|
10
|
+
export function formatCurrency(value: CurrencyValueType): string {
|
|
11
11
|
if (typeof value === 'string') {
|
|
12
12
|
return value; // Already formatted
|
|
13
13
|
}
|
|
@@ -26,7 +26,7 @@ export function formatCurrency(value: CurrencyValue): string {
|
|
|
26
26
|
/**
|
|
27
27
|
* Parse currency string to currency object
|
|
28
28
|
*/
|
|
29
|
-
export function parseCurrency(value: string):
|
|
29
|
+
export function parseCurrency(value: string): CurrencyValueType | null {
|
|
30
30
|
// Try to parse "USD 100.50" or "100.50 USD" format
|
|
31
31
|
const match = value.match(/^(?:([A-Z]{3})\s+(\d+\.?\d*))|(?:(\d+\.?\d*)\s+([A-Z]{3}))$/);
|
|
32
32
|
|
|
@@ -90,7 +90,7 @@ export function formatNumber(value: number, precision: number = 2): string {
|
|
|
90
90
|
/**
|
|
91
91
|
* Format JSON value for display
|
|
92
92
|
*/
|
|
93
|
-
export function formatJSON(value:
|
|
93
|
+
export function formatJSON(value: JSONValueType, indent: number = 2): string {
|
|
94
94
|
try {
|
|
95
95
|
return JSON.stringify(value, null, indent);
|
|
96
96
|
} catch {
|
package/sdk/utils.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// ============================================================
|
|
2
|
+
// UTILS MODULE - Main Entry Point
|
|
3
|
+
// @ram_28/kf-ai-sdk/utils
|
|
4
|
+
// ============================================================
|
|
5
|
+
|
|
6
|
+
// Formatting utilities
|
|
7
|
+
export * from './utils/formatting';
|
|
8
|
+
|
|
9
|
+
// Class name utilities
|
|
10
|
+
export * from './utils/cn';
|