@ram_28/kf-ai-sdk 2.0.15 → 2.0.17
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 +22 -14
- package/dist/api.cjs +1 -1
- package/dist/api.mjs +1 -1
- package/dist/auth/authConfig.d.ts +1 -1
- package/dist/auth/types.d.ts +1 -1
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth.cjs +1 -1
- package/dist/auth.mjs +1 -1
- package/dist/bdo/core/BaseBdo.d.ts +1 -1
- package/dist/bdo.cjs +1 -1
- package/dist/bdo.mjs +3 -3
- package/dist/components/hooks/useActivityForm/createActivityItemProxy.d.ts +1 -1
- package/dist/components/hooks/useActivityForm/createActivityItemProxy.d.ts.map +1 -1
- package/dist/components/hooks/useActivityForm/types.d.ts +6 -7
- package/dist/components/hooks/useActivityForm/types.d.ts.map +1 -1
- package/dist/components/hooks/useActivityForm/useActivityForm.d.ts.map +1 -1
- package/dist/components/hooks/useActivityTable/types.d.ts +7 -6
- package/dist/components/hooks/useActivityTable/types.d.ts.map +1 -1
- package/dist/components/hooks/useActivityTable/useActivityTable.d.ts +1 -1
- package/dist/components/hooks/useActivityTable/useActivityTable.d.ts.map +1 -1
- package/dist/components/hooks/useBDOForm/createItemProxy.d.ts.map +1 -0
- package/dist/components/hooks/useBDOForm/createResolver.d.ts.map +1 -0
- package/dist/components/hooks/useBDOForm/index.d.ts +6 -0
- package/dist/components/hooks/useBDOForm/index.d.ts.map +1 -0
- package/dist/components/hooks/useBDOForm/shared.d.ts +50 -0
- package/dist/components/hooks/useBDOForm/shared.d.ts.map +1 -0
- package/dist/components/hooks/{useForm → useBDOForm}/types.d.ts +6 -6
- package/dist/components/hooks/useBDOForm/types.d.ts.map +1 -0
- package/dist/components/hooks/{useForm/useForm.d.ts → useBDOForm/useBDOForm.d.ts} +4 -4
- package/dist/components/hooks/useBDOForm/useBDOForm.d.ts.map +1 -0
- package/dist/components/hooks/useBDOTable/types.d.ts +20 -14
- package/dist/components/hooks/useBDOTable/types.d.ts.map +1 -1
- package/dist/components/hooks/useBDOTable/useBDOTable.d.ts +2 -2
- package/dist/components/hooks/useBDOTable/useBDOTable.d.ts.map +1 -1
- package/dist/{constants-ConHc1oS.js → constants-Cyi942Yr.js} +5 -5
- package/dist/constants-DEmYwKfC.cjs +1 -0
- package/dist/filter.cjs +1 -1
- package/dist/filter.mjs +1 -1
- package/dist/form.cjs +1 -1
- package/dist/form.d.ts +1 -1
- package/dist/form.d.ts.map +1 -1
- package/dist/form.mjs +250 -253
- package/dist/form.types.d.ts +1 -1
- package/dist/form.types.d.ts.map +1 -1
- package/dist/shared-5a7UkED1.js +1180 -0
- package/dist/shared-nnmlRVs7.cjs +1 -0
- package/dist/table.cjs +1 -1
- package/dist/table.mjs +14 -14
- package/dist/table.types.d.ts +1 -1
- package/dist/table.types.d.ts.map +1 -1
- package/dist/types/constants.d.ts +4 -4
- package/dist/workflow/Activity.d.ts +22 -7
- package/dist/workflow/Activity.d.ts.map +1 -1
- package/dist/workflow/client.d.ts +2 -2
- package/dist/workflow/client.d.ts.map +1 -1
- package/dist/workflow/types.d.ts +7 -3
- package/dist/workflow/types.d.ts.map +1 -1
- package/dist/workflow.cjs +1 -1
- package/dist/workflow.mjs +518 -576
- package/docs/README.md +51 -0
- package/docs/bdo/README.md +161 -0
- package/docs/bdo/api_reference.md +281 -0
- package/docs/examples/bdo/create-product.md +69 -0
- package/docs/examples/bdo/edit-product-dialog.md +95 -0
- package/docs/examples/bdo/filtered-product-table.md +100 -0
- package/docs/examples/bdo/product-listing.md +73 -0
- package/docs/examples/bdo/supplier-dropdown.md +60 -0
- package/docs/examples/workflow/approve-leave-request.md +76 -0
- package/docs/examples/workflow/filtered-activity-table.md +101 -0
- package/docs/examples/workflow/my-pending-requests.md +90 -0
- package/docs/examples/workflow/start-new-workflow.md +47 -0
- package/docs/examples/workflow/submit-leave-request.md +72 -0
- package/docs/examples/workflow/workflow-progress.md +49 -0
- package/docs/useActivityForm/README.md +241 -0
- package/docs/useActivityForm/api_reference.md +279 -0
- package/docs/useActivityTable/README.md +263 -0
- package/docs/useActivityTable/api_reference.md +294 -0
- package/docs/useBDOForm/README.md +172 -0
- package/docs/useBDOForm/api_reference.md +244 -0
- package/docs/useBDOTable/README.md +242 -0
- package/docs/useBDOTable/api_reference.md +253 -0
- package/docs/useFilter/README.md +323 -0
- package/docs/useFilter/api_reference.md +228 -0
- package/docs/workflow/README.md +158 -0
- package/docs/workflow/api_reference.md +161 -0
- package/package.json +2 -2
- package/sdk/auth/authConfig.ts +1 -1
- package/sdk/auth/types.ts +1 -1
- package/sdk/bdo/core/BaseBdo.ts +2 -2
- package/sdk/components/hooks/useActivityForm/createActivityItemProxy.ts +1 -1
- package/sdk/components/hooks/useActivityForm/createActivityResolver.ts +1 -1
- package/sdk/components/hooks/useActivityForm/types.ts +8 -10
- package/sdk/components/hooks/useActivityForm/useActivityForm.ts +52 -265
- package/sdk/components/hooks/useActivityTable/types.ts +6 -5
- package/sdk/components/hooks/useActivityTable/useActivityTable.ts +14 -43
- package/sdk/components/hooks/{useForm → useBDOForm}/index.ts +4 -3
- package/sdk/components/hooks/useBDOForm/shared.ts +250 -0
- package/sdk/components/hooks/{useForm → useBDOForm}/types.ts +9 -9
- package/sdk/components/hooks/{useForm/useForm.ts → useBDOForm/useBDOForm.ts} +70 -96
- package/sdk/components/hooks/useBDOTable/types.ts +20 -12
- package/sdk/components/hooks/useBDOTable/useBDOTable.ts +12 -7
- package/sdk/form.ts +2 -2
- package/sdk/form.types.ts +4 -4
- package/sdk/table.types.ts +2 -0
- package/sdk/types/constants.ts +4 -4
- package/sdk/workflow/Activity.ts +68 -13
- package/sdk/workflow/client.ts +65 -25
- package/sdk/workflow/types.ts +10 -2
- package/dist/components/hooks/useForm/createItemProxy.d.ts.map +0 -1
- package/dist/components/hooks/useForm/createResolver.d.ts.map +0 -1
- package/dist/components/hooks/useForm/index.d.ts +0 -5
- package/dist/components/hooks/useForm/index.d.ts.map +0 -1
- package/dist/components/hooks/useForm/types.d.ts.map +0 -1
- package/dist/components/hooks/useForm/useForm.d.ts.map +0 -1
- package/dist/constants-QX2RX-wu.cjs +0 -1
- package/dist/createResolver-AIgUwoS6.cjs +0 -1
- package/dist/createResolver-ZHXQ7QMa.js +0 -1078
- package/docs/api.md +0 -95
- package/docs/bdo.md +0 -224
- package/docs/gaps.md +0 -410
- package/docs/useActivityTable.md +0 -481
- package/docs/useBDOTable.md +0 -317
- package/docs/useFilter.md +0 -188
- package/docs/useForm.md +0 -376
- package/docs/workflow.md +0 -818
- /package/dist/components/hooks/{useForm → useBDOForm}/createItemProxy.d.ts +0 -0
- /package/dist/components/hooks/{useForm → useBDOForm}/createResolver.d.ts +0 -0
- /package/docs/{useAuth.md → useAuth/README.md} +0 -0
- /package/sdk/components/hooks/{useForm → useBDOForm}/createItemProxy.ts +0 -0
- /package/sdk/components/hooks/{useForm → useBDOForm}/createResolver.ts +0 -0
package/docs/api.md
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# API Types Reference
|
|
2
|
-
|
|
3
|
-
Request and response types for BDO methods. For usage patterns, see [bdo.md](bdo.md).
|
|
4
|
-
|
|
5
|
-
## Imports
|
|
6
|
-
|
|
7
|
-
```typescript
|
|
8
|
-
import { api } from "@ram_28/kf-ai-sdk/api";
|
|
9
|
-
import type { ListOptionsType, CreateUpdateResponseType, DeleteResponseType, DraftResponseType, MetricOptionsType, MetricResponseType, PivotOptionsType, PivotResponseType } from "@ram_28/kf-ai-sdk/api/types";
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## Common Mistakes (READ FIRST)
|
|
15
|
-
|
|
16
|
-
### 1. Calling `api` directly instead of as factory
|
|
17
|
-
|
|
18
|
-
```typescript
|
|
19
|
-
// ❌ WRONG — api is a function, not a client
|
|
20
|
-
api.get(id); api.delete(id);
|
|
21
|
-
|
|
22
|
-
// ✅ CORRECT — call api(boId) first
|
|
23
|
-
api(bdo.meta._id).get(id);
|
|
24
|
-
api(bdo.meta._id).delete(id);
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### 2. Using `api()` when BDO methods are available
|
|
28
|
-
|
|
29
|
-
Prefer BDO methods when they're `public` on the role's class. Use `api()` only for `protected` methods.
|
|
30
|
-
|
|
31
|
-
```typescript
|
|
32
|
-
// ✅ PREFERRED — BDO method
|
|
33
|
-
const items = await bdo.list();
|
|
34
|
-
|
|
35
|
-
// ✅ USE api() ONLY when BDO method is protected
|
|
36
|
-
await api(bdo.meta._id).delete(id);
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### 3. Wrong metric response key format
|
|
40
|
-
|
|
41
|
-
Key pattern is `{lowercase_type}_{Field}` with single underscore.
|
|
42
|
-
|
|
43
|
-
```typescript
|
|
44
|
-
// ❌ WRONG
|
|
45
|
-
const count = result.Data[0].count;
|
|
46
|
-
|
|
47
|
-
// ✅ CORRECT
|
|
48
|
-
const count = result.Data?.[0]?.["count__id"] ?? 0; // Count of _id
|
|
49
|
-
const total = result.Data?.[0]?.["sum_unit_price"] ?? 0; // Sum of unit_price
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
---
|
|
53
|
-
|
|
54
|
-
## Response Types
|
|
55
|
-
|
|
56
|
-
```typescript
|
|
57
|
-
interface CreateUpdateResponseType { _id: string; }
|
|
58
|
-
interface DeleteResponseType { status: "success"; }
|
|
59
|
-
interface DraftResponseType { [fieldName: string]: any; }
|
|
60
|
-
|
|
61
|
-
interface ListOptionsType {
|
|
62
|
-
Field?: string[];
|
|
63
|
-
Filter?: FilterType;
|
|
64
|
-
Sort?: Record<string, "ASC" | "DESC">[];
|
|
65
|
-
Page?: number; // 1-indexed
|
|
66
|
-
PageSize?: number; // Default: 10
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
interface MetricOptionsType {
|
|
70
|
-
GroupBy: string[];
|
|
71
|
-
Metric: { Field: string; Type: AggregationType; }[];
|
|
72
|
-
Filter?: FilterType;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
interface MetricResponseType { Data: Record<string, any>[]; }
|
|
76
|
-
|
|
77
|
-
interface PivotOptionsType {
|
|
78
|
-
Row: string[];
|
|
79
|
-
Column: string[];
|
|
80
|
-
Metric: { Field: string; Type: AggregationType; }[];
|
|
81
|
-
Filter?: FilterType;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
interface PivotResponseType {
|
|
85
|
-
Data: { RowHeader: { Key: string }[]; ColumnHeader: { Key: string }[]; Value: (number | string | null)[][]; };
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
type AggregationType = "Sum" | "Avg" | "Count" | "Max" | "Min" | "DistinctCount" | "BlankCount" | "NotBlankCount" | "Concat" | "DistinctConcat";
|
|
89
|
-
|
|
90
|
-
// Filter type (for bdo.list() Filter parameter)
|
|
91
|
-
interface FilterType { Operator: "And" | "Or" | "Not"; Condition: Array<ConditionType | ConditionGroupType>; }
|
|
92
|
-
interface ConditionType { Operator: string; LHSField: string; RHSValue: any; RHSType?: "Constant" | "BDOField" | "AppVariable"; }
|
|
93
|
-
|
|
94
|
-
type SortType = Record<string, "ASC" | "DESC">[];
|
|
95
|
-
```
|
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/ui/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/ui/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 useForm 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
|
-
```
|