@ram_28/kf-ai-sdk 2.0.19 → 2.0.20-beta.0

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