@ram_28/kf-ai-sdk 2.0.13 → 2.0.15
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 +2 -1
- package/dist/FileField-BWrSHNRq.js +296 -0
- package/dist/FileField-eDeuzln8.cjs +1 -0
- package/dist/api.cjs +1 -1
- package/dist/api.mjs +2 -2
- package/dist/auth.cjs +1 -1
- package/dist/auth.mjs +1 -1
- package/dist/bdo.cjs +1 -1
- package/dist/bdo.mjs +228 -472
- package/dist/{client-DnO2KKrw.cjs → client-D5k4SYuw.cjs} +1 -1
- package/dist/{client-iQTqFDNI.js → client-_ayziI1d.js} +33 -32
- package/dist/components/hooks/index.d.ts +9 -3
- package/dist/components/hooks/index.d.ts.map +1 -1
- package/dist/{workflow/components → components/hooks}/useActivityForm/createActivityItemProxy.d.ts +9 -5
- package/dist/components/hooks/useActivityForm/createActivityItemProxy.d.ts.map +1 -0
- package/dist/components/hooks/useActivityForm/createActivityResolver.d.ts +23 -0
- package/dist/components/hooks/useActivityForm/createActivityResolver.d.ts.map +1 -0
- package/dist/components/hooks/useActivityForm/index.d.ts.map +1 -0
- package/dist/{workflow/components → components/hooks}/useActivityForm/types.d.ts +11 -7
- package/dist/components/hooks/useActivityForm/types.d.ts.map +1 -0
- package/dist/{workflow/components → components/hooks}/useActivityForm/useActivityForm.d.ts +2 -2
- package/dist/components/hooks/useActivityForm/useActivityForm.d.ts.map +1 -0
- package/dist/components/hooks/useActivityTable/index.d.ts +4 -0
- package/dist/components/hooks/useActivityTable/index.d.ts.map +1 -0
- package/dist/components/hooks/useActivityTable/types.d.ts +36 -0
- package/dist/components/hooks/useActivityTable/types.d.ts.map +1 -0
- package/dist/components/hooks/useActivityTable/useActivityTable.d.ts +4 -0
- package/dist/components/hooks/useActivityTable/useActivityTable.d.ts.map +1 -0
- package/dist/components/hooks/useBDOTable/index.d.ts +3 -0
- package/dist/components/hooks/useBDOTable/index.d.ts.map +1 -0
- package/dist/components/hooks/useBDOTable/types.d.ts +26 -0
- package/dist/components/hooks/useBDOTable/types.d.ts.map +1 -0
- package/dist/components/hooks/useBDOTable/useBDOTable.d.ts +3 -0
- package/dist/components/hooks/useBDOTable/useBDOTable.d.ts.map +1 -0
- package/dist/components/hooks/useTable/index.d.ts +2 -2
- package/dist/components/hooks/useTable/index.d.ts.map +1 -1
- package/dist/components/hooks/useTable/types.d.ts +11 -10
- package/dist/components/hooks/useTable/types.d.ts.map +1 -1
- package/dist/components/hooks/useTable/useTable.d.ts +1 -1
- package/dist/components/hooks/useTable/useTable.d.ts.map +1 -1
- package/dist/createResolver-AIgUwoS6.cjs +1 -0
- package/dist/createResolver-ZHXQ7QMa.js +1078 -0
- package/dist/form.cjs +1 -1
- package/dist/form.mjs +252 -314
- package/dist/{metadata-DpfI3zRN.js → metadata-Cc1mBcLS.js} +1 -1
- package/dist/{metadata-DgLSJkF5.cjs → metadata-DWXQPDav.cjs} +1 -1
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +1 -0
- package/dist/table.d.ts.map +1 -1
- package/dist/table.mjs +16 -192
- package/dist/table.types.d.ts +2 -1
- package/dist/table.types.d.ts.map +1 -1
- package/dist/types/base-fields.d.ts +4 -4
- package/dist/types/base-fields.d.ts.map +1 -1
- package/dist/useTable-CeRklbdT.cjs +1 -0
- package/dist/useTable-DS0-WInw.js +203 -0
- package/dist/workflow/Activity.d.ts +9 -9
- package/dist/workflow/Activity.d.ts.map +1 -1
- package/dist/workflow/client.d.ts.map +1 -1
- package/dist/workflow/createFieldFromMeta.d.ts +29 -0
- package/dist/workflow/createFieldFromMeta.d.ts.map +1 -0
- package/dist/workflow/index.d.ts +1 -2
- package/dist/workflow/index.d.ts.map +1 -1
- package/dist/workflow/types.d.ts +12 -12
- package/dist/workflow/types.d.ts.map +1 -1
- package/dist/workflow.cjs +1 -1
- package/dist/workflow.d.ts +5 -2
- package/dist/workflow.d.ts.map +1 -1
- package/dist/workflow.mjs +716 -338
- package/dist/workflow.types.d.ts +1 -0
- package/dist/workflow.types.d.ts.map +1 -1
- package/docs/bdo.md +3 -3
- package/docs/gaps.md +410 -0
- package/docs/useActivityTable.md +481 -0
- package/docs/useBDOTable.md +317 -0
- package/docs/useForm.md +4 -1
- package/docs/workflow.md +143 -34
- package/package.json +1 -1
- package/sdk/bdo/fields/UserField.ts +1 -1
- package/sdk/components/hooks/index.ts +28 -5
- package/sdk/components/hooks/useActivityForm/createActivityItemProxy.ts +400 -0
- package/sdk/components/hooks/useActivityForm/createActivityResolver.ts +87 -0
- package/sdk/{workflow/components → components/hooks}/useActivityForm/types.ts +21 -8
- package/sdk/components/hooks/useActivityForm/useActivityForm.ts +628 -0
- package/sdk/components/hooks/useActivityTable/index.ts +8 -0
- package/sdk/components/hooks/useActivityTable/types.ts +45 -0
- package/sdk/components/hooks/useActivityTable/useActivityTable.ts +71 -0
- package/sdk/components/hooks/useBDOTable/index.ts +2 -0
- package/sdk/components/hooks/useBDOTable/types.ts +24 -0
- package/sdk/components/hooks/useBDOTable/useBDOTable.ts +15 -0
- package/sdk/components/hooks/useTable/index.ts +3 -3
- package/sdk/components/hooks/useTable/types.ts +16 -12
- package/sdk/components/hooks/useTable/useTable.ts +56 -49
- package/sdk/table.ts +4 -1
- package/sdk/table.types.ts +7 -4
- package/sdk/types/base-fields.ts +4 -4
- package/sdk/workflow/Activity.ts +14 -13
- package/sdk/workflow/client.ts +21 -8
- package/sdk/workflow/createFieldFromMeta.ts +110 -0
- package/sdk/workflow/index.ts +1 -6
- package/sdk/workflow/types.ts +13 -12
- package/sdk/workflow.ts +11 -2
- package/sdk/workflow.types.ts +7 -0
- package/dist/BaseField-B6da88U7.js +0 -40
- package/dist/BaseField-Drp0-OxL.cjs +0 -1
- package/dist/error-handling-CAoD0Kwb.cjs +0 -1
- package/dist/error-handling-CrhTtD88.js +0 -14
- package/dist/index.esm-Cj63v5ny.js +0 -1014
- package/dist/index.esm-DuwT11sx.cjs +0 -1
- package/dist/workflow/components/useActivityForm/createActivityItemProxy.d.ts.map +0 -1
- package/dist/workflow/components/useActivityForm/createActivityResolver.d.ts +0 -22
- package/dist/workflow/components/useActivityForm/createActivityResolver.d.ts.map +0 -1
- package/dist/workflow/components/useActivityForm/index.d.ts.map +0 -1
- package/dist/workflow/components/useActivityForm/types.d.ts.map +0 -1
- package/dist/workflow/components/useActivityForm/useActivityForm.d.ts.map +0 -1
- package/docs/useTable.md +0 -369
- package/sdk/workflow/components/useActivityForm/createActivityItemProxy.ts +0 -130
- package/sdk/workflow/components/useActivityForm/createActivityResolver.ts +0 -61
- package/sdk/workflow/components/useActivityForm/useActivityForm.ts +0 -386
- /package/dist/{workflow/components → components/hooks}/useActivityForm/index.d.ts +0 -0
- /package/sdk/{workflow/components → components/hooks}/useActivityForm/index.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o=require("./client-
|
|
1
|
+
"use strict";const o=require("./client-D5k4SYuw.cjs");async function c(e){try{const r=o.getApiBaseUrl(),s=o.getDefaultHeaders(),a=await fetch(`${r}/api/app/meta/bdo/${e}`,{method:"GET",headers:s});if(!a.ok)throw new Error(`Failed to fetch schema for ${e}: ${a.statusText}`);const t=await a.json();if(!t||typeof t!="object")throw new Error(`Invalid BDO schema response for ${e}`);return t}catch(r){throw console.error(`Schema fetch error for ${e}:`,r),new Error(`Failed to load BDO schema: ${r instanceof Error?r.message:"Unknown error"}`)}}async function n(e){try{const r=o.getApiBaseUrl(),s=o.getDefaultHeaders(),a=e!=null&&e.Filter||e!=null&&e.Sort?"POST":"GET",t=await fetch(`${r}/api/app/metadata/list`,{method:a,headers:s,...a==="POST"&&e&&{body:JSON.stringify(e)}});if(!t.ok)throw new Error(`Failed to list metadata: ${t.statusText}`);return await t.json()}catch(r){throw console.error("Metadata list error:",r),new Error(`Failed to list metadata: ${r instanceof Error?r.message:"Unknown error"}`)}}exports.getBdoSchema=c;exports.listMetadata=n;
|
package/dist/table.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./useTable-CeRklbdT.cjs"),e=require("./constants-QX2RX-wu.cjs");function a(n){const{bdo:t,...u}=n;return r.useTable({queryKey:["table",t.meta._id],listFn:o=>t.list(o),countFn:o=>t.count(o),...u})}exports.useTable=r.useTable;exports.ConditionOperator=e.ConditionOperator;exports.GroupOperator=e.GroupOperator;exports.RHSType=e.RHSType;exports.SortDirection=e.SortDirection;exports.TableDefaults=e.Defaults;exports.useBDOTable=a;
|
package/dist/table.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { useTable } from './components/hooks/useTable/useTable';
|
|
2
|
+
export { useBDOTable } from './components/hooks/useBDOTable/useBDOTable';
|
|
2
3
|
export { SortDirection, ConditionOperator, GroupOperator, RHSType, Defaults as TableDefaults, } from './types/constants';
|
|
3
4
|
//# sourceMappingURL=table.d.ts.map
|
package/dist/table.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../sdk/table.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAGhE,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,OAAO,EACP,QAAQ,IAAI,aAAa,GAC1B,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../sdk/table.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAGhE,OAAO,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAGzE,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,OAAO,EACP,QAAQ,IAAI,aAAa,GAC1B,MAAM,mBAAmB,CAAC"}
|
package/dist/table.mjs
CHANGED
|
@@ -1,196 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
query: "",
|
|
11
|
-
debouncedQuery: "",
|
|
12
|
-
field: null
|
|
13
|
-
}), c = ne(null), U = 300, _ = () => {
|
|
14
|
-
var t, o;
|
|
15
|
-
const e = (t = r.initialState) == null ? void 0 : t.sort;
|
|
16
|
-
if (e && e.length > 0) {
|
|
17
|
-
const M = e[0], G = Object.keys(M)[0], b = (o = M[G]) == null ? void 0 : o.toUpperCase();
|
|
18
|
-
return { field: G, direction: b === "ASC" || b === "DESC" ? b : "ASC" };
|
|
19
|
-
}
|
|
20
|
-
return { field: null, direction: null };
|
|
21
|
-
}, [s, C] = E(_), [n, u] = E({
|
|
22
|
-
pageNo: ((P = (R = r.initialState) == null ? void 0 : R.pagination) == null ? void 0 : P.pageNo) || 1,
|
|
23
|
-
pageSize: ((w = (q = r.initialState) == null ? void 0 : q.pagination) == null ? void 0 : w.pageSize) || 10
|
|
24
|
-
}), d = ae({
|
|
25
|
-
conditions: (x = (Q = r.initialState) == null ? void 0 : Q.filter) == null ? void 0 : x.conditions,
|
|
26
|
-
operator: ((L = (H = r.initialState) == null ? void 0 : H.filter) == null ? void 0 : L.operator) || "And"
|
|
1
|
+
import { u as a } from "./useTable-DS0-WInw.js";
|
|
2
|
+
import { C as l, G as p, R as b, S as c, D as f } from "./constants-ConHc1oS.js";
|
|
3
|
+
function n(o) {
|
|
4
|
+
const { bdo: t, ...r } = o;
|
|
5
|
+
return a({
|
|
6
|
+
queryKey: ["table", t.meta._id],
|
|
7
|
+
listFn: (e) => t.list(e),
|
|
8
|
+
countFn: (e) => t.count(e),
|
|
9
|
+
...r
|
|
27
10
|
});
|
|
28
|
-
k(() => {
|
|
29
|
-
u((e) => ({ ...e, pageNo: 1 }));
|
|
30
|
-
}, [d.payload]);
|
|
31
|
-
const g = l(() => {
|
|
32
|
-
const e = {};
|
|
33
|
-
let t = d.payload;
|
|
34
|
-
if (a.debouncedQuery && a.field) {
|
|
35
|
-
const o = {
|
|
36
|
-
LHSField: a.field,
|
|
37
|
-
Operator: "Contains",
|
|
38
|
-
RHSValue: a.debouncedQuery,
|
|
39
|
-
RHSType: "Constant"
|
|
40
|
-
};
|
|
41
|
-
t ? t.Operator === "And" ? t = {
|
|
42
|
-
...t,
|
|
43
|
-
Condition: [...t.Condition || [], o]
|
|
44
|
-
} : t = {
|
|
45
|
-
Operator: "And",
|
|
46
|
-
Condition: [t, o]
|
|
47
|
-
} : t = {
|
|
48
|
-
Operator: "And",
|
|
49
|
-
Condition: [o]
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
return t && (e.Filter = t), e;
|
|
53
|
-
}, [a.debouncedQuery, a.field, d.payload]), A = l(() => {
|
|
54
|
-
const e = { ...g };
|
|
55
|
-
return s.field && s.direction && (e.Sort = [
|
|
56
|
-
{
|
|
57
|
-
[String(s.field)]: s.direction
|
|
58
|
-
}
|
|
59
|
-
]), e.Page = n.pageNo, e.PageSize = n.pageSize, e;
|
|
60
|
-
}, [g, s, n]), {
|
|
61
|
-
data: f,
|
|
62
|
-
isLoading: j,
|
|
63
|
-
isFetching: B,
|
|
64
|
-
error: F,
|
|
65
|
-
refetch: z
|
|
66
|
-
} = I({
|
|
67
|
-
queryKey: ["table", r.source, A],
|
|
68
|
-
queryFn: async () => {
|
|
69
|
-
try {
|
|
70
|
-
const e = await K(r.source).list(A);
|
|
71
|
-
return r.onSuccess && r.onSuccess(e.Data), e;
|
|
72
|
-
} catch (e) {
|
|
73
|
-
throw r.onError && r.onError(h(e)), e;
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
staleTime: 0,
|
|
77
|
-
gcTime: 30 * 1e3
|
|
78
|
-
}), {
|
|
79
|
-
data: S,
|
|
80
|
-
isLoading: V,
|
|
81
|
-
isFetching: J,
|
|
82
|
-
error: D,
|
|
83
|
-
refetch: O
|
|
84
|
-
} = I({
|
|
85
|
-
queryKey: ["table-count", r.source, g],
|
|
86
|
-
queryFn: async () => {
|
|
87
|
-
try {
|
|
88
|
-
return await K(r.source).count(g);
|
|
89
|
-
} catch (e) {
|
|
90
|
-
throw r.onError && r.onError(h(e)), e;
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
staleTime: 0,
|
|
94
|
-
gcTime: 30 * 1e3
|
|
95
|
-
}), W = l(() => (f == null ? void 0 : f.Data) || [], [f]), p = l(() => (S == null ? void 0 : S.Count) || 0, [S]), y = l(() => Math.ceil(p / n.pageSize), [p, n.pageSize]), X = i((e) => {
|
|
96
|
-
C((t) => {
|
|
97
|
-
if (t.field === e) {
|
|
98
|
-
if (t.direction === "ASC")
|
|
99
|
-
return { field: e, direction: "DESC" };
|
|
100
|
-
if (t.direction === "DESC")
|
|
101
|
-
return { field: null, direction: null };
|
|
102
|
-
}
|
|
103
|
-
return { field: e, direction: "ASC" };
|
|
104
|
-
});
|
|
105
|
-
}, []), Y = i(() => {
|
|
106
|
-
C({ field: null, direction: null });
|
|
107
|
-
}, []), Z = i(
|
|
108
|
-
(e, t) => {
|
|
109
|
-
C({ field: e, direction: t });
|
|
110
|
-
},
|
|
111
|
-
[]
|
|
112
|
-
), $ = i((e, t) => {
|
|
113
|
-
if (t.length > 255) {
|
|
114
|
-
console.warn("Search query exceeds maximum length of 255 characters");
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
m((o) => ({ ...o, query: t, field: e })), c.current && clearTimeout(c.current), c.current = setTimeout(() => {
|
|
118
|
-
m((o) => ({ ...o, debouncedQuery: t })), u((o) => ({ ...o, pageNo: 1 }));
|
|
119
|
-
}, U);
|
|
120
|
-
}, []), v = i(() => {
|
|
121
|
-
c.current && clearTimeout(c.current), m({ query: "", debouncedQuery: "", field: null }), u((e) => ({ ...e, pageNo: 1 }));
|
|
122
|
-
}, []);
|
|
123
|
-
k(() => () => {
|
|
124
|
-
c.current && clearTimeout(c.current);
|
|
125
|
-
}, []);
|
|
126
|
-
const N = n.pageNo < y, T = n.pageNo > 1, ee = i(() => {
|
|
127
|
-
N && u((e) => ({ ...e, pageNo: e.pageNo + 1 }));
|
|
128
|
-
}, [N]), te = i(() => {
|
|
129
|
-
T && u((e) => ({ ...e, pageNo: e.pageNo - 1 }));
|
|
130
|
-
}, [T]), re = i(
|
|
131
|
-
(e) => {
|
|
132
|
-
const t = Math.max(1, Math.min(e, y));
|
|
133
|
-
u((o) => ({ ...o, pageNo: t }));
|
|
134
|
-
},
|
|
135
|
-
[y]
|
|
136
|
-
), oe = i((e) => {
|
|
137
|
-
u((t) => ({
|
|
138
|
-
...t,
|
|
139
|
-
pageSize: e,
|
|
140
|
-
pageNo: 1
|
|
141
|
-
}));
|
|
142
|
-
}, []), ie = i(async () => {
|
|
143
|
-
const [e] = await Promise.all([z(), O()]);
|
|
144
|
-
return e.data || { Data: [] };
|
|
145
|
-
}, [z, O]);
|
|
146
|
-
return {
|
|
147
|
-
// Data
|
|
148
|
-
rows: W,
|
|
149
|
-
totalItems: p,
|
|
150
|
-
// Loading States
|
|
151
|
-
isLoading: j || V,
|
|
152
|
-
isFetching: B || J,
|
|
153
|
-
// Error Handling
|
|
154
|
-
error: F ? h(F) : D ? h(D) : null,
|
|
155
|
-
// Search (Flat Access)
|
|
156
|
-
search: {
|
|
157
|
-
query: a.query,
|
|
158
|
-
field: a.field,
|
|
159
|
-
set: $,
|
|
160
|
-
clear: v
|
|
161
|
-
},
|
|
162
|
-
// Sorting (Flat Access)
|
|
163
|
-
sort: {
|
|
164
|
-
field: s.field,
|
|
165
|
-
direction: s.direction,
|
|
166
|
-
toggle: X,
|
|
167
|
-
clear: Y,
|
|
168
|
-
set: Z
|
|
169
|
-
},
|
|
170
|
-
// Filter (Simplified chainable API)
|
|
171
|
-
filter: d,
|
|
172
|
-
// Pagination (Flat Access)
|
|
173
|
-
pagination: {
|
|
174
|
-
pageNo: n.pageNo,
|
|
175
|
-
pageSize: n.pageSize,
|
|
176
|
-
totalPages: y,
|
|
177
|
-
totalItems: p,
|
|
178
|
-
canGoNext: N,
|
|
179
|
-
canGoPrevious: T,
|
|
180
|
-
goToNext: ee,
|
|
181
|
-
goToPrevious: te,
|
|
182
|
-
goToPage: re,
|
|
183
|
-
setPageSize: oe
|
|
184
|
-
},
|
|
185
|
-
// Operations
|
|
186
|
-
refetch: ie
|
|
187
|
-
};
|
|
188
11
|
}
|
|
189
12
|
export {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
13
|
+
l as ConditionOperator,
|
|
14
|
+
p as GroupOperator,
|
|
15
|
+
b as RHSType,
|
|
16
|
+
c as SortDirection,
|
|
17
|
+
f as TableDefaults,
|
|
18
|
+
n as useBDOTable,
|
|
19
|
+
a as useTable
|
|
196
20
|
};
|
package/dist/table.types.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export type { UseTableOptionsType, UseTableReturnType,
|
|
1
|
+
export type { UseTableOptionsType, UseTableReturnType, PaginationStateType, } from './components/hooks/useTable/types';
|
|
2
|
+
export type { UseBDOTableOptionsType, UseBDOTableReturnType, } from './components/hooks/useBDOTable/types';
|
|
2
3
|
//# sourceMappingURL=table.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.types.d.ts","sourceRoot":"","sources":["../sdk/table.types.ts"],"names":[],"mappings":"AAKA,YAAY,EAEV,mBAAmB,EACnB,kBAAkB,EAGlB,
|
|
1
|
+
{"version":3,"file":"table.types.d.ts","sourceRoot":"","sources":["../sdk/table.types.ts"],"names":[],"mappings":"AAKA,YAAY,EAEV,mBAAmB,EACnB,kBAAkB,EAGlB,mBAAmB,GACpB,MAAM,mCAAmC,CAAC;AAE3C,YAAY,EAEV,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,sCAAsC,CAAC"}
|
|
@@ -75,14 +75,14 @@ type Minute = number;
|
|
|
75
75
|
type Second = number;
|
|
76
76
|
/**
|
|
77
77
|
* DateTime field (date and time)
|
|
78
|
-
* API Request Format: "YYYY-MM-
|
|
78
|
+
* API Request Format: "YYYY-MM-DDTHH:MM:SSZ"
|
|
79
|
+
* API Response Format: "YYYY-MM-DDTHH:MM:SSZ" (always UTC)
|
|
79
80
|
* Use this for created_at, updated_at, event timestamps
|
|
80
81
|
*
|
|
81
82
|
* @example
|
|
82
|
-
*
|
|
83
|
-
* "2026-01-23T01:21:33"
|
|
83
|
+
* "2026-01-23T01:21:33Z"
|
|
84
84
|
*/
|
|
85
|
-
export type DateTimeFieldType = `${Year}-${Month}-${Day}T${Hour}:${Minute}:${Second}`;
|
|
85
|
+
export type DateTimeFieldType = `${Year}-${Month}-${Day}T${Hour}:${Minute}:${Second}Z`;
|
|
86
86
|
/**
|
|
87
87
|
* Reference/Lookup field for relationships to other Business Data Objects
|
|
88
88
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-fields.d.ts","sourceRoot":"","sources":["../../sdk/types/base-fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,eAAe,CACzB,CAAC,SAAS,MAAM,GAAG,MAAM,EACzB,UAAU,SAAS,MAAM,GAAG,KAAK,EACjC,UAAU,SAAS,MAAM,GAAG,KAAK,IAC/B,CAAC,CAAC;AAEN;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAE9C;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,CAAC,UAAU,SAAS,MAAM,GAAG,KAAK,IAAI,MAAM,CAAC;AAExE;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC;AAEvC;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,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;;;;;;;;;GASG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC;AAMjD;;;GAGG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAC5B,CAAC,SAAS,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAM/C;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,aAAa,CAAC;AAExC;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,eAAe,CAAC;IACrB,WAAW,EAAE,iBAAiB,CAAC;IAC/B,YAAY,EAAE,iBAAiB,CAAC;IAChC,WAAW,EAAE,aAAa,CAAC;IAC3B,YAAY,EAAE,aAAa,CAAC;IAC5B,QAAQ,EAAE,eAAe,CAAC;IAC1B,UAAU,EAAE,eAAe,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=require("react"),L=require("@tanstack/react-query"),te=require("./useFilter-Bg0jvIL6.cjs");function l(t){if(t instanceof Error)return t;if(typeof t=="string")return new Error(t);if(t!==null&&typeof t=="object"&&"message"in t&&typeof t.message=="string"){const i=new Error(t.message);return Object.assign(i,t),i}return new Error(String(t))}function re(t){var w,A,z,Q,M,O,P,R;const[i,C]=n.useState({query:"",debouncedQuery:"",field:null}),c=n.useRef(null),H=300,K=()=>{var r,o;const e=(r=t.initialState)==null?void 0:r.sort;if(e&&e.length>0){const D=e[0],x=Object.keys(D)[0],E=(o=D[x])==null?void 0:o.toUpperCase();return{field:x,direction:E==="ASC"||E==="DESC"?E:"ASC"}}return{field:null,direction:null}},[s,h]=n.useState(K),[a,u]=n.useState({pageNo:((A=(w=t.initialState)==null?void 0:w.pagination)==null?void 0:A.pageNo)||1,pageSize:((Q=(z=t.initialState)==null?void 0:z.pagination)==null?void 0:Q.pageSize)||10}),g=te.useFilter({conditions:(O=(M=t.initialState)==null?void 0:M.filter)==null?void 0:O.conditions,operator:((R=(P=t.initialState)==null?void 0:P.filter)==null?void 0:R.operator)||"And"});n.useEffect(()=>{u(e=>({...e,pageNo:1}))},[g.payload]);const d=n.useMemo(()=>{const e={};let r=g.payload;if(i.debouncedQuery&&i.field){const o={LHSField:i.field,Operator:"Contains",RHSValue:i.debouncedQuery,RHSType:"Constant"};r?r.Operator==="And"?r={...r,Condition:[...r.Condition||[],o]}:r={Operator:"And",Condition:[r,o]}:r={Operator:"And",Condition:[o]}}return r&&(e.Filter=r),e},[i.debouncedQuery,i.field,g.payload]),N=n.useMemo(()=>{const e={...d};return s.field&&s.direction&&(e.Sort=[{[String(s.field)]:s.direction}]),e.Page=a.pageNo,e.PageSize=a.pageSize,e},[d,s,a]),{data:f,isLoading:j,isFetching:G,error:F,refetch:T}=L.useQuery({queryKey:[...t.queryKey,N],queryFn:async()=>{try{const e=await t.listFn(N);return t.onSuccess&&t.onSuccess(e.Data),e}catch(e){throw t.onError&&t.onError(l(e)),e}},staleTime:0,gcTime:30*1e3}),{data:S,isLoading:I,isFetching:U,error:q,refetch:k}=L.useQuery({queryKey:[...t.queryKey,"count",d],queryFn:async()=>{try{return await t.countFn(d)}catch(e){throw t.onError&&t.onError(l(e)),e}},staleTime:0,gcTime:30*1e3}),_=n.useMemo(()=>(f==null?void 0:f.Data)||[],[f]),y=n.useMemo(()=>(S==null?void 0:S.Count)||0,[S]),p=n.useMemo(()=>Math.ceil(y/a.pageSize),[y,a.pageSize]),B=n.useCallback(e=>{h(r=>{if(r.field===e){if(r.direction==="ASC")return{field:e,direction:"DESC"};if(r.direction==="DESC")return{field:null,direction:null}}return{field:e,direction:"ASC"}})},[]),V=n.useCallback(()=>{h({field:null,direction:null})},[]),J=n.useCallback((e,r)=>{h({field:e,direction:r})},[]),W=n.useCallback((e,r)=>{if(r.length>255){console.warn("Search query exceeds maximum length of 255 characters");return}C(o=>({...o,query:r,field:e})),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{C(o=>({...o,debouncedQuery:r})),u(o=>({...o,pageNo:1}))},H)},[]),X=n.useCallback(()=>{c.current&&clearTimeout(c.current),C({query:"",debouncedQuery:"",field:null}),u(e=>({...e,pageNo:1}))},[]);n.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const m=a.pageNo<p,b=a.pageNo>1,Y=n.useCallback(()=>{m&&u(e=>({...e,pageNo:e.pageNo+1}))},[m]),Z=n.useCallback(()=>{b&&u(e=>({...e,pageNo:e.pageNo-1}))},[b]),$=n.useCallback(e=>{const r=Math.max(1,Math.min(e,p));u(o=>({...o,pageNo:r}))},[p]),v=n.useCallback(e=>{u(r=>({...r,pageSize:e,pageNo:1}))},[]),ee=n.useCallback(async()=>{const[e]=await Promise.all([T(),k()]);return e.data||{Data:[]}},[T,k]);return{rows:_,totalItems:y,isLoading:j||I,isFetching:G||U,error:F?l(F):q?l(q):null,search:{query:i.query,field:i.field,set:W,clear:X},sort:{field:s.field,direction:s.direction,toggle:B,clear:V,set:J},filter:g,pagination:{pageNo:a.pageNo,pageSize:a.pageSize,totalPages:p,totalItems:y,canGoNext:m,canGoPrevious:b,goToNext:Y,goToPrevious:Z,goToPage:$,setPageSize:v},refetch:ee}}exports.toError=l;exports.useTable=re;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { useState as F, useRef as oe, useEffect as j, useMemo as l, useCallback as i } from "react";
|
|
2
|
+
import { useQuery as k } from "@tanstack/react-query";
|
|
3
|
+
import { u as ie } from "./useFilter-DPNLKY3H.js";
|
|
4
|
+
function h(t) {
|
|
5
|
+
if (t instanceof Error)
|
|
6
|
+
return t;
|
|
7
|
+
if (typeof t == "string")
|
|
8
|
+
return new Error(t);
|
|
9
|
+
if (t !== null && typeof t == "object" && "message" in t && typeof t.message == "string") {
|
|
10
|
+
const o = new Error(t.message);
|
|
11
|
+
return Object.assign(o, t), o;
|
|
12
|
+
}
|
|
13
|
+
return new Error(String(t));
|
|
14
|
+
}
|
|
15
|
+
function le(t) {
|
|
16
|
+
var O, P, Q, R, D, x, L, M;
|
|
17
|
+
const [o, m] = F({
|
|
18
|
+
query: "",
|
|
19
|
+
debouncedQuery: "",
|
|
20
|
+
field: null
|
|
21
|
+
}), c = oe(null), G = 300, I = () => {
|
|
22
|
+
var n, r;
|
|
23
|
+
const e = (n = t.initialState) == null ? void 0 : n.sort;
|
|
24
|
+
if (e && e.length > 0) {
|
|
25
|
+
const H = e[0], K = Object.keys(H)[0], b = (r = H[K]) == null ? void 0 : r.toUpperCase();
|
|
26
|
+
return { field: K, direction: b === "ASC" || b === "DESC" ? b : "ASC" };
|
|
27
|
+
}
|
|
28
|
+
return { field: null, direction: null };
|
|
29
|
+
}, [s, C] = F(I), [a, u] = F({
|
|
30
|
+
pageNo: ((P = (O = t.initialState) == null ? void 0 : O.pagination) == null ? void 0 : P.pageNo) || 1,
|
|
31
|
+
pageSize: ((R = (Q = t.initialState) == null ? void 0 : Q.pagination) == null ? void 0 : R.pageSize) || 10
|
|
32
|
+
}), g = ie({
|
|
33
|
+
conditions: (x = (D = t.initialState) == null ? void 0 : D.filter) == null ? void 0 : x.conditions,
|
|
34
|
+
operator: ((M = (L = t.initialState) == null ? void 0 : L.filter) == null ? void 0 : M.operator) || "And"
|
|
35
|
+
});
|
|
36
|
+
j(() => {
|
|
37
|
+
u((e) => ({ ...e, pageNo: 1 }));
|
|
38
|
+
}, [g.payload]);
|
|
39
|
+
const d = l(() => {
|
|
40
|
+
const e = {};
|
|
41
|
+
let n = g.payload;
|
|
42
|
+
if (o.debouncedQuery && o.field) {
|
|
43
|
+
const r = {
|
|
44
|
+
LHSField: o.field,
|
|
45
|
+
Operator: "Contains",
|
|
46
|
+
RHSValue: o.debouncedQuery,
|
|
47
|
+
RHSType: "Constant"
|
|
48
|
+
};
|
|
49
|
+
n ? n.Operator === "And" ? n = {
|
|
50
|
+
...n,
|
|
51
|
+
Condition: [...n.Condition || [], r]
|
|
52
|
+
} : n = {
|
|
53
|
+
Operator: "And",
|
|
54
|
+
Condition: [n, r]
|
|
55
|
+
} : n = {
|
|
56
|
+
Operator: "And",
|
|
57
|
+
Condition: [r]
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
return n && (e.Filter = n), e;
|
|
61
|
+
}, [o.debouncedQuery, o.field, g.payload]), T = l(() => {
|
|
62
|
+
const e = { ...d };
|
|
63
|
+
return s.field && s.direction && (e.Sort = [
|
|
64
|
+
{
|
|
65
|
+
[String(s.field)]: s.direction
|
|
66
|
+
}
|
|
67
|
+
]), e.Page = a.pageNo, e.PageSize = a.pageSize, e;
|
|
68
|
+
}, [d, s, a]), {
|
|
69
|
+
data: f,
|
|
70
|
+
isLoading: U,
|
|
71
|
+
isFetching: _,
|
|
72
|
+
error: w,
|
|
73
|
+
refetch: A
|
|
74
|
+
} = k({
|
|
75
|
+
queryKey: [...t.queryKey, T],
|
|
76
|
+
queryFn: async () => {
|
|
77
|
+
try {
|
|
78
|
+
const e = await t.listFn(T);
|
|
79
|
+
return t.onSuccess && t.onSuccess(e.Data), e;
|
|
80
|
+
} catch (e) {
|
|
81
|
+
throw t.onError && t.onError(h(e)), e;
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
staleTime: 0,
|
|
85
|
+
gcTime: 30 * 1e3
|
|
86
|
+
}), {
|
|
87
|
+
data: S,
|
|
88
|
+
isLoading: B,
|
|
89
|
+
isFetching: V,
|
|
90
|
+
error: q,
|
|
91
|
+
refetch: z
|
|
92
|
+
} = k({
|
|
93
|
+
queryKey: [...t.queryKey, "count", d],
|
|
94
|
+
queryFn: async () => {
|
|
95
|
+
try {
|
|
96
|
+
return await t.countFn(d);
|
|
97
|
+
} catch (e) {
|
|
98
|
+
throw t.onError && t.onError(h(e)), e;
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
staleTime: 0,
|
|
102
|
+
gcTime: 30 * 1e3
|
|
103
|
+
}), J = l(() => (f == null ? void 0 : f.Data) || [], [f]), p = l(() => (S == null ? void 0 : S.Count) || 0, [S]), y = l(() => Math.ceil(p / a.pageSize), [p, a.pageSize]), W = i((e) => {
|
|
104
|
+
C((n) => {
|
|
105
|
+
if (n.field === e) {
|
|
106
|
+
if (n.direction === "ASC")
|
|
107
|
+
return { field: e, direction: "DESC" };
|
|
108
|
+
if (n.direction === "DESC")
|
|
109
|
+
return { field: null, direction: null };
|
|
110
|
+
}
|
|
111
|
+
return { field: e, direction: "ASC" };
|
|
112
|
+
});
|
|
113
|
+
}, []), X = i(() => {
|
|
114
|
+
C({ field: null, direction: null });
|
|
115
|
+
}, []), Y = i(
|
|
116
|
+
(e, n) => {
|
|
117
|
+
C({ field: e, direction: n });
|
|
118
|
+
},
|
|
119
|
+
[]
|
|
120
|
+
), Z = i(
|
|
121
|
+
(e, n) => {
|
|
122
|
+
if (n.length > 255) {
|
|
123
|
+
console.warn("Search query exceeds maximum length of 255 characters");
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
m((r) => ({ ...r, query: n, field: e })), c.current && clearTimeout(c.current), c.current = setTimeout(() => {
|
|
127
|
+
m((r) => ({ ...r, debouncedQuery: n })), u((r) => ({ ...r, pageNo: 1 }));
|
|
128
|
+
}, G);
|
|
129
|
+
},
|
|
130
|
+
[]
|
|
131
|
+
), $ = i(() => {
|
|
132
|
+
c.current && clearTimeout(c.current), m({ query: "", debouncedQuery: "", field: null }), u((e) => ({ ...e, pageNo: 1 }));
|
|
133
|
+
}, []);
|
|
134
|
+
j(() => () => {
|
|
135
|
+
c.current && clearTimeout(c.current);
|
|
136
|
+
}, []);
|
|
137
|
+
const N = a.pageNo < y, E = a.pageNo > 1, v = i(() => {
|
|
138
|
+
N && u((e) => ({ ...e, pageNo: e.pageNo + 1 }));
|
|
139
|
+
}, [N]), ee = i(() => {
|
|
140
|
+
E && u((e) => ({ ...e, pageNo: e.pageNo - 1 }));
|
|
141
|
+
}, [E]), te = i(
|
|
142
|
+
(e) => {
|
|
143
|
+
const n = Math.max(1, Math.min(e, y));
|
|
144
|
+
u((r) => ({ ...r, pageNo: n }));
|
|
145
|
+
},
|
|
146
|
+
[y]
|
|
147
|
+
), ne = i((e) => {
|
|
148
|
+
u((n) => ({
|
|
149
|
+
...n,
|
|
150
|
+
pageSize: e,
|
|
151
|
+
pageNo: 1
|
|
152
|
+
}));
|
|
153
|
+
}, []), re = i(async () => {
|
|
154
|
+
const [e] = await Promise.all([A(), z()]);
|
|
155
|
+
return e.data || { Data: [] };
|
|
156
|
+
}, [A, z]);
|
|
157
|
+
return {
|
|
158
|
+
// Data
|
|
159
|
+
rows: J,
|
|
160
|
+
totalItems: p,
|
|
161
|
+
// Loading States
|
|
162
|
+
isLoading: U || B,
|
|
163
|
+
isFetching: _ || V,
|
|
164
|
+
// Error Handling
|
|
165
|
+
error: w ? h(w) : q ? h(q) : null,
|
|
166
|
+
// Search (Flat Access)
|
|
167
|
+
search: {
|
|
168
|
+
query: o.query,
|
|
169
|
+
field: o.field,
|
|
170
|
+
set: Z,
|
|
171
|
+
clear: $
|
|
172
|
+
},
|
|
173
|
+
// Sorting (Flat Access)
|
|
174
|
+
sort: {
|
|
175
|
+
field: s.field,
|
|
176
|
+
direction: s.direction,
|
|
177
|
+
toggle: W,
|
|
178
|
+
clear: X,
|
|
179
|
+
set: Y
|
|
180
|
+
},
|
|
181
|
+
// Filter (Simplified chainable API)
|
|
182
|
+
filter: g,
|
|
183
|
+
// Pagination (Flat Access)
|
|
184
|
+
pagination: {
|
|
185
|
+
pageNo: a.pageNo,
|
|
186
|
+
pageSize: a.pageSize,
|
|
187
|
+
totalPages: y,
|
|
188
|
+
totalItems: p,
|
|
189
|
+
canGoNext: N,
|
|
190
|
+
canGoPrevious: E,
|
|
191
|
+
goToNext: v,
|
|
192
|
+
goToPrevious: ee,
|
|
193
|
+
goToPage: te,
|
|
194
|
+
setPageSize: ne
|
|
195
|
+
},
|
|
196
|
+
// Operations
|
|
197
|
+
refetch: re
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
export {
|
|
201
|
+
h as t,
|
|
202
|
+
le as u
|
|
203
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ActivityInstanceType } from "./ActivityInstance";
|
|
2
2
|
import type { ActivityInstanceFieldsType, ActivityOperations } from "./types";
|
|
3
|
-
import type { ListResponseType,
|
|
3
|
+
import type { ListResponseType, ListOptionsType, CountResponseType } from "../types/common";
|
|
4
4
|
import { BaseField } from "../bdo/fields/BaseField";
|
|
5
5
|
/**
|
|
6
6
|
* Abstract base class for workflow activities.
|
|
@@ -59,22 +59,22 @@ export declare abstract class Activity<TEntity extends Record<string, unknown>,
|
|
|
59
59
|
private _discoverFields;
|
|
60
60
|
/**
|
|
61
61
|
* List in-progress activity instances.
|
|
62
|
-
*
|
|
62
|
+
* Accepts optional filter/sort/pagination options.
|
|
63
63
|
*/
|
|
64
|
-
getInProgressList(): Promise<ListResponseType<ActivityInstanceFieldsType & TEntity>>;
|
|
64
|
+
getInProgressList(options?: ListOptionsType): Promise<ListResponseType<ActivityInstanceFieldsType & TEntity>>;
|
|
65
65
|
/**
|
|
66
66
|
* List completed activity instances.
|
|
67
|
-
*
|
|
67
|
+
* Accepts optional filter/sort/pagination options.
|
|
68
68
|
*/
|
|
69
|
-
getCompletedList(): Promise<ListResponseType<ActivityInstanceFieldsType & TEntity>>;
|
|
69
|
+
getCompletedList(options?: ListOptionsType): Promise<ListResponseType<ActivityInstanceFieldsType & TEntity>>;
|
|
70
70
|
/**
|
|
71
|
-
* Get
|
|
71
|
+
* Get count of in-progress activity instances.
|
|
72
72
|
*/
|
|
73
|
-
inProgressMetrics(): Promise<
|
|
73
|
+
inProgressMetrics(options?: ListOptionsType): Promise<CountResponseType>;
|
|
74
74
|
/**
|
|
75
|
-
* Get
|
|
75
|
+
* Get count of completed activity instances.
|
|
76
76
|
*/
|
|
77
|
-
completedMetrics(): Promise<
|
|
77
|
+
completedMetrics(options?: ListOptionsType): Promise<CountResponseType>;
|
|
78
78
|
/**
|
|
79
79
|
* Get a typed ActivityInstance with field accessors and persistence methods.
|
|
80
80
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Activity.d.ts","sourceRoot":"","sources":["../../sdk/workflow/Activity.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,KAAK,EACV,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"Activity.d.ts","sourceRoot":"","sources":["../../sdk/workflow/Activity.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAMpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,8BAAsB,QAAQ,CAC5B,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvC,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,EAEnD,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE;IAE9C;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE;QACtB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;QACnC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;KAC7B,CAAC;IAMF;;;OAGG;IACH,OAAO,CAAC,IAAI;IASZ,OAAO,CAAC,YAAY,CAAmD;IAEvE;;;OAGG;IACH,OAAO,CAAC,eAAe;IAmBvB;;;OAGG;IACG,iBAAiB,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,0BAA0B,GAAG,OAAO,CAAC,CAAC;IAInH;;;OAGG;IACG,gBAAgB,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,0BAA0B,GAAG,OAAO,CAAC,CAAC;IAIlH;;OAEG;IACG,iBAAiB,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAI9E;;OAEG;IACG,gBAAgB,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAI7E;;;;;OAKG;IACG,WAAW,CACf,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,oBAAoB,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IAgB/D;;;OAGG;IACH,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAIhD;;;OAGG;IACH,OAAO,IAAI,kBAAkB,CAAC,OAAO,CAAC;CAGvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../sdk/workflow/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../sdk/workflow/client.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAEV,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,QAAQ,CAAC,CAAC,GAAG,GAAG;IAC3B,OAAO,CAAC,KAAK,CAAS;gBAEV,KAAK,EAAE,MAAM;IAIzB;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,yBAAyB,CAAC;IAiBjD;;;;;OAKG;IACG,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAiBpE;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,kBAAkB,CAAC,CAAC,CAAC;CA2JrD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { BaseField } from '../bdo/fields/BaseField';
|
|
2
|
+
/**
|
|
3
|
+
* Create a BaseField instance from raw Input field metadata.
|
|
4
|
+
* Used by useActivityForm to dynamically construct fields from BP metadata.
|
|
5
|
+
*
|
|
6
|
+
* @param fieldId - The field identifier (e.g., "StartDate", "LeaveType")
|
|
7
|
+
* @param meta - Raw field metadata from BP Activity Input definition
|
|
8
|
+
* @returns A BaseField instance matching the metadata Type
|
|
9
|
+
*/
|
|
10
|
+
export declare function createFieldFromMeta(fieldId: string, meta: Record<string, unknown>): BaseField<unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* Build a fields map from an Activity's Input metadata.
|
|
13
|
+
*
|
|
14
|
+
* @param input - The Input object from BP Activity definition
|
|
15
|
+
* (Record of fieldId → raw field metadata)
|
|
16
|
+
* @returns Record of fieldId → BaseField instance
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildFieldsFromInput(input: Record<string, Record<string, unknown>>): Record<string, BaseField<unknown>>;
|
|
19
|
+
/**
|
|
20
|
+
* Search all activities in a BP blob for a field definition by name.
|
|
21
|
+
* Used to discover field metadata for Context-derived readonly fields.
|
|
22
|
+
*
|
|
23
|
+
* @param currentActivityDef - The current activity definition (to skip)
|
|
24
|
+
* @param bpSchema - The full BP schema (with BDOBlob)
|
|
25
|
+
* @param fieldName - The field name to search for
|
|
26
|
+
* @returns The field metadata or null if not found
|
|
27
|
+
*/
|
|
28
|
+
export declare function findFieldInBpActivities(currentActivityDef: Record<string, unknown> | null, bpSchema: Record<string, unknown> | null | undefined, fieldName: string): Record<string, unknown> | null;
|
|
29
|
+
//# sourceMappingURL=createFieldFromMeta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createFieldFromMeta.d.ts","sourceRoot":"","sources":["../../sdk/workflow/createFieldFromMeta.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,SAAS,CAAC,OAAO,CAAC,CAkCpB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAC7C,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC,CAMpC;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EAClD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,EACpD,SAAS,EAAE,MAAM,GAChB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAahC"}
|
package/dist/workflow/index.d.ts
CHANGED
|
@@ -3,6 +3,5 @@ export { Activity } from './Activity';
|
|
|
3
3
|
export { ActivityInstance } from './ActivityInstance';
|
|
4
4
|
export type { ActivityInstanceType, EditableFieldAccessor, ReadonlyFieldAccessor, } from './ActivityInstance';
|
|
5
5
|
export type { ActivityInstanceFieldsType, ActivityOperations, ActivityProgressType, WorkflowStartResponseType, } from './types';
|
|
6
|
-
export {
|
|
7
|
-
export type { UseActivityFormOptions, UseActivityFormReturn, } from './components/useActivityForm';
|
|
6
|
+
export { createFieldFromMeta, buildFieldsFromInput } from './createFieldFromMeta';
|
|
8
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../sdk/workflow/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../sdk/workflow/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC"}
|