@ram_28/kf-ai-sdk 2.0.20-beta.2 → 2.0.21

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 (94) hide show
  1. package/README.md +16 -8
  2. package/dist/api.cjs +1 -1
  3. package/dist/api.mjs +1 -1
  4. package/dist/auth/authConfig.d.ts +1 -1
  5. package/dist/auth/types.d.ts +1 -1
  6. package/dist/auth/types.d.ts.map +1 -1
  7. package/dist/auth.cjs +1 -1
  8. package/dist/auth.mjs +1 -1
  9. package/dist/bdo/core/Item.d.ts.map +1 -1
  10. package/dist/bdo.cjs +1 -1
  11. package/dist/bdo.mjs +1 -1
  12. package/dist/components/hooks/useActivityForm/types.d.ts +4 -5
  13. package/dist/components/hooks/useActivityForm/types.d.ts.map +1 -1
  14. package/dist/components/hooks/useActivityForm/useActivityForm.d.ts.map +1 -1
  15. package/dist/components/hooks/useActivityTable/types.d.ts +5 -4
  16. package/dist/components/hooks/useActivityTable/types.d.ts.map +1 -1
  17. package/dist/components/hooks/useActivityTable/useActivityTable.d.ts.map +1 -1
  18. package/dist/components/hooks/useBDOForm/createItemProxy.d.ts +2 -2
  19. package/dist/components/hooks/useBDOForm/createItemProxy.d.ts.map +1 -1
  20. package/dist/components/hooks/useBDOTable/types.d.ts +20 -12
  21. package/dist/components/hooks/useBDOTable/types.d.ts.map +1 -1
  22. package/dist/components/hooks/useBDOTable/useBDOTable.d.ts +2 -2
  23. package/dist/components/hooks/useBDOTable/useBDOTable.d.ts.map +1 -1
  24. package/dist/{constants-ConHc1oS.js → constants-Cyi942Yr.js} +5 -5
  25. package/dist/constants-DEmYwKfC.cjs +1 -0
  26. package/dist/filter.cjs +1 -1
  27. package/dist/filter.mjs +1 -1
  28. package/dist/form.cjs +1 -1
  29. package/dist/form.mjs +1 -1
  30. package/dist/table.cjs +1 -1
  31. package/dist/table.mjs +15 -16
  32. package/dist/table.types.d.ts +1 -1
  33. package/dist/table.types.d.ts.map +1 -1
  34. package/dist/types/constants.d.ts +1 -1
  35. package/dist/workflow/Activity.d.ts +8 -5
  36. package/dist/workflow/Activity.d.ts.map +1 -1
  37. package/dist/workflow.cjs +1 -1
  38. package/dist/workflow.mjs +461 -476
  39. package/docs/README.md +57 -0
  40. package/docs/bdo/README.md +161 -0
  41. package/docs/bdo/api_reference.md +281 -0
  42. package/docs/examples/bdo/create-product.md +69 -0
  43. package/docs/examples/bdo/edit-product-dialog.md +95 -0
  44. package/docs/examples/bdo/filtered-product-table.md +100 -0
  45. package/docs/examples/bdo/product-listing.md +73 -0
  46. package/docs/examples/bdo/supplier-dropdown.md +60 -0
  47. package/docs/examples/fields/complex-fields.md +248 -0
  48. package/docs/examples/fields/primitive-fields.md +217 -0
  49. package/docs/examples/workflow/approve-leave-request.md +76 -0
  50. package/docs/examples/workflow/filtered-activity-table.md +101 -0
  51. package/docs/examples/workflow/my-pending-requests.md +90 -0
  52. package/docs/examples/workflow/start-new-workflow.md +47 -0
  53. package/docs/examples/workflow/submit-leave-request.md +72 -0
  54. package/docs/examples/workflow/workflow-progress.md +49 -0
  55. package/docs/fields/README.md +141 -0
  56. package/docs/fields/api_reference.md +134 -0
  57. package/docs/useActivityForm/README.md +244 -0
  58. package/docs/useActivityForm/api_reference.md +279 -0
  59. package/docs/useActivityTable/README.md +263 -0
  60. package/docs/useActivityTable/api_reference.md +294 -0
  61. package/docs/useBDOForm/README.md +175 -0
  62. package/docs/useBDOForm/api_reference.md +244 -0
  63. package/docs/useBDOTable/README.md +242 -0
  64. package/docs/useBDOTable/api_reference.md +253 -0
  65. package/docs/useFilter/README.md +323 -0
  66. package/docs/useFilter/api_reference.md +228 -0
  67. package/docs/workflow/README.md +158 -0
  68. package/docs/workflow/api_reference.md +161 -0
  69. package/package.json +15 -14
  70. package/sdk/auth/authConfig.ts +1 -1
  71. package/sdk/auth/types.ts +1 -1
  72. package/sdk/bdo/core/Item.ts +2 -1
  73. package/sdk/bdo/expressions/evaluator.ts +8 -4
  74. package/sdk/components/hooks/useActivityForm/types.ts +4 -6
  75. package/sdk/components/hooks/useActivityForm/useActivityForm.ts +10 -73
  76. package/sdk/components/hooks/useActivityTable/types.ts +4 -5
  77. package/sdk/components/hooks/useActivityTable/useActivityTable.ts +10 -8
  78. package/sdk/components/hooks/useBDOForm/createItemProxy.ts +9 -5
  79. package/sdk/components/hooks/useBDOTable/types.ts +20 -10
  80. package/sdk/components/hooks/useBDOTable/useBDOTable.ts +12 -8
  81. package/sdk/table.types.ts +2 -0
  82. package/sdk/types/constants.ts +1 -1
  83. package/sdk/workflow/Activity.ts +39 -7
  84. package/dist/constants-QX2RX-wu.cjs +0 -1
  85. package/docs/api.md +0 -95
  86. package/docs/bdo.md +0 -224
  87. package/docs/gaps.md +0 -360
  88. package/docs/useActivityForm.md +0 -393
  89. package/docs/useActivityTable.md +0 -418
  90. package/docs/useBDOForm.md +0 -498
  91. package/docs/useBDOTable.md +0 -284
  92. package/docs/useFilter.md +0 -188
  93. package/docs/workflow.md +0 -560
  94. /package/docs/{useAuth.md → useAuth/README.md} +0 -0
package/docs/bdo.md DELETED
@@ -1,224 +0,0 @@
1
- # BDO SDK API
2
-
3
- Type-safe, role-based data access layer for business objects.
4
-
5
- ## Imports
6
-
7
- ```typescript
8
- // BDO class (from generated code)
9
- import { AdminProduct } from "@/bdo/admin/Product";
10
- import type { AdminProductEditableFieldType, AdminProductFieldType } from "@/bdo/admin/Product";
11
-
12
- // SDK types
13
- import type { ItemType, SystemFieldsType } from "@ram_28/kf-ai-sdk/bdo/types";
14
- import type { ListOptionsType, CreateUpdateResponseType, DeleteResponseType } from "@ram_28/kf-ai-sdk/api/types";
15
- ```
16
-
17
- ---
18
-
19
- ## Common Mistakes (READ FIRST)
20
-
21
- ### 1. Guessing field names instead of reading BDO files
22
-
23
- ALWAYS read `src/bdo/{role}/*.ts` BEFORE writing page code. Use EXACT field names from the class.
24
-
25
- ```typescript
26
- // ❌ WRONG — guessing
27
- bdo.productName bdo.isActive bdo.unitPrice
28
-
29
- // ✅ CORRECT — exact snake_case from BDO file
30
- bdo.product_name bdo.is_active bdo.unit_price
31
- ```
32
-
33
- ### 2. Rendering ItemType fields directly in JSX without `.get()`
34
-
35
- `bdo.list()`, `bdo.get()`, `bdo.create()` return `ItemType` — each field is an accessor object, NOT a value.
36
-
37
- ```tsx
38
- // ❌ WRONG — renders [object Object]
39
- const item = await bdo.get(id);
40
- <span>{item.product_name}</span>
41
-
42
- // ✅ CORRECT — call .get()
43
- <span>{item.product_name.get()}</span>
44
- <span>{item.product_name.get() ?? "—"}</span>
45
- ```
46
-
47
- **Key distinction:** `useTable().rows` are plain objects (access `row.field` directly). `bdo.get()`/`bdo.list()` return ItemType proxies (must call `item.field.get()`).
48
-
49
- ### 3. Rendering Image/File/Reference values in detail pages
50
-
51
- These field types return complex objects from `.get()` — NOT renderable as React children.
52
-
53
- ```tsx
54
- // ❌ WRONG — FileType/ImageFieldType are objects, not ReactNode
55
- <span>{item.product_image.get()}</span> // ImageFieldType = FileType | null
56
- <span>{item.attachments.get()}</span> // FileFieldType = FileType[]
57
- <span>{item.category.get()}</span> // Reference = { _id, _name, ... }
58
-
59
- // ✅ CORRECT — extract the renderable value
60
- // Image: use ImageThumbnail component (NEVER use src="#")
61
- import { ImageThumbnail } from "@/components/system/image-thumbnail";
62
- <ImageThumbnail boId={bdo.meta._id} instanceId={item._id} fieldId={bdo.product_image.id} value={item.product_image.get()} imgClassName="w-24 h-24 object-cover rounded" />
63
-
64
- // Image: if you only need the filename as text
65
- const img = item.product_image.get();
66
- <span>{img ? (img as any).FileName : "No image"}</span>
67
-
68
- // File array: use FilePreview component
69
- import { FilePreview } from "@/components/system/file-preview";
70
- <FilePreview boId={bdo.meta._id} instanceId={item._id} fieldId={bdo.attachments.id} value={item.attachments.get()} />
71
-
72
- // Reference: access _name
73
- const ref = item.category.get();
74
- <span>{ref ? (ref as any)._name : "—"}</span>
75
-
76
- // Number: format
77
- <span>{(item.unit_price.get() ?? 0).toFixed(2)}</span>
78
-
79
- // Boolean: display
80
- <span>{item.is_active.get() ? "Yes" : "No"}</span>
81
- ```
82
-
83
- ### 4. Calling protected methods
84
-
85
- Only methods the role has permission for are `public`. Check the BDO file.
86
-
87
- ```typescript
88
- // ❌ WRONG — if delete is not in the role's BDO class
89
- await bdo.delete(id); // TS2445: Property 'delete' is protected
90
-
91
- // ✅ CORRECT — use api() for methods not on the BDO class
92
- import { api } from "@ram_28/kf-ai-sdk/api";
93
- await api(bdo.meta._id).delete(id);
94
- ```
95
-
96
- ### 5. Not handling `.get()` return type (undefined)
97
-
98
- ```typescript
99
- // ❌ WRONG — might be undefined
100
- const title: string = item.product_name.get();
101
-
102
- // ✅ CORRECT — provide fallback
103
- const title = item.product_name.get() ?? "";
104
- const price = item.unit_price.get() ?? 0;
105
- ```
106
-
107
- ---
108
-
109
- ## BDO Meta & Fields
110
-
111
- ```typescript
112
- const product = new AdminProduct();
113
- product.meta._id; // "BDO_Product" — use as source in useTable, api()
114
- product.meta.name; // "Product"
115
-
116
- // Field getters (all field types)
117
- product.product_name.id // "product_name" — use in register(), watch(), setValue()
118
- product.product_name.label // "product_name" — display label
119
- product.product_name.required // boolean
120
- product.product_name.readOnly // boolean
121
- product.product_name.defaultValue // unknown
122
- ```
123
-
124
- ## Field Classes
125
-
126
- | Class | Extra Getters | Notes |
127
- |-------|--------------|-------|
128
- | `StringField` | `length` | May have `Constraint.Enum` — see useBDOForm Mistake #3 |
129
- | `NumberField` | `integerPart`, `fractionPart` | |
130
- | `BooleanField` | — | |
131
- | `DateField` | — | Format: YYYY-MM-DD |
132
- | `DateTimeField` | `precision` | Format: YYYY-MM-DDTHH:MM:SS |
133
- | `SelectField` | **`options`**, `fetchOptions(instanceId)` | `.options` returns `{ value, label }[]` |
134
- | `ReferenceField` | `fetchOptions(instanceId)`, `referenceBdo` | Value is object `{ _id, _name, ... }` |
135
- | `TextField` | `format` | Long text |
136
- | `UserField` | `fetchOptions(instanceId)` | Value: `{ _id, _name }` |
137
- | `ImageField` | — | Value: `FileType \| null` |
138
- | `FileField` | — | Value: `FileType[]` |
139
-
140
- **CRITICAL**: Only `SelectField` has `.options` getter. `StringField` with `Constraint.Enum` does NOT.
141
-
142
- ---
143
-
144
- ## Methods
145
-
146
- All methods are `protected` on `BaseBdo`. Role BDOs selectively expose them as `public`.
147
-
148
- ```typescript
149
- // Read
150
- const item = await bdo.get(id); // ItemType — call .get() on fields
151
- const items = await bdo.list(options?); // ItemType[] — call .get() on fields
152
- const count = await bdo.count(options?); // number
153
-
154
- // Write
155
- const created = await bdo.create(data); // ItemType
156
- const result = await bdo.update(id, data); // { _id: string }
157
- const deleted = await bdo.delete(id); // { status: "success" }
158
-
159
- // Draft
160
- const draft = await bdo.draft(data); // { [field]: computed_value }
161
- const draftPatch = await bdo.draftPatch(id, data);
162
- const draftInt = await bdo.draftInteraction(data); // { _id, ...computed }
163
-
164
- // Analytics
165
- const metric = await bdo.metric({ GroupBy: [], Metric: [{ Field: "_id", Type: "Count" }] });
166
- // Access: metric.Data[0]["count__id"] (key pattern: {type}_{Field})
167
-
168
- const pivot = await bdo.pivot({ Row: ["category"], Column: ["status"], Metric: [{ Field: "_id", Type: "Count" }] });
169
- // Access: pivot.Data.RowHeader, pivot.Data.ColumnHeader, pivot.Data.Value[row][col]
170
- ```
171
-
172
- ### ListOptionsType
173
-
174
- ```typescript
175
- interface ListOptionsType {
176
- Field?: string[]; // Specific fields (omit for all)
177
- Filter?: FilterType; // See useFilter docs
178
- Sort?: Record<string, "ASC" | "DESC">[]; // [{ "field": "ASC" }]
179
- Page?: number; // 1-indexed
180
- PageSize?: number; // Default: 10
181
- }
182
- ```
183
-
184
- ---
185
-
186
- ## ItemType Accessor Pattern
187
-
188
- `get()`, `list()`, `create()` return `ItemType` with Proxy-wrapped field accessors.
189
-
190
- ```typescript
191
- const item = await bdo.get("id123");
192
-
193
- item._id; // "id123" — direct access (only _id)
194
- item.product_name.get(); // string | undefined
195
- item.product_name.set("New"); // editable fields only
196
- item.product_name.label; // "product_name"
197
- item.product_name.required; // boolean
198
- item.toJSON(); // plain object
199
- ```
200
-
201
- ## SystemFieldsType
202
-
203
- ```typescript
204
- type SystemFieldsType = {
205
- _id: string;
206
- _created_at: string; // "YYYY-MM-DDTHH:MM:SS"
207
- _modified_at: string;
208
- _created_by: { _id: string; _name: string };
209
- _modified_by: { _id: string; _name: string };
210
- _version: string;
211
- _m_version: string;
212
- };
213
- ```
214
-
215
- ## API Types
216
-
217
- ```typescript
218
- interface CreateUpdateResponseType { _id: string; }
219
- interface DeleteResponseType { status: "success"; }
220
- interface FileType { _id: string; _name: string; FileName: string; FileExtension: string; Size: number; ContentType: string; }
221
- type ImageFieldType = FileType | null;
222
- type FileFieldType = FileType[];
223
- type AggregationType = "Sum" | "Avg" | "Count" | "Max" | "Min" | "DistinctCount" | "BlankCount" | "NotBlankCount" | "Concat" | "DistinctConcat";
224
- ```
package/docs/gaps.md DELETED
@@ -1,360 +0,0 @@
1
- # Documentation Gaps — Critical Issues
2
-
3
- Audit of all 8 docs against the source code. Only **critical** issues listed (wrong code, broken imports, missing major features).
4
-
5
- ---
6
-
7
- ## docs/api.md
8
-
9
- ### 1. Most API client methods are undocumented
10
-
11
- The doc only covers `get`, `list`, `create`, `update`, `delete`. These 13 methods are completely missing:
12
-
13
- | Method | Return Type |
14
- |--------|------------|
15
- | `count(options?)` | `CountResponseType` |
16
- | `draft(data)` | `DraftResponseType` |
17
- | `draftUpdate(id, data)` | `CreateUpdateResponseType` |
18
- | `draftPatch(id, data)` | `DraftResponseType` |
19
- | `draftInteraction(data)` | `DraftResponseType & { _id: string }` |
20
- | `metric(options)` | `MetricResponseType` |
21
- | `pivot(options)` | `PivotResponseType` |
22
- | `fields()` | `FieldsResponseType` |
23
- | `fetchField(instanceId, fieldId)` | `TResult[]` |
24
- | `getUploadUrl(instanceId, fieldId, files)` | `FileUploadResponseType[]` |
25
- | `getDownloadUrl(instanceId, fieldId, attachmentId, viewType?)` | `FileDownloadResponseType` |
26
- | `getDownloadUrls(instanceId, fieldId, viewType?)` | `FileDownloadResponseType[]` |
27
- | `deleteAttachment(instanceId, fieldId, attachmentId)` | `void` |
28
-
29
- **Source**: `sdk/api/client.ts` lines 28-167 (`ResourceClientType` interface)
30
-
31
- ### 2. API configuration functions are undocumented
32
-
33
- The most fundamental setup step — telling the SDK where the API lives — is not documented:
34
-
35
- ```typescript
36
- // These are exported from @ram_28/kf-ai-sdk/api but not in the doc
37
- setApiBaseUrl(url: string): void
38
- getApiBaseUrl(): string
39
- setDefaultHeaders(headers: Record<string, string>): void
40
- getDefaultHeaders(): Record<string, string>
41
- ```
42
-
43
- **Source**: `sdk/api/client.ts` lines 190-213, `sdk/api.ts` lines 9-13
44
-
45
- ---
46
-
47
- ## docs/bdo.md
48
-
49
- ### 3. `ArrayField` and `ObjectField` missing from field classes table
50
-
51
- Two entire field classes are undocumented:
52
-
53
- - `ArrayField<T>` — has `elementType` getter (returns `BaseFieldMetaType | undefined`)
54
- - `ObjectField<T>` — has `properties` getter (returns `Record<string, unknown> | undefined`)
55
-
56
- **Source**: `sdk/bdo/fields/ArrayField.ts`, `sdk/bdo/fields/ObjectField.ts`
57
-
58
- ### 4. `draftUpdate` method undocumented
59
-
60
- Protected CRUD method on `BaseBdo` that commits changes on an existing draft record:
61
-
62
- ```typescript
63
- protected async draftUpdate(id: string, data: Partial<TEditable>): Promise<CreateUpdateResponseType>
64
- ```
65
-
66
- **Source**: `sdk/bdo/core/BaseBdo.ts` lines 275-280
67
-
68
- ### 5. File/Image attachment methods on Item accessors are undocumented
69
-
70
- When an Item field is Image or File type, the accessor gets enriched with attachment methods. None are documented:
71
-
72
- **Image field accessor (editable)**:
73
- - `upload(file: File): Promise<FileType>`
74
- - `getDownloadUrl(viewType?): Promise<FileDownloadResponseType>`
75
- - `deleteAttachment(): Promise<void>`
76
-
77
- **Image field accessor (readonly)**:
78
- - `getDownloadUrl(viewType?): Promise<FileDownloadResponseType>`
79
-
80
- **File field accessor (editable)**:
81
- - `upload(files: File[]): Promise<FileType[]>`
82
- - `getDownloadUrl(attachmentId, viewType?): Promise<FileDownloadResponseType>`
83
- - `getDownloadUrls(viewType?): Promise<FileDownloadResponseType[]>`
84
- - `deleteAttachment(attachmentId): Promise<void>`
85
-
86
- **File field accessor (readonly)**:
87
- - `getDownloadUrl(attachmentId, viewType?): Promise<FileDownloadResponseType>`
88
- - `getDownloadUrls(viewType?): Promise<FileDownloadResponseType[]>`
89
-
90
- **Source**: `sdk/bdo/core/types.ts` lines 194-235, `sdk/bdo/core/Item.ts` lines 293-463
91
-
92
- ---
93
-
94
- ## docs/useBDOForm.md
95
-
96
- ### 6. `UseBDOFormOptionsType` missing 3 feature flags
97
-
98
- All three variants of the options type are missing these properties:
99
-
100
- ```typescript
101
- enableDraft?: boolean; // default: false (currently unused internally)
102
- enableConstraintValidation?: boolean; // default: true (required, length, etc.)
103
- enableExpressionValidation?: boolean; // default: true (backend expression rules)
104
- ```
105
-
106
- **Source**: `sdk/components/hooks/useBDOForm/types.ts` lines 90-123
107
-
108
- ### 7. `UseBDOFormReturnType` missing ~half its properties
109
-
110
- These properties are returned by the hook but not in the doc:
111
-
112
- | Property | Type |
113
- |----------|------|
114
- | `bdo` | `B` (the BDO reference) |
115
- | `operation` | `"create" \| "update"` |
116
- | `recordId` | `string \| undefined` |
117
- | `reset` | `UseFormReset` |
118
- | `trigger` | `UseFormTrigger` |
119
- | `isValid` | `boolean` |
120
- | `isSubmitSuccessful` | `boolean` |
121
- | `dirtyFields` | `Partial<Record<keyof AllFieldsType<B>, boolean>>` |
122
- | `isFetching` | `boolean` (separate from isLoading) |
123
- | `draftId` | `string \| undefined` |
124
- | `isCreatingDraft` | `boolean` |
125
-
126
- **Source**: `sdk/components/hooks/useBDOForm/types.ts` lines 190-232, `sdk/components/hooks/useBDOForm/useBDOForm.ts` lines 320-352
127
-
128
- ### 8. `handleSubmit` behavior is wrong — doc says `bdo.create()`/`bdo.update()`, actual uses `api()` directly
129
-
130
- The doc says handleSubmit "auto-calls `bdo.create()` or `bdo.update()`". The actual implementation:
131
-
132
- ```typescript
133
- // Create mode — uses api().draft(), NOT bdo.create()
134
- filteredData._id = draftData?._id;
135
- result = await api(bdo.meta._id).draft(filteredData);
136
-
137
- // Update mode — uses api().update() directly, NOT bdo.update()
138
- result = await api(bdo.meta._id).update(recordId!, filteredData);
139
- ```
140
-
141
- **Source**: `sdk/components/hooks/useBDOForm/useBDOForm.ts` lines 296-301
142
-
143
- ### 9. Draft mode is completely undocumented
144
-
145
- The entire draft-based creation flow is absent from the doc:
146
-
147
- 1. On form open (create mode), a draft is auto-created via `api().draftInteraction({})`
148
- 2. The draft `_id` is set into the form via `form.setValue("_id", draftData._id)`
149
- 3. Dirty fields are auto-patched to the draft on change (800ms debounce)
150
- 4. On submit, `api().draft(filteredData)` is called with the draft `_id`
151
- 5. `isLoading` reflects `isCreatingDraft` state
152
- 6. `draftId` and `isCreatingDraft` are returned
153
-
154
- **Source**: `sdk/components/hooks/useBDOForm/useBDOForm.ts` lines 125-138, 186-190, 222-261, 296-298
155
-
156
- ---
157
-
158
- ## docs/useBDOTable.md
159
-
160
- ### 10. `RHSType` import path is broken — will fail at build time
161
-
162
- The doc shows:
163
- ```typescript
164
- import { ConditionOperator, RHSType } from "@ram_28/kf-ai-sdk/filter";
165
- ```
166
-
167
- `RHSType` is **not** exported from the filter module under that name. It is renamed to `FilterValueSource` on export:
168
-
169
- ```typescript
170
- // sdk/filter.ts
171
- export { RHSType as FilterValueSource } from './types/constants';
172
- ```
173
-
174
- `RHSType` IS exported (under its original name) from `@ram_28/kf-ai-sdk/table`:
175
- ```typescript
176
- // sdk/table.ts
177
- export { ConditionOperator, RHSType } from './types/constants';
178
- ```
179
-
180
- The complete example at line 121 has the same broken import, so the entire example won't compile.
181
-
182
- **Source**: `sdk/filter.ts` line 19, `sdk/table.ts` line 17
183
-
184
- ---
185
-
186
- ## docs/useActivityTable.md
187
-
188
- *No remaining critical gaps — #11 (GET endpoints ignoring options) was resolved when list/metric endpoints were switched to POST.*
189
-
190
- ---
191
-
192
- ## docs/useFilter.md
193
-
194
- ### 13. `updateGroupOperator` method missing from `UseFilterReturnType`
195
-
196
- Fully implemented and exported, but absent from the documented return type:
197
-
198
- ```typescript
199
- updateGroupOperator: (id: string, operator: ConditionGroupOperatorType) => void;
200
- ```
201
-
202
- Allows updating the operator ("And"/"Or"/"Not") of a nested condition group by ID.
203
-
204
- **Source**: `sdk/components/hooks/useFilter/types.ts` lines 122-127, `sdk/components/hooks/useFilter/useFilter.ts` lines 241-253
205
-
206
- ### 14. `getCondition` method missing from `UseFilterReturnType`
207
-
208
- Fully implemented and exported, but absent from the documented return type:
209
-
210
- ```typescript
211
- getCondition: (id: string) => ConditionType<T> | ConditionGroupType<T> | undefined;
212
- ```
213
-
214
- Looks up a condition or condition group by ID — essential for dynamic filter UIs.
215
-
216
- **Source**: `sdk/components/hooks/useFilter/types.ts` lines 139-144, `sdk/components/hooks/useFilter/useFilter.ts` lines 263-268
217
-
218
- ---
219
-
220
- ## docs/useAuth.md
221
-
222
- ### 15. `login()` parameter types are wrong
223
-
224
- Doc shows:
225
- ```typescript
226
- login: (provider?: string, options?: { callbackUrl?: string }) => void;
227
- ```
228
-
229
- Actual:
230
- ```typescript
231
- login: (provider?: AuthProviderNameType, options?: LoginOptionsType) => void;
232
- // AuthProviderNameType = "google" | "microsoft" | "github" | "custom"
233
- // LoginOptionsType = { callbackUrl?: string; params?: Record<string, string> }
234
- ```
235
-
236
- The `provider` is constrained to a union (not open `string`), and `options` has a `params` property the doc omits.
237
-
238
- **Source**: `sdk/auth/types.ts` line 170, lines 32, 118-123
239
-
240
- ### 16. `refreshSession` return type is `Promise<any>` — should be `Promise<SessionResponseType | null>`
241
-
242
- Doc shows:
243
- ```typescript
244
- refreshSession: () => Promise<any>;
245
- ```
246
-
247
- Actual:
248
- ```typescript
249
- refreshSession: () => Promise<SessionResponseType | null>;
250
- // SessionResponseType = { userDetails: UserDetailsType; staticBaseUrl: string; buildId: string }
251
- ```
252
-
253
- **Source**: `sdk/auth/types.ts` line 181, `sdk/auth/AuthProvider.tsx` lines 167-168
254
-
255
- ### 17. `AuthProvider` props completely undocumented
256
-
257
- `AuthProviderPropsType` has 7 props — none are documented or shown in any example:
258
-
259
- ```typescript
260
- interface AuthProviderPropsType {
261
- children: React.ReactNode;
262
- config?: Partial<AuthConfigType>;
263
- onAuthChange?: (status: AuthStatusType, user: UserDetailsType | null) => void;
264
- onError?: (error: Error) => void;
265
- loadingComponent?: React.ReactNode;
266
- unauthenticatedComponent?: React.ReactNode;
267
- skipInitialCheck?: boolean;
268
- }
269
- ```
270
-
271
- **Source**: `sdk/auth/types.ts` lines 93-113
272
-
273
- ### 18. `AuthConfigType` and `configureAuth()` completely undocumented
274
-
275
- The entire auth configuration system is exported but absent from docs:
276
-
277
- ```typescript
278
- // Exported from @ram_28/kf-ai-sdk/auth
279
- configureAuth(config: Partial<AuthConfigType>): void
280
- getAuthConfig(): AuthConfigType
281
- setAuthProvider(provider: AuthProviderNameType): void
282
- getAuthBaseUrl(): string
283
- resetAuthConfig(): void
284
- ```
285
-
286
- `AuthConfigType` has 12 properties (session endpoint, providers map, default provider, auto-redirect, login redirect URL, callback URL, session check interval, retry config, stale time, refetch on focus, refetch on reconnect, base URL).
287
-
288
- **Source**: `sdk/auth/authConfig.ts`, `sdk/auth.ts` lines 16-22
289
-
290
- ### 19. `QueryClientProvider` requirement not documented
291
-
292
- `AuthProvider` calls `useQueryClient()` from `@tanstack/react-query`. A `QueryClientProvider` must wrap `AuthProvider`, or users get a runtime error on mount. No setup/bootstrap example exists.
293
-
294
- **Source**: `sdk/auth/AuthProvider.tsx` lines 15-16, 64
295
-
296
- ---
297
-
298
- ## docs/workflow.md
299
-
300
- ### 20. `BPInstanceId` missing from `ActivityInstanceFieldsType`
301
-
302
- Doc shows 4 fields. Source has 5:
303
-
304
- ```typescript
305
- type ActivityInstanceFieldsType = {
306
- _id: StringFieldType;
307
- BPInstanceId: StringFieldType; // <-- MISSING from doc
308
- Status: SelectFieldType<"InProgress" | "Completed">;
309
- AssignedTo: UserFieldType[];
310
- CompletedAt: DateTimeFieldType;
311
- };
312
- ```
313
-
314
- Also missing from the "ActivityInstance System Fields Reference" table at the bottom of the doc.
315
-
316
- **Source**: `sdk/workflow/types.ts` lines 49-55
317
-
318
- ### ~~21. List/metric endpoints use GET, not POST — options are ignored~~
319
-
320
- **RESOLVED**: All four list/metric endpoints now use POST with proper request bodies. Count methods construct `{ Type: "Metric", Metric: [{Field: "_id", Type: "Count"}] }` and transform the response correctly.
321
-
322
- ### 23. `activity.Field.meta.label` and `activity.Field.meta.id` don't exist
323
-
324
- All form examples use `activity.StartDate.meta.label` and `activity.StartDate.meta.id`. These return `undefined` because `BaseFieldMetaType` has `_id` and `Name`, not `id` and `label`:
325
-
326
- ```typescript
327
- // BaseFieldMetaType has:
328
- _id: string; // NOT "id"
329
- Name: string; // NOT "label"
330
-
331
- // The convenience getters are on BaseField itself:
332
- activity.StartDate.id // works (BaseField getter)
333
- activity.StartDate.label // works (BaseField getter)
334
- activity.StartDate.meta._id // works (raw meta)
335
- activity.StartDate.meta.Name // works (raw meta)
336
-
337
- // But the doc uses:
338
- activity.StartDate.meta.id // undefined
339
- activity.StartDate.meta.label // undefined
340
- ```
341
-
342
- This affects **every** `register()` call and `<label>` in the doc's examples — they all pass `undefined`.
343
-
344
- **Source**: `sdk/bdo/fields/BaseField.ts` lines 24-27, `sdk/bdo/core/types.ts` lines 35-43
345
-
346
- ---
347
-
348
- ## Summary
349
-
350
- | Doc | Critical Count |
351
- |-----|---------------|
352
- | api.md | 2 |
353
- | bdo.md | 3 |
354
- | useBDOForm.md | 4 |
355
- | useBDOTable.md | 1 |
356
- | useActivityTable.md | 0 (resolved) |
357
- | useFilter.md | 2 |
358
- | useAuth.md | 5 |
359
- | workflow.md | 2 |
360
- | **Total** | **19** |