@ram_28/kf-ai-sdk 2.0.16 → 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.
Files changed (84) 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.cjs +1 -1
  10. package/dist/bdo.mjs +1 -1
  11. package/dist/components/hooks/useActivityForm/types.d.ts +4 -5
  12. package/dist/components/hooks/useActivityForm/types.d.ts.map +1 -1
  13. package/dist/components/hooks/useActivityForm/useActivityForm.d.ts.map +1 -1
  14. package/dist/components/hooks/useActivityTable/types.d.ts +5 -4
  15. package/dist/components/hooks/useActivityTable/types.d.ts.map +1 -1
  16. package/dist/components/hooks/useActivityTable/useActivityTable.d.ts.map +1 -1
  17. package/dist/components/hooks/useBDOTable/types.d.ts +20 -12
  18. package/dist/components/hooks/useBDOTable/types.d.ts.map +1 -1
  19. package/dist/components/hooks/useBDOTable/useBDOTable.d.ts +2 -2
  20. package/dist/components/hooks/useBDOTable/useBDOTable.d.ts.map +1 -1
  21. package/dist/{constants-ConHc1oS.js → constants-Cyi942Yr.js} +5 -5
  22. package/dist/constants-DEmYwKfC.cjs +1 -0
  23. package/dist/filter.cjs +1 -1
  24. package/dist/filter.mjs +1 -1
  25. package/dist/form.cjs +1 -1
  26. package/dist/form.mjs +1 -1
  27. package/dist/table.cjs +1 -1
  28. package/dist/table.mjs +15 -16
  29. package/dist/table.types.d.ts +1 -1
  30. package/dist/table.types.d.ts.map +1 -1
  31. package/dist/types/constants.d.ts +1 -1
  32. package/dist/workflow/Activity.d.ts +8 -5
  33. package/dist/workflow/Activity.d.ts.map +1 -1
  34. package/dist/workflow.cjs +1 -1
  35. package/dist/workflow.mjs +461 -476
  36. package/docs/README.md +51 -0
  37. package/docs/bdo/README.md +161 -0
  38. package/docs/bdo/api_reference.md +281 -0
  39. package/docs/examples/bdo/create-product.md +69 -0
  40. package/docs/examples/bdo/edit-product-dialog.md +95 -0
  41. package/docs/examples/bdo/filtered-product-table.md +100 -0
  42. package/docs/examples/bdo/product-listing.md +73 -0
  43. package/docs/examples/bdo/supplier-dropdown.md +60 -0
  44. package/docs/examples/workflow/approve-leave-request.md +76 -0
  45. package/docs/examples/workflow/filtered-activity-table.md +101 -0
  46. package/docs/examples/workflow/my-pending-requests.md +90 -0
  47. package/docs/examples/workflow/start-new-workflow.md +47 -0
  48. package/docs/examples/workflow/submit-leave-request.md +72 -0
  49. package/docs/examples/workflow/workflow-progress.md +49 -0
  50. package/docs/useActivityForm/README.md +241 -0
  51. package/docs/useActivityForm/api_reference.md +279 -0
  52. package/docs/useActivityTable/README.md +263 -0
  53. package/docs/useActivityTable/api_reference.md +294 -0
  54. package/docs/useBDOForm/README.md +172 -0
  55. package/docs/useBDOForm/api_reference.md +244 -0
  56. package/docs/useBDOTable/README.md +242 -0
  57. package/docs/useBDOTable/api_reference.md +253 -0
  58. package/docs/useFilter/README.md +323 -0
  59. package/docs/useFilter/api_reference.md +228 -0
  60. package/docs/workflow/README.md +158 -0
  61. package/docs/workflow/api_reference.md +161 -0
  62. package/package.json +1 -1
  63. package/sdk/auth/authConfig.ts +1 -1
  64. package/sdk/auth/types.ts +1 -1
  65. package/sdk/components/hooks/useActivityForm/types.ts +4 -6
  66. package/sdk/components/hooks/useActivityForm/useActivityForm.ts +10 -73
  67. package/sdk/components/hooks/useActivityTable/types.ts +4 -5
  68. package/sdk/components/hooks/useActivityTable/useActivityTable.ts +10 -8
  69. package/sdk/components/hooks/useBDOTable/types.ts +20 -10
  70. package/sdk/components/hooks/useBDOTable/useBDOTable.ts +12 -8
  71. package/sdk/table.types.ts +2 -0
  72. package/sdk/types/constants.ts +1 -1
  73. package/sdk/workflow/Activity.ts +39 -7
  74. package/dist/constants-QX2RX-wu.cjs +0 -1
  75. package/docs/api.md +0 -95
  76. package/docs/bdo.md +0 -224
  77. package/docs/gaps.md +0 -360
  78. package/docs/useActivityForm.md +0 -393
  79. package/docs/useActivityTable.md +0 -418
  80. package/docs/useBDOForm.md +0 -376
  81. package/docs/useBDOTable.md +0 -284
  82. package/docs/useFilter.md +0 -188
  83. package/docs/workflow.md +0 -560
  84. /package/docs/{useAuth.md → useAuth/README.md} +0 -0
package/dist/workflow.mjs CHANGED
@@ -1,17 +1,17 @@
1
1
  var oe = Object.defineProperty;
2
2
  var ce = (o, t, e) => t in o ? oe(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
- var N = (o, t, e) => ce(o, typeof t != "symbol" ? t + "" : t, e);
4
- import { c as S, g as $, d as le } from "./client-_ayziI1d.js";
5
- import { B as ue, c as de, S as Q, F as ye, U as fe, R as he, T as ge, D as me, b as _e, a as we, N as Fe } from "./FileField-BWrSHNRq.js";
6
- import { useState as z, useRef as W, useMemo as P, useEffect as Te, useCallback as G } from "react";
7
- import { v as ve, u as Oe, b as be, d as Se, e as $e, f as X, a as Ce } from "./shared-5a7UkED1.js";
8
- import { useQuery as pe } from "@tanstack/react-query";
3
+ var V = (o, t, e) => ce(o, typeof t != "symbol" ? t + "" : t, e);
4
+ import { c as T, g as O, d as le } from "./client-_ayziI1d.js";
5
+ import { B as ue, c as de, S as W, F as ye, U as fe, R as he, T as ge, D as me, b as _e, a as we, N as Fe } from "./FileField-BWrSHNRq.js";
6
+ import { useState as q, useRef as X, useMemo as b, useEffect as ve, useCallback as z } from "react";
7
+ import { v as Te, u as Oe, b as Se, d as $e, e as be, f as Ce, a as pe } from "./shared-5a7UkED1.js";
8
+ import { useQuery as Pe } from "@tanstack/react-query";
9
9
  import { v as Y, e as Z } from "./attachment-constants-C2UHWxmp.js";
10
- import { t as K, u as Pe } from "./useTable-DS0-WInw.js";
11
- import { g as Ve } from "./metadata-Cc1mBcLS.js";
10
+ import { t as ee, u as Ve } from "./useTable-DS0-WInw.js";
11
+ import { g as Ee } from "./metadata-Cc1mBcLS.js";
12
12
  class xe {
13
13
  constructor(t) {
14
- N(this, "bp_id");
14
+ V(this, "bp_id");
15
15
  this.bp_id = t;
16
16
  }
17
17
  /**
@@ -19,10 +19,10 @@ class xe {
19
19
  */
20
20
  async start() {
21
21
  const t = await fetch(
22
- `${S()}/api/app/process/${this.bp_id}/start`,
22
+ `${T()}/api/app/process/${this.bp_id}/start`,
23
23
  {
24
24
  method: "POST",
25
- headers: $()
25
+ headers: O()
26
26
  }
27
27
  );
28
28
  if (!t.ok)
@@ -37,10 +37,10 @@ class xe {
37
37
  */
38
38
  async progress(t) {
39
39
  const e = await fetch(
40
- `${S()}/api/app/process/${this.bp_id}/${t}/progress`,
40
+ `${T()}/api/app/process/${this.bp_id}/${t}/progress`,
41
41
  {
42
42
  method: "GET",
43
- headers: $()
43
+ headers: O()
44
44
  }
45
45
  );
46
46
  if (!e.ok)
@@ -55,147 +55,147 @@ class xe {
55
55
  const e = `/api/app/process/${this.bp_id}/${t}`;
56
56
  return {
57
57
  // ── List-level ────────────────────────────────────────────
58
- async inProgressList(a) {
59
- const n = await fetch(`${S()}${e}/inprogress/list`, {
58
+ async inProgressList(s) {
59
+ const a = await fetch(`${T()}${e}/inprogress/list`, {
60
60
  method: "POST",
61
- headers: $(),
62
- body: a ? JSON.stringify(a) : void 0
61
+ headers: O(),
62
+ body: s ? JSON.stringify(s) : void 0
63
63
  });
64
- if (!n.ok)
65
- throw new Error(`Failed to list in-progress activities: ${n.statusText}`);
66
- return n.json();
64
+ if (!a.ok)
65
+ throw new Error(`Failed to list in-progress activities: ${a.statusText}`);
66
+ return a.json();
67
67
  },
68
- async completedList(a) {
69
- const n = await fetch(`${S()}${e}/completed/list`, {
68
+ async completedList(s) {
69
+ const a = await fetch(`${T()}${e}/completed/list`, {
70
70
  method: "POST",
71
- headers: $(),
72
- body: a ? JSON.stringify(a) : void 0
71
+ headers: O(),
72
+ body: s ? JSON.stringify(s) : void 0
73
73
  });
74
- if (!n.ok)
75
- throw new Error(`Failed to list completed activities: ${n.statusText}`);
76
- return n.json();
74
+ if (!a.ok)
75
+ throw new Error(`Failed to list completed activities: ${a.statusText}`);
76
+ return a.json();
77
77
  },
78
- async inProgressCount(a) {
79
- var m, s;
80
- const n = {
78
+ async inProgressCount(s) {
79
+ var f, n;
80
+ const a = {
81
81
  Type: "Metric",
82
82
  GroupBy: [],
83
83
  Metric: [{ Field: "_id", Type: "Count" }],
84
- ...(a == null ? void 0 : a.Filter) && { Filter: a.Filter }
85
- }, i = await fetch(`${S()}${e}/inprogress/metric`, {
84
+ ...(s == null ? void 0 : s.Filter) && { Filter: s.Filter }
85
+ }, r = await fetch(`${T()}${e}/inprogress/metric`, {
86
86
  method: "POST",
87
- headers: $(),
88
- body: JSON.stringify(n)
87
+ headers: O(),
88
+ body: JSON.stringify(a)
89
89
  });
90
- if (!i.ok)
91
- throw new Error(`Failed to get in-progress count: ${i.statusText}`);
92
- return { Count: ((s = (m = (await i.json()).Data) == null ? void 0 : m[0]) == null ? void 0 : s.count__id) ?? 0 };
90
+ if (!r.ok)
91
+ throw new Error(`Failed to get in-progress count: ${r.statusText}`);
92
+ return { Count: ((n = (f = (await r.json()).Data) == null ? void 0 : f[0]) == null ? void 0 : n.count__id) ?? 0 };
93
93
  },
94
- async completedCount(a) {
95
- var m, s;
96
- const n = {
94
+ async completedCount(s) {
95
+ var f, n;
96
+ const a = {
97
97
  Type: "Metric",
98
98
  GroupBy: [],
99
99
  Metric: [{ Field: "_id", Type: "Count" }],
100
- ...(a == null ? void 0 : a.Filter) && { Filter: a.Filter }
101
- }, i = await fetch(`${S()}${e}/completed/metric`, {
100
+ ...(s == null ? void 0 : s.Filter) && { Filter: s.Filter }
101
+ }, r = await fetch(`${T()}${e}/completed/metric`, {
102
102
  method: "POST",
103
- headers: $(),
104
- body: JSON.stringify(n)
103
+ headers: O(),
104
+ body: JSON.stringify(a)
105
105
  });
106
- if (!i.ok)
107
- throw new Error(`Failed to get completed count: ${i.statusText}`);
108
- return { Count: ((s = (m = (await i.json()).Data) == null ? void 0 : m[0]) == null ? void 0 : s.count__id) ?? 0 };
106
+ if (!r.ok)
107
+ throw new Error(`Failed to get completed count: ${r.statusText}`);
108
+ return { Count: ((n = (f = (await r.json()).Data) == null ? void 0 : f[0]) == null ? void 0 : n.count__id) ?? 0 };
109
109
  },
110
- async inProgressMetric(a) {
111
- const n = { Type: "Metric", ...a }, i = await fetch(`${S()}${e}/inprogress/metric`, {
110
+ async inProgressMetric(s) {
111
+ const a = { Type: "Metric", ...s }, r = await fetch(`${T()}${e}/inprogress/metric`, {
112
112
  method: "POST",
113
- headers: $(),
114
- body: JSON.stringify(n)
113
+ headers: O(),
114
+ body: JSON.stringify(a)
115
115
  });
116
- if (!i.ok)
117
- throw new Error(`Failed to get in-progress metrics: ${i.statusText}`);
118
- return i.json();
116
+ if (!r.ok)
117
+ throw new Error(`Failed to get in-progress metrics: ${r.statusText}`);
118
+ return r.json();
119
119
  },
120
- async completedMetric(a) {
121
- const n = { Type: "Metric", ...a }, i = await fetch(`${S()}${e}/completed/metric`, {
120
+ async completedMetric(s) {
121
+ const a = { Type: "Metric", ...s }, r = await fetch(`${T()}${e}/completed/metric`, {
122
122
  method: "POST",
123
- headers: $(),
124
- body: JSON.stringify(n)
123
+ headers: O(),
124
+ body: JSON.stringify(a)
125
125
  });
126
- if (!i.ok)
127
- throw new Error(`Failed to get completed metrics: ${i.statusText}`);
128
- return i.json();
126
+ if (!r.ok)
127
+ throw new Error(`Failed to get completed metrics: ${r.statusText}`);
128
+ return r.json();
129
129
  },
130
130
  // ── Instance-level ────────────────────────────────────────
131
- async read(a) {
132
- const n = await fetch(`${S()}${e}/${a}/read`, {
131
+ async read(s) {
132
+ const a = await fetch(`${T()}${e}/${s}/read`, {
133
133
  method: "GET",
134
- headers: $()
134
+ headers: O()
135
135
  });
136
- if (!n.ok)
137
- throw new Error(`Failed to read activity: ${n.statusText}`);
138
- return (await n.json()).Data;
136
+ if (!a.ok)
137
+ throw new Error(`Failed to read activity: ${a.statusText}`);
138
+ return (await a.json()).Data;
139
139
  },
140
- async update(a, n) {
141
- const i = await fetch(`${S()}${e}/${a}/update`, {
140
+ async update(s, a) {
141
+ const r = await fetch(`${T()}${e}/${s}/update`, {
142
142
  method: "POST",
143
- headers: $(),
144
- body: JSON.stringify(n)
143
+ headers: O(),
144
+ body: JSON.stringify(a)
145
145
  });
146
- if (!i.ok)
147
- throw new Error(`Failed to update activity: ${i.statusText}`);
148
- return i.json();
146
+ if (!r.ok)
147
+ throw new Error(`Failed to update activity: ${r.statusText}`);
148
+ return r.json();
149
149
  },
150
- async draftStart(a, n) {
151
- const i = await fetch(`${S()}${e}/${a}/draft`, {
150
+ async draftStart(s, a) {
151
+ const r = await fetch(`${T()}${e}/${s}/draft`, {
152
152
  method: "PATCH",
153
- headers: $(),
154
- body: JSON.stringify(n)
153
+ headers: O(),
154
+ body: JSON.stringify(a)
155
155
  });
156
- if (!i.ok)
157
- throw new Error(`Failed to start draft: ${i.statusText}`);
158
- return i.json();
156
+ if (!r.ok)
157
+ throw new Error(`Failed to start draft: ${r.statusText}`);
158
+ return r.json();
159
159
  },
160
- async draftEnd(a, n) {
161
- const i = await fetch(`${S()}${e}/${a}/draft`, {
160
+ async draftEnd(s, a) {
161
+ const r = await fetch(`${T()}${e}/${s}/draft`, {
162
162
  method: "POST",
163
- headers: $(),
164
- body: JSON.stringify(n)
163
+ headers: O(),
164
+ body: JSON.stringify(a)
165
165
  });
166
- if (!i.ok)
167
- throw new Error(`Failed to end draft: ${i.statusText}`);
168
- return i.json();
166
+ if (!r.ok)
167
+ throw new Error(`Failed to end draft: ${r.statusText}`);
168
+ return r.json();
169
169
  },
170
- async complete(a) {
171
- const n = await fetch(`${S()}${e}/${a}/done`, {
170
+ async complete(s) {
171
+ const a = await fetch(`${T()}${e}/${s}/done`, {
172
172
  method: "POST",
173
- headers: $()
173
+ headers: O()
174
174
  });
175
- if (!n.ok)
176
- throw new Error(`Failed to complete activity: ${n.statusText}`);
177
- return n.json();
175
+ if (!a.ok)
176
+ throw new Error(`Failed to complete activity: ${a.statusText}`);
177
+ return a.json();
178
178
  },
179
- async progress(a) {
180
- const n = await fetch(`${S()}${e}/${a}/progress`, {
179
+ async progress(s) {
180
+ const a = await fetch(`${T()}${e}/${s}/progress`, {
181
181
  method: "GET",
182
- headers: $()
182
+ headers: O()
183
183
  });
184
- if (!n.ok)
185
- throw new Error(`Failed to get activity progress: ${n.statusText}`);
186
- return n.json();
184
+ if (!a.ok)
185
+ throw new Error(`Failed to get activity progress: ${a.statusText}`);
186
+ return a.json();
187
187
  }
188
188
  };
189
189
  }
190
190
  }
191
- class ke {
192
- constructor(t, e, a, n) {
193
- N(this, "_id");
194
- N(this, "_data");
195
- N(this, "_ops");
196
- N(this, "_fields");
197
- N(this, "_accessorCache", /* @__PURE__ */ new Map());
198
- this._ops = t, this._id = e, this._data = { ...a }, this._fields = n;
191
+ class De {
192
+ constructor(t, e, s, a) {
193
+ V(this, "_id");
194
+ V(this, "_data");
195
+ V(this, "_ops");
196
+ V(this, "_fields");
197
+ V(this, "_accessorCache", /* @__PURE__ */ new Map());
198
+ this._ops = t, this._id = e, this._data = { ...s }, this._fields = a;
199
199
  }
200
200
  // ============================================================
201
201
  // BDO ITEM METHODS
@@ -211,9 +211,9 @@ class ke {
211
211
  */
212
212
  validate() {
213
213
  const t = [];
214
- for (const [e, a] of Object.entries(this._fields)) {
215
- const n = this._data[e], i = a.validate(n);
216
- i.valid || t.push(...i.errors);
214
+ for (const [e, s] of Object.entries(this._fields)) {
215
+ const a = this._data[e], r = s.validate(a);
216
+ r.valid || t.push(...r.errors);
217
217
  }
218
218
  return {
219
219
  valid: t.length === 0,
@@ -254,51 +254,51 @@ class ke {
254
254
  _getAccessor(t) {
255
255
  if (this._accessorCache.has(t))
256
256
  return this._accessorCache.get(t);
257
- const e = this._fields[t], a = (e == null ? void 0 : e.meta) ?? {
257
+ const e = this._fields[t], s = (e == null ? void 0 : e.meta) ?? {
258
258
  _id: t,
259
259
  Name: t,
260
260
  Type: "String"
261
- }, n = (e == null ? void 0 : e.readOnly) ?? !1, i = () => e ? e.validate(this._data[t]) : { valid: !0, errors: [] };
262
- let r;
263
- return n ? r = {
261
+ }, a = (e == null ? void 0 : e.readOnly) ?? !1, r = () => e ? e.validate(this._data[t]) : { valid: !0, errors: [] };
262
+ let i;
263
+ return a ? i = {
264
264
  label: (e == null ? void 0 : e.label) ?? t,
265
265
  required: (e == null ? void 0 : e.required) ?? !1,
266
266
  readOnly: !0,
267
267
  defaultValue: e == null ? void 0 : e.defaultValue,
268
- meta: a,
268
+ meta: s,
269
269
  get: () => this._data[t],
270
- validate: i
271
- } : r = {
270
+ validate: r
271
+ } : i = {
272
272
  label: (e == null ? void 0 : e.label) ?? t,
273
273
  required: (e == null ? void 0 : e.required) ?? !1,
274
274
  readOnly: !1,
275
275
  defaultValue: e == null ? void 0 : e.defaultValue,
276
- meta: a,
276
+ meta: s,
277
277
  get: () => this._data[t],
278
- set: (y) => {
279
- this._data[t] = y;
278
+ set: (d) => {
279
+ this._data[t] = d;
280
280
  },
281
- validate: i
282
- }, this._accessorCache.set(t, r), r;
281
+ validate: r
282
+ }, this._accessorCache.set(t, i), i;
283
283
  }
284
284
  }
285
- function Ne(o, t, e, a) {
286
- const n = new ke(
285
+ function G(o, t, e, s) {
286
+ const a = new De(
287
287
  o,
288
288
  t,
289
289
  e,
290
- a
290
+ s
291
291
  );
292
- return new Proxy(n, {
293
- get(i, r, y) {
294
- return r === "validate" || r === "toJSON" || r === "update" || r === "save" || r === "complete" || r === "progress" || r === "_ops" || r === "_data" || r === "_fields" || r === "_accessorCache" || r === "_getAccessor" || typeof r == "symbol" ? Reflect.get(i, r, y) : r === "_id" ? i._id : i._getAccessor(r);
292
+ return new Proxy(a, {
293
+ get(r, i, d) {
294
+ return i === "validate" || i === "toJSON" || i === "update" || i === "save" || i === "complete" || i === "progress" || i === "_ops" || i === "_data" || i === "_fields" || i === "_accessorCache" || i === "_getAccessor" || typeof i == "symbol" ? Reflect.get(r, i, d) : i === "_id" ? r._id : r._getAccessor(i);
295
295
  },
296
- has(i, r) {
297
- return typeof r == "symbol" ? !1 : r === "validate" || r === "toJSON" || r === "update" || r === "save" || r === "complete" || r === "progress" || r === "_id" ? !0 : r in i._fields;
296
+ has(r, i) {
297
+ return typeof i == "symbol" ? !1 : i === "validate" || i === "toJSON" || i === "update" || i === "save" || i === "complete" || i === "progress" || i === "_id" ? !0 : i in r._fields;
298
298
  },
299
- ownKeys(i) {
299
+ ownKeys(r) {
300
300
  return [
301
- ...Object.keys(i._fields),
301
+ ...Object.keys(r._fields),
302
302
  "_id",
303
303
  "validate",
304
304
  "toJSON",
@@ -308,11 +308,11 @@ function Ne(o, t, e, a) {
308
308
  "progress"
309
309
  ];
310
310
  },
311
- getOwnPropertyDescriptor(i, r) {
312
- if (typeof r != "symbol")
311
+ getOwnPropertyDescriptor(r, i) {
312
+ if (typeof i != "symbol")
313
313
  return {
314
314
  configurable: !0,
315
- enumerable: r !== "validate" && r !== "toJSON" && r !== "update" && r !== "save" && r !== "complete" && r !== "progress"
315
+ enumerable: i !== "validate" && i !== "toJSON" && i !== "update" && i !== "save" && i !== "complete" && i !== "progress"
316
316
  };
317
317
  }
318
318
  });
@@ -322,7 +322,7 @@ class Ge {
322
322
  // ============================================================
323
323
  // FIELD DISCOVERY (internal)
324
324
  // ============================================================
325
- N(this, "_fieldsCache", null);
325
+ V(this, "_fieldsCache", null);
326
326
  }
327
327
  // ============================================================
328
328
  // ACTIVITY OPERATIONS (internal)
@@ -342,8 +342,8 @@ class Ge {
342
342
  if (this._fieldsCache) return this._fieldsCache;
343
343
  const t = {};
344
344
  for (const e of Object.keys(this)) {
345
- const a = this[e];
346
- a instanceof ue && (t[e] = a);
345
+ const s = this[e];
346
+ s instanceof ue && (t[e] = s);
347
347
  }
348
348
  return this._fieldsCache = t, t;
349
349
  }
@@ -352,17 +352,23 @@ class Ge {
352
352
  // ============================================================
353
353
  /**
354
354
  * List in-progress activity instances.
355
- * Accepts optional filter/sort/pagination options.
355
+ * Each row is wrapped in an ActivityInstance proxy with field accessors.
356
356
  */
357
357
  async getInProgressList(t) {
358
- return this._ops().inProgressList(t);
358
+ const e = this._ops(), s = await e.inProgressList(t), a = this._discoverFields();
359
+ return s.Data.map(
360
+ (r) => G(e, r._id, r, a)
361
+ );
359
362
  }
360
363
  /**
361
364
  * List completed activity instances.
362
- * Accepts optional filter/sort/pagination options.
365
+ * Each row is wrapped in an ActivityInstance proxy with field accessors.
363
366
  */
364
367
  async getCompletedList(t) {
365
- return this._ops().completedList(t);
368
+ const e = this._ops(), s = await e.completedList(t), a = this._discoverFields();
369
+ return s.Data.map(
370
+ (r) => G(e, r._id, r, a)
371
+ );
366
372
  }
367
373
  /**
368
374
  * Get count of in-progress activity instances.
@@ -399,12 +405,12 @@ class Ge {
399
405
  * @returns ActivityInstance with typed field accessors
400
406
  */
401
407
  async getInstance(t) {
402
- const e = this._ops(), a = await e.read(t), n = this._discoverFields();
403
- return Ne(
408
+ const e = this._ops(), s = await e.read(t), a = this._discoverFields();
409
+ return G(
404
410
  e,
405
411
  t,
406
- a,
407
- n
412
+ s,
413
+ a
408
414
  );
409
415
  }
410
416
  // ============================================================
@@ -425,14 +431,14 @@ class Ge {
425
431
  return this._ops();
426
432
  }
427
433
  }
428
- function ee(o, t) {
429
- var n;
430
- const e = { _id: o, ...t }, a = t.Type;
431
- if (a === "String" && ((n = t.Constraint) != null && n.Enum))
434
+ function te(o, t) {
435
+ var a;
436
+ const e = { _id: o, ...t }, s = t.Type;
437
+ if (s === "String" && ((a = t.Constraint) != null && a.Enum))
432
438
  return new de(e);
433
- switch (a) {
439
+ switch (s) {
434
440
  case "String":
435
- return new Q(e);
441
+ return new W(e);
436
442
  case "Number":
437
443
  return new Fe(e);
438
444
  case "Boolean":
@@ -450,56 +456,56 @@ function ee(o, t) {
450
456
  case "File":
451
457
  return new ye(e);
452
458
  default:
453
- return new Q(e);
459
+ return new W(e);
454
460
  }
455
461
  }
456
- function je(o) {
462
+ function Ne(o) {
457
463
  const t = {};
458
- for (const [e, a] of Object.entries(o))
459
- t[e] = ee(e, a);
464
+ for (const [e, s] of Object.entries(o))
465
+ t[e] = te(e, s);
460
466
  return t;
461
467
  }
462
- function De(o, t, e) {
463
- var i;
464
- const a = t == null ? void 0 : t.BDOBlob;
465
- if (!(a != null && a.Activity)) return null;
466
- const n = o == null ? void 0 : o.Id;
467
- for (const r of a.Activity)
468
- if (r.Id !== n && (i = r.Input) != null && i[e])
469
- return r.Input[e];
468
+ function ke(o, t, e) {
469
+ var r;
470
+ const s = t == null ? void 0 : t.BDOBlob;
471
+ if (!(s != null && s.Activity)) return null;
472
+ const a = o == null ? void 0 : o.Id;
473
+ for (const i of s.Activity)
474
+ if (i.Id !== a && (r = i.Input) != null && r[e])
475
+ return i.Input[e];
470
476
  return null;
471
477
  }
472
- function Ue(o) {
473
- return async (t, e, a) => {
474
- const n = {}, i = "_getFields" in o ? o._getFields() : o, r = (a == null ? void 0 : a.names) ?? Object.keys(i);
475
- for (const y of r) {
476
- const m = i[y];
477
- if (!m || m.readOnly) continue;
478
- let s = t[y];
479
- typeof s == "string" && m.meta.Type === "Number" && (s = s === "" ? void 0 : Number(s));
480
- const l = m.validate(s);
478
+ function Ie(o) {
479
+ return async (t, e, s) => {
480
+ const a = {}, r = "_getFields" in o ? o._getFields() : o, i = (s == null ? void 0 : s.names) ?? Object.keys(r);
481
+ for (const d of i) {
482
+ const f = r[d];
483
+ if (!f || f.readOnly) continue;
484
+ let n = t[d];
485
+ typeof n == "string" && f.meta.Type === "Number" && (n = n === "" ? void 0 : Number(n));
486
+ const l = f.validate(n);
481
487
  if (!l.valid && l.errors.length > 0) {
482
- n[y] = {
488
+ a[d] = {
483
489
  type: "validate",
484
- message: l.errors[0] || `${y} is invalid`
490
+ message: l.errors[0] || `${d} is invalid`
485
491
  };
486
492
  continue;
487
493
  }
488
- const w = ve(
489
- m,
490
- s
494
+ const _ = Te(
495
+ f,
496
+ n
491
497
  );
492
- !w.valid && w.errors.length > 0 && (n[y] = {
498
+ !_.valid && _.errors.length > 0 && (a[d] = {
493
499
  type: "constraint",
494
- message: w.errors[0]
500
+ message: _.errors[0]
495
501
  });
496
502
  }
497
- return Object.keys(n).length === 0 ? { values: t, errors: {} } : { values: {}, errors: n };
503
+ return Object.keys(a).length === 0 ? { values: t, errors: {} } : { values: {}, errors: a };
498
504
  };
499
505
  }
500
- function Ie(o, t, e) {
501
- const a = o._getFields(), n = /* @__PURE__ */ new Map(), i = `/api/app/process/${o.meta.businessProcessId}/${o.meta.activityId}`, r = le(i);
502
- function y() {
506
+ function Ue(o, t, e) {
507
+ const s = o._getFields(), a = /* @__PURE__ */ new Map(), r = `/api/app/process/${o.meta.businessProcessId}/${o.meta.activityId}`, i = le(r);
508
+ function d() {
503
509
  if (!e)
504
510
  throw new Error(
505
511
  "Cannot perform attachment operation: no activity instance ID"
@@ -509,53 +515,53 @@ function Ie(o, t, e) {
509
515
  return new Proxy(
510
516
  {},
511
517
  {
512
- get(m, s) {
513
- if (typeof s == "symbol")
518
+ get(f, n) {
519
+ if (typeof n == "symbol")
514
520
  return;
515
- if (s === "_id")
521
+ if (n === "_id")
516
522
  return e;
517
- if (s === "toJSON")
523
+ if (n === "toJSON")
518
524
  return () => t.getValues();
519
- if (s === "validate")
525
+ if (n === "validate")
520
526
  return () => t.trigger();
521
- if (n.has(s))
522
- return n.get(s);
523
- const l = a[s], w = (l == null ? void 0 : l.meta) ?? {
524
- _id: s,
525
- Name: s,
527
+ if (a.has(n))
528
+ return a.get(n);
529
+ const l = s[n], _ = (l == null ? void 0 : l.meta) ?? {
530
+ _id: n,
531
+ Name: n,
526
532
  Type: "String"
527
- }, B = (l == null ? void 0 : l.readOnly) ?? !1, R = () => l ? l.validate(
528
- t.getValues(s)
529
- ) : { valid: !0, errors: [] }, A = (b) => {
530
- const d = t.getValues(s);
531
- return d ?? b;
533
+ }, I = (l == null ? void 0 : l.readOnly) ?? !1, U = () => l ? l.validate(
534
+ t.getValues(n)
535
+ ) : { valid: !0, errors: [] }, j = (v) => {
536
+ const u = t.getValues(n);
537
+ return u ?? v;
532
538
  };
533
- if (!B) {
534
- const b = () => {
535
- const c = t.getValues(s);
536
- return w.Type === "File" ? c ?? [] : c;
537
- }, d = {
538
- label: (l == null ? void 0 : l.label) ?? s,
539
+ if (!I) {
540
+ const v = () => {
541
+ const c = t.getValues(n);
542
+ return _.Type === "File" ? c ?? [] : c;
543
+ }, u = {
544
+ label: (l == null ? void 0 : l.label) ?? n,
539
545
  required: (l == null ? void 0 : l.required) ?? !1,
540
546
  readOnly: !1,
541
547
  defaultValue: l == null ? void 0 : l.defaultValue,
542
- meta: w,
543
- get: b,
544
- getOrDefault: A,
548
+ meta: _,
549
+ get: v,
550
+ getOrDefault: j,
545
551
  set: (c) => {
546
- t.setValue(s, c, {
552
+ t.setValue(n, c, {
547
553
  shouldDirty: !0,
548
554
  shouldTouch: !0,
549
555
  shouldValidate: !1
550
556
  });
551
557
  },
552
- validate: R
558
+ validate: U
553
559
  };
554
- return (w.Type === "Image" || w.Type === "File") && (w.Type === "Image" ? (d.upload = async (c) => {
560
+ return (_.Type === "Image" || _.Type === "File") && (_.Type === "Image" ? (u.upload = async (c) => {
555
561
  Y(c.name, "Image");
556
- const h = y(), [f] = await r.getUploadUrl(
557
- h,
558
- s,
562
+ const g = d(), [h] = await i.getUploadUrl(
563
+ g,
564
+ n,
559
565
  [
560
566
  {
561
567
  FileName: c.name,
@@ -564,144 +570,144 @@ function Ie(o, t, e) {
564
570
  }
565
571
  ]
566
572
  );
567
- await fetch(f.UploadUrl.URL, {
573
+ await fetch(h.UploadUrl.URL, {
568
574
  method: "PUT",
569
- headers: { "Content-Type": f.ContentType },
575
+ headers: { "Content-Type": h.ContentType },
570
576
  body: c
571
577
  });
572
- const _ = {
573
- _id: f._id,
574
- _name: f._name,
575
- FileName: f.FileName,
576
- FileExtension: f.FileExtension,
577
- Size: f.Size,
578
- ContentType: f.ContentType
578
+ const m = {
579
+ _id: h._id,
580
+ _name: h._name,
581
+ FileName: h.FileName,
582
+ FileExtension: h.FileExtension,
583
+ Size: h.Size,
584
+ ContentType: h.ContentType
579
585
  };
580
- return t.setValue(s, _, {
586
+ return t.setValue(n, m, {
581
587
  shouldDirty: !0
582
- }), _;
583
- }, d.deleteAttachment = async () => {
588
+ }), m;
589
+ }, u.deleteAttachment = async () => {
584
590
  const c = t.getValues(
585
- s
586
- ), h = y();
591
+ n
592
+ ), g = d();
587
593
  if (!(c != null && c._id))
588
- throw new Error(`${s} has no image to delete`);
589
- await r.deleteAttachment(h, s, c._id), t.setValue(s, null, {
594
+ throw new Error(`${n} has no image to delete`);
595
+ await i.deleteAttachment(g, n, c._id), t.setValue(n, null, {
590
596
  shouldDirty: !0
591
597
  });
592
- }, d.getDownloadUrl = async (c) => {
593
- const h = t.getValues(
594
- s
595
- ), f = y();
596
- if (!(h != null && h._id))
597
- throw new Error(`${s} has no image`);
598
- return r.getDownloadUrl(
599
- f,
600
- s,
601
- h._id,
598
+ }, u.getDownloadUrl = async (c) => {
599
+ const g = t.getValues(
600
+ n
601
+ ), h = d();
602
+ if (!(g != null && g._id))
603
+ throw new Error(`${n} has no image`);
604
+ return i.getDownloadUrl(
605
+ h,
606
+ n,
607
+ g._id,
602
608
  c
603
609
  );
604
- }) : (d.upload = async (c) => {
605
- for (const O of c)
606
- Y(O.name, "File");
607
- const h = y(), f = c.map((O) => ({
608
- FileName: O.name,
609
- Size: O.size,
610
- FileExtension: Z(O.name)
611
- })), _ = await r.getUploadUrl(
612
- h,
613
- s,
614
- f
615
- ), M = await Promise.all(
616
- c.map(async (O, k) => (await fetch(_[k].UploadUrl.URL, {
610
+ }) : (u.upload = async (c) => {
611
+ for (const F of c)
612
+ Y(F.name, "File");
613
+ const g = d(), h = c.map((F) => ({
614
+ FileName: F.name,
615
+ Size: F.size,
616
+ FileExtension: Z(F.name)
617
+ })), m = await i.getUploadUrl(
618
+ g,
619
+ n,
620
+ h
621
+ ), B = await Promise.all(
622
+ c.map(async (F, p) => (await fetch(m[p].UploadUrl.URL, {
617
623
  method: "PUT",
618
624
  headers: {
619
- "Content-Type": _[k].ContentType
625
+ "Content-Type": m[p].ContentType
620
626
  },
621
- body: O
627
+ body: F
622
628
  }), {
623
- _id: _[k]._id,
624
- _name: _[k]._name,
625
- FileName: _[k].FileName,
626
- FileExtension: _[k].FileExtension,
627
- Size: _[k].Size,
628
- ContentType: _[k].ContentType
629
+ _id: m[p]._id,
630
+ _name: m[p]._name,
631
+ FileName: m[p].FileName,
632
+ FileExtension: m[p].FileExtension,
633
+ Size: m[p].Size,
634
+ ContentType: m[p].ContentType
629
635
  }))
630
- ), u = t.getValues(s) ?? [];
636
+ ), y = t.getValues(n) ?? [];
631
637
  return t.setValue(
632
- s,
633
- [...u, ...M],
638
+ n,
639
+ [...y, ...B],
634
640
  { shouldDirty: !0 }
635
- ), M;
636
- }, d.deleteAttachment = async (c) => {
637
- const h = t.getValues(s) ?? [], f = y();
638
- await r.deleteAttachment(f, s, c), t.setValue(
639
- s,
640
- h.filter((_) => _._id !== c),
641
+ ), B;
642
+ }, u.deleteAttachment = async (c) => {
643
+ const g = t.getValues(n) ?? [], h = d();
644
+ await i.deleteAttachment(h, n, c), t.setValue(
645
+ n,
646
+ g.filter((m) => m._id !== c),
641
647
  { shouldDirty: !0 }
642
648
  );
643
- }, d.getDownloadUrl = async (c, h) => {
644
- const f = y();
645
- return r.getDownloadUrl(
646
- f,
647
- s,
649
+ }, u.getDownloadUrl = async (c, g) => {
650
+ const h = d();
651
+ return i.getDownloadUrl(
652
+ h,
653
+ n,
648
654
  c,
649
- h
655
+ g
650
656
  );
651
- }, d.getDownloadUrls = async (c) => {
652
- const h = y();
653
- return r.getDownloadUrls(h, s, c);
654
- })), n.set(s, d), d;
657
+ }, u.getDownloadUrls = async (c) => {
658
+ const g = d();
659
+ return i.getDownloadUrls(g, n, c);
660
+ })), a.set(n, u), u;
655
661
  }
656
- const D = () => {
657
- const b = t.getValues(s);
658
- return w.Type === "File" ? b ?? [] : b;
659
- }, V = {
660
- label: (l == null ? void 0 : l.label) ?? s,
662
+ const N = () => {
663
+ const v = t.getValues(n);
664
+ return _.Type === "File" ? v ?? [] : v;
665
+ }, $ = {
666
+ label: (l == null ? void 0 : l.label) ?? n,
661
667
  required: (l == null ? void 0 : l.required) ?? !1,
662
668
  readOnly: !0,
663
669
  defaultValue: l == null ? void 0 : l.defaultValue,
664
- meta: w,
665
- get: D,
666
- getOrDefault: A,
667
- validate: R
670
+ meta: _,
671
+ get: N,
672
+ getOrDefault: j,
673
+ validate: U
668
674
  };
669
- return (w.Type === "Image" || w.Type === "File") && (w.Type === "Image" ? V.getDownloadUrl = async (b) => {
670
- const d = t.getValues(
671
- s
672
- ), c = y();
673
- if (!(d != null && d._id))
674
- throw new Error(`${s} has no image to download`);
675
- return r.getDownloadUrl(
675
+ return (_.Type === "Image" || _.Type === "File") && (_.Type === "Image" ? $.getDownloadUrl = async (v) => {
676
+ const u = t.getValues(
677
+ n
678
+ ), c = d();
679
+ if (!(u != null && u._id))
680
+ throw new Error(`${n} has no image to download`);
681
+ return i.getDownloadUrl(
676
682
  c,
677
- s,
678
- d._id,
679
- b
683
+ n,
684
+ u._id,
685
+ v
680
686
  );
681
- } : (V.getDownloadUrl = async (b, d) => {
682
- const c = y();
683
- return r.getDownloadUrl(
687
+ } : ($.getDownloadUrl = async (v, u) => {
688
+ const c = d();
689
+ return i.getDownloadUrl(
684
690
  c,
685
- s,
686
- b,
687
- d
691
+ n,
692
+ v,
693
+ u
688
694
  );
689
- }, V.getDownloadUrls = async (b) => {
690
- const d = y();
691
- return r.getDownloadUrls(d, s, b);
692
- })), n.set(s, V), V;
695
+ }, $.getDownloadUrls = async (v) => {
696
+ const u = d();
697
+ return i.getDownloadUrls(u, n, v);
698
+ })), a.set(n, $), $;
693
699
  },
694
- has(m, s) {
695
- return typeof s == "symbol" ? !1 : s === "_id" || s === "toJSON" || s === "validate" ? !0 : s in a;
700
+ has(f, n) {
701
+ return typeof n == "symbol" ? !1 : n === "_id" || n === "toJSON" || n === "validate" ? !0 : n in s;
696
702
  },
697
- ownKeys(m) {
698
- return [...Object.keys(a), "_id", "toJSON", "validate"];
703
+ ownKeys(f) {
704
+ return [...Object.keys(s), "_id", "toJSON", "validate"];
699
705
  },
700
- getOwnPropertyDescriptor(m, s) {
701
- if (typeof s != "symbol")
706
+ getOwnPropertyDescriptor(f, n) {
707
+ if (typeof n != "symbol")
702
708
  return {
703
709
  configurable: !0,
704
- enumerable: s !== "toJSON" && s !== "validate"
710
+ enumerable: n !== "toJSON" && n !== "validate"
705
711
  };
706
712
  }
707
713
  }
@@ -710,55 +716,55 @@ function Ie(o, t, e) {
710
716
  function Ke(o, t) {
711
717
  const {
712
718
  activity_instance_id: e,
713
- defaultValues: a = {},
714
- mode: n = "onBlur",
715
- enabled: i = !0
716
- } = t, [r, y] = z(!1), [m, s] = z(null), [l, w] = z(!1), [B, R] = z({}), A = W(!1), D = W(null), { data: V, isLoading: b } = pe({
719
+ defaultValues: s = {},
720
+ mode: a = "onBlur",
721
+ enabled: r = !0
722
+ } = t, [i, d] = q(!1), [f, n] = q(null), [l, _] = q(!1), [I, U] = q({}), j = X(!1), N = X(null), { data: $, isLoading: v } = Pe({
717
723
  queryKey: ["bp-metadata", o.meta.businessProcessId],
718
- queryFn: () => Ve(o.meta.businessProcessId),
724
+ queryFn: () => Ee(o.meta.businessProcessId),
719
725
  staleTime: 30 * 60 * 1e3
720
- }), d = P(() => {
721
- const g = V == null ? void 0 : V.BDOBlob;
722
- return g != null && g.Activity ? g.Activity.find(
723
- (T) => T.Id === o.meta.activityId
726
+ }), u = b(() => {
727
+ const w = $ == null ? void 0 : $.BDOBlob;
728
+ return w != null && w.Activity ? w.Activity.find(
729
+ (C) => C.Id === o.meta.activityId
724
730
  ) ?? null : null;
725
- }, [V, o.meta.activityId]), c = b, h = P(() => d != null && d.Input ? je(d.Input) : o._getFields(), [d, o]), f = P(
731
+ }, [$, o.meta.activityId]), c = v, g = b(() => u != null && u.Input ? Ne(u.Input) : o._getFields(), [u, o]), h = b(
726
732
  () => ({
727
- ...B,
733
+ ...I,
728
734
  // readonly fields from other activities
729
- ...h
735
+ ...g
730
736
  // Input fields (editable + readonly)
731
737
  }),
732
- [B, h]
733
- ), _ = P(
734
- () => Object.keys(f).filter((g) => f[g].readOnly),
735
- [f]
736
- ), M = P(
737
- () => Ue(h),
738
+ [I, g]
739
+ ), m = b(
740
+ () => Object.keys(h).filter((w) => h[w].readOnly),
738
741
  [h]
739
- ), u = Oe({
740
- mode: n,
741
- defaultValues: a,
742
- resolver: M
743
- }), O = P(() => o._getOps(), [o]), k = P(
744
- () => Ie(o, u, e),
745
- [o, u, e]
742
+ ), B = b(
743
+ () => Ie(g),
744
+ [g]
745
+ ), y = Oe({
746
+ mode: a,
747
+ defaultValues: s,
748
+ resolver: B
749
+ }), F = b(() => o._getOps(), [o]), p = b(
750
+ () => Ue(o, y, e),
751
+ [o, y, e]
746
752
  );
747
- Te(() => {
748
- if (!i || c) return;
749
- let g = !0;
753
+ ve(() => {
754
+ if (!r || c) return;
755
+ let w = !0;
750
756
  return (async () => {
751
- y(!0), s(null);
757
+ d(!0), n(null);
752
758
  try {
753
- const F = await O.read(e);
754
- if (!g) return;
755
- if (F && typeof F == "object") {
756
- const x = Ce(
757
- h,
758
- F
759
- ), C = { ...a, ...x };
760
- (D.current === null || F !== D.current) && (u.reset(C), D.current = F);
761
- const U = /* @__PURE__ */ new Set([
759
+ const S = await F.read(e);
760
+ if (!w) return;
761
+ if (S && typeof S == "object") {
762
+ const D = pe(
763
+ g,
764
+ S
765
+ ), E = { ...s, ...D };
766
+ (N.current === null || S !== N.current) && (y.reset(E), N.current = S);
767
+ const L = /* @__PURE__ */ new Set([
762
768
  "_id",
763
769
  "BPInstanceId",
764
770
  "Status",
@@ -770,162 +776,141 @@ function Ke(o, t) {
770
776
  "_modified_by",
771
777
  "_v",
772
778
  "_m_v"
773
- ]), j = {};
774
- for (const p of Object.keys(F))
775
- if (!h[p] && !U.has(p)) {
776
- const v = De(
777
- d,
778
- V,
779
- p
779
+ ]), k = {};
780
+ for (const P of Object.keys(S))
781
+ if (!g[P] && !L.has(P)) {
782
+ const J = ke(
783
+ u,
784
+ $,
785
+ P
780
786
  );
781
- v && (j[p] = ee(p, {
782
- ...v,
787
+ J && (k[P] = te(P, {
788
+ ...J,
783
789
  ReadOnly: !0
784
790
  }));
785
791
  }
786
- Object.keys(j).length > 0 && R(j);
792
+ Object.keys(k).length > 0 && U(k);
787
793
  }
788
- } catch (F) {
789
- if (!g) return;
790
- console.error("Failed to read activity data:", F), s(K(F));
794
+ } catch (S) {
795
+ if (!w) return;
796
+ console.error("Failed to read activity data:", S), n(ee(S));
791
797
  } finally {
792
- g && y(!1);
798
+ w && d(!1);
793
799
  }
794
800
  })(), () => {
795
- g = !1;
801
+ w = !1;
796
802
  };
797
- }, [i, c, O, e]);
798
- const H = G(
799
- (g, T) => O.update(e, {
800
- [g]: T
803
+ }, [r, c, F, e]);
804
+ const K = z(
805
+ (w, C) => F.update(e, {
806
+ [w]: C
801
807
  }),
802
- [O, e]
803
- ), J = P(
804
- () => be({
805
- apiFn: H,
806
- allFields: f,
807
- readonlyFieldNames: _,
808
- rhf: u,
809
- isComputingRef: A
810
- }),
811
- [H, f, _, u]
812
- ), q = n === "onChange" || n === "all", L = n === "onBlur" || n === "onTouched" || n === "all", te = P(
808
+ [F, e]
809
+ ), R = b(
813
810
  () => Se({
814
- rhf: u,
815
- allFields: f,
816
- syncField: J,
817
- syncOnBlur: L,
818
- syncOnChange: q
811
+ apiFn: K,
812
+ allFields: h,
813
+ readonlyFieldNames: m,
814
+ rhf: y,
815
+ isComputingRef: j
819
816
  }),
820
- [u, f, J, L, q]
821
- ), se = P(
817
+ [K, h, m, y]
818
+ ), A = a === "onChange" || a === "all", M = a === "onBlur" || a === "onTouched" || a === "all", se = b(
822
819
  () => $e({
823
- control: u.control,
824
- syncField: J,
825
- syncOnBlur: L,
826
- syncOnChange: q
820
+ rhf: y,
821
+ allFields: h,
822
+ syncField: R,
823
+ syncOnBlur: M,
824
+ syncOnChange: A
827
825
  }),
828
- [u.control, J, L, q]
829
- ), ae = G(
830
- (g, T) => u.handleSubmit(
831
- async (F, x) => {
832
- w(!0);
833
- try {
834
- const C = {}, U = new Set(_), j = u.formState.dirtyFields, p = u.getValues();
835
- for (const v of Object.keys(p)) {
836
- if (U.has(v) || !j[v]) continue;
837
- const I = p[v] !== void 0 ? p[v] : F[v], E = f[v];
838
- C[v] = E ? X(E, I) : I;
839
- }
840
- Object.keys(C).length > 0 && await O.update(
841
- e,
842
- C
843
- ), await (g == null ? void 0 : g(F, x));
844
- } catch (C) {
845
- T == null || T(K(C), x);
846
- } finally {
847
- w(!1);
848
- }
849
- },
850
- (F, x) => {
851
- T == null || T(F, x);
852
- }
853
- ),
854
- [u, O, _, f, e]
855
- ), ne = G(
856
- (g, T) => u.handleSubmit(
857
- async (F, x) => {
858
- w(!0);
826
+ [y, h, R, M, A]
827
+ ), ae = b(
828
+ () => be({
829
+ control: y.control,
830
+ syncField: R,
831
+ syncOnBlur: M,
832
+ syncOnChange: A
833
+ }),
834
+ [y.control, R, M, A]
835
+ ), ne = z(
836
+ (w, C) => y.handleSubmit(
837
+ async (S, D) => {
838
+ _(!0);
859
839
  try {
860
- const C = {}, U = new Set(_), j = u.formState.dirtyFields, p = u.getValues();
861
- for (const v of Object.keys(p)) {
862
- if (U.has(v) || !j[v]) continue;
863
- const I = p[v] !== void 0 ? p[v] : F[v], E = f[v];
864
- C[v] = E ? X(E, I) : I;
840
+ const E = {}, L = new Set(m), k = y.formState.dirtyFields, P = y.getValues();
841
+ for (const x of Object.keys(P)) {
842
+ if (L.has(x) || !k[x]) continue;
843
+ const H = P[x] !== void 0 ? P[x] : S[x], Q = h[x];
844
+ E[x] = Q ? Ce(Q, H) : H;
865
845
  }
866
- Object.keys(C).length > 0 && await O.update(
846
+ Object.keys(E).length > 0 && await F.update(
867
847
  e,
868
- C
869
- ), await O.complete(e), await (g == null ? void 0 : g(F, x));
870
- } catch (C) {
871
- T == null || T(K(C), x);
848
+ E
849
+ );
850
+ const J = await F.complete(e);
851
+ await (w == null ? void 0 : w(J, D));
852
+ } catch (E) {
853
+ C == null || C(ee(E), D);
872
854
  } finally {
873
- w(!1);
855
+ _(!1);
874
856
  }
875
857
  },
876
- (F, x) => {
877
- T == null || T(F, x);
858
+ (S, D) => {
859
+ C == null || C(S, D);
878
860
  }
879
861
  ),
880
- [u, O, _, f, e]
881
- ), re = G(() => {
882
- u.clearErrors();
883
- }, [u]), ie = !!m;
862
+ [y, F, m, h, e]
863
+ ), re = z(() => {
864
+ y.clearErrors();
865
+ }, [y]), ie = !!f;
884
866
  return {
885
867
  // Item proxy
886
- item: k,
868
+ item: p,
887
869
  // Activity reference
888
870
  activity: o,
889
871
  // Form methods
890
- register: te,
891
- handleSubmit: ae,
892
- handleComplete: ne,
893
- watch: u.watch,
894
- setValue: u.setValue,
895
- getValues: u.getValues,
896
- reset: u.reset,
897
- trigger: u.trigger,
898
- control: se,
872
+ register: se,
873
+ handleSubmit: ne,
874
+ watch: y.watch,
875
+ setValue: y.setValue,
876
+ getValues: y.getValues,
877
+ reset: y.reset,
878
+ trigger: y.trigger,
879
+ control: ae,
899
880
  // Flattened form state
900
- errors: u.formState.errors,
901
- isValid: u.formState.isValid,
902
- isDirty: u.formState.isDirty,
903
- isSubmitting: u.formState.isSubmitting || l,
904
- isSubmitSuccessful: u.formState.isSubmitSuccessful,
881
+ errors: y.formState.errors,
882
+ isValid: y.formState.isValid,
883
+ isDirty: y.formState.isDirty,
884
+ isSubmitting: y.formState.isSubmitting || l,
885
+ isSubmitSuccessful: y.formState.isSubmitSuccessful,
905
886
  // Loading
906
- isLoading: r || c,
887
+ isLoading: i || c,
907
888
  isMetadataLoading: c,
908
- loadError: m,
889
+ loadError: f,
909
890
  hasError: ie,
910
891
  // Metadata
911
- bpMetadata: V ?? null,
892
+ bpMetadata: $ ?? null,
912
893
  // Operations
913
894
  clearErrors: re
914
895
  };
915
896
  }
916
897
  function He(o) {
917
- const { activity: t, status: e, ...a } = o, { businessProcessId: n, activityId: i } = t.meta, r = P(() => t._getOps(), [t]), y = P(
918
- () => e === "inprogress" ? (s) => r.inProgressList(s) : (s) => r.completedList(s),
919
- [r, e]
920
- ), m = P(
921
- () => e === "inprogress" ? (s) => r.inProgressCount(s) : (s) => r.completedCount(s),
922
- [r, e]
898
+ const { activity: t, status: e, ...s } = o, { businessProcessId: a, activityId: r } = t.meta, i = b(
899
+ () => e === "inprogress" ? async (f) => ({
900
+ Data: await t.getInProgressList(f)
901
+ }) : async (f) => ({
902
+ Data: await t.getCompletedList(f)
903
+ }),
904
+ [t, e]
905
+ ), d = b(
906
+ () => e === "inprogress" ? async (f) => ({ Count: await t.inProgressCount(f) }) : async (f) => ({ Count: await t.completedCount(f) }),
907
+ [t, e]
923
908
  );
924
- return Pe({
925
- queryKey: ["activity-table", n, i, e],
926
- listFn: y,
927
- countFn: m,
928
- ...a
909
+ return Ve({
910
+ queryKey: ["activity-table", a, r, e],
911
+ listFn: i,
912
+ countFn: d,
913
+ ...s
929
914
  });
930
915
  }
931
916
  const Qe = {
@@ -934,11 +919,11 @@ const Qe = {
934
919
  };
935
920
  export {
936
921
  Ge as Activity,
937
- ke as ActivityInstance,
922
+ De as ActivityInstance,
938
923
  Qe as ActivityTableStatus,
939
924
  xe as Workflow,
940
- je as buildFieldsFromInput,
941
- ee as createFieldFromMeta,
925
+ Ne as buildFieldsFromInput,
926
+ te as createFieldFromMeta,
942
927
  Ke as useActivityForm,
943
928
  He as useActivityTable
944
929
  };