@ram_28/kf-ai-sdk 2.0.12 → 2.0.13

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 (69) hide show
  1. package/dist/api/client.d.ts.map +1 -1
  2. package/dist/api.cjs +1 -1
  3. package/dist/api.mjs +2 -2
  4. package/dist/attachment-constants-B5jlqoKI.cjs +1 -0
  5. package/dist/attachment-constants-C2UHWxmp.js +63 -0
  6. package/dist/auth.cjs +1 -1
  7. package/dist/auth.mjs +1 -1
  8. package/dist/bdo/core/types.d.ts +4 -0
  9. package/dist/bdo/core/types.d.ts.map +1 -1
  10. package/dist/bdo/fields/NumberField.d.ts.map +1 -1
  11. package/dist/bdo/fields/ReferenceField.d.ts +3 -2
  12. package/dist/bdo/fields/ReferenceField.d.ts.map +1 -1
  13. package/dist/bdo/fields/SelectField.d.ts +1 -1
  14. package/dist/bdo/fields/SelectField.d.ts.map +1 -1
  15. package/dist/bdo/fields/UserField.d.ts +5 -0
  16. package/dist/bdo/fields/UserField.d.ts.map +1 -1
  17. package/dist/bdo.cjs +1 -1
  18. package/dist/bdo.mjs +107 -153
  19. package/dist/client-DnO2KKrw.cjs +1 -0
  20. package/dist/{client-CMERmrC-.js → client-iQTqFDNI.js} +34 -30
  21. package/dist/components/hooks/useForm/createItemProxy.d.ts +4 -0
  22. package/dist/components/hooks/useForm/createItemProxy.d.ts.map +1 -1
  23. package/dist/components/hooks/useForm/createResolver.d.ts.map +1 -1
  24. package/dist/components/hooks/useForm/useForm.d.ts +1 -0
  25. package/dist/components/hooks/useForm/useForm.d.ts.map +1 -1
  26. package/dist/form.cjs +1 -1
  27. package/dist/form.mjs +368 -203
  28. package/dist/{metadata-BfJtHz84.cjs → metadata-DgLSJkF5.cjs} +1 -1
  29. package/dist/{metadata-CwAo6a8e.js → metadata-DpfI3zRN.js} +1 -1
  30. package/dist/table.cjs +1 -1
  31. package/dist/table.mjs +1 -1
  32. package/dist/workflow/types.d.ts +3 -2
  33. package/dist/workflow/types.d.ts.map +1 -1
  34. package/dist/workflow.cjs +1 -1
  35. package/dist/workflow.d.ts +0 -2
  36. package/dist/workflow.d.ts.map +1 -1
  37. package/dist/workflow.mjs +204 -274
  38. package/dist/workflow.types.d.ts +0 -1
  39. package/dist/workflow.types.d.ts.map +1 -1
  40. package/docs/api.md +45 -253
  41. package/docs/bdo.md +130 -711
  42. package/docs/useAuth.md +42 -104
  43. package/docs/useFilter.md +117 -1591
  44. package/docs/useForm.md +263 -861
  45. package/docs/useTable.md +255 -1096
  46. package/docs/workflow.md +10 -155
  47. package/package.json +1 -1
  48. package/sdk/api/client.ts +18 -4
  49. package/sdk/bdo/core/types.ts +1 -0
  50. package/sdk/bdo/fields/NumberField.ts +2 -1
  51. package/sdk/bdo/fields/ReferenceField.ts +4 -3
  52. package/sdk/bdo/fields/SelectField.ts +2 -2
  53. package/sdk/bdo/fields/UserField.ts +14 -0
  54. package/sdk/components/hooks/useForm/createItemProxy.ts +221 -4
  55. package/sdk/components/hooks/useForm/createResolver.ts +16 -1
  56. package/sdk/components/hooks/useForm/useForm.ts +151 -50
  57. package/sdk/workflow/types.ts +3 -2
  58. package/sdk/workflow.ts +0 -7
  59. package/sdk/workflow.types.ts +0 -7
  60. package/dist/client-BnVxSHAm.cjs +0 -1
  61. package/dist/workflow/components/useActivityTable/index.d.ts +0 -4
  62. package/dist/workflow/components/useActivityTable/index.d.ts.map +0 -1
  63. package/dist/workflow/components/useActivityTable/types.d.ts +0 -53
  64. package/dist/workflow/components/useActivityTable/types.d.ts.map +0 -1
  65. package/dist/workflow/components/useActivityTable/useActivityTable.d.ts +0 -4
  66. package/dist/workflow/components/useActivityTable/useActivityTable.d.ts.map +0 -1
  67. package/sdk/workflow/components/useActivityTable/index.ts +0 -8
  68. package/sdk/workflow/components/useActivityTable/types.ts +0 -67
  69. package/sdk/workflow/components/useActivityTable/useActivityTable.ts +0 -145
package/dist/workflow.mjs CHANGED
@@ -1,15 +1,14 @@
1
- var K = Object.defineProperty;
2
- var H = (o, e, t) => e in o ? K(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var p = (o, e, t) => H(o, typeof e != "symbol" ? e + "" : e, t);
4
- import { c as g, g as m } from "./client-CMERmrC-.js";
5
- import { B as Q } from "./BaseField-B6da88U7.js";
6
- import { useState as L, useRef as A, useMemo as P, useEffect as U, useCallback as C } from "react";
1
+ var G = Object.defineProperty;
2
+ var H = (o, e, t) => e in o ? G(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var b = (o, e, t) => H(o, typeof e != "symbol" ? e + "" : e, t);
4
+ import { c as y, g } from "./client-iQTqFDNI.js";
5
+ import { B as K } from "./BaseField-B6da88U7.js";
6
+ import { useState as k, useRef as A, useMemo as p, useEffect as U, useCallback as j } from "react";
7
7
  import { u as W } from "./index.esm-Cj63v5ny.js";
8
- import { t as x } from "./error-handling-CrhTtD88.js";
9
- import { useQuery as M } from "@tanstack/react-query";
8
+ import { t as C } from "./error-handling-CrhTtD88.js";
10
9
  class z {
11
10
  constructor(e) {
12
- p(this, "bp_id");
11
+ b(this, "bp_id");
13
12
  this.bp_id = e;
14
13
  }
15
14
  /**
@@ -17,10 +16,10 @@ class z {
17
16
  */
18
17
  async start() {
19
18
  const e = await fetch(
20
- `${g()}/api/app/process/${this.bp_id}/start`,
19
+ `${y()}/api/app/process/${this.bp_id}/start`,
21
20
  {
22
21
  method: "POST",
23
- headers: m()
22
+ headers: g()
24
23
  }
25
24
  );
26
25
  if (!e.ok)
@@ -35,10 +34,10 @@ class z {
35
34
  */
36
35
  async progress(e) {
37
36
  const t = await fetch(
38
- `${g()}/api/app/process/${this.bp_id}/${e}/progress`,
37
+ `${y()}/api/app/process/${this.bp_id}/${e}/progress`,
39
38
  {
40
39
  method: "GET",
41
- headers: m()
40
+ headers: g()
42
41
  }
43
42
  );
44
43
  if (!t.ok)
@@ -54,94 +53,94 @@ class z {
54
53
  return {
55
54
  // ── List-level ────────────────────────────────────────────
56
55
  async inProgressList() {
57
- const a = await fetch(`${g()}${t}/inprogress/list`, {
56
+ const r = await fetch(`${y()}${t}/inprogress/list`, {
58
57
  method: "GET",
59
- headers: m()
58
+ headers: g()
60
59
  });
61
- if (!a.ok)
62
- throw new Error(`Failed to list in-progress activities: ${a.statusText}`);
63
- return a.json();
60
+ if (!r.ok)
61
+ throw new Error(`Failed to list in-progress activities: ${r.statusText}`);
62
+ return r.json();
64
63
  },
65
64
  async completedList() {
66
- const a = await fetch(`${g()}${t}/completed/list`, {
65
+ const r = await fetch(`${y()}${t}/completed/list`, {
67
66
  method: "GET",
68
- headers: m()
67
+ headers: g()
69
68
  });
70
- if (!a.ok)
71
- throw new Error(`Failed to list completed activities: ${a.statusText}`);
72
- return a.json();
69
+ if (!r.ok)
70
+ throw new Error(`Failed to list completed activities: ${r.statusText}`);
71
+ return r.json();
73
72
  },
74
73
  async inProgressMetric() {
75
- const a = await fetch(`${g()}${t}/inprogress/metric`, {
74
+ const r = await fetch(`${y()}${t}/inprogress/metric`, {
76
75
  method: "GET",
77
- headers: m()
76
+ headers: g()
78
77
  });
79
- if (!a.ok)
80
- throw new Error(`Failed to get in-progress activity metrics: ${a.statusText}`);
81
- return a.json();
78
+ if (!r.ok)
79
+ throw new Error(`Failed to get in-progress activity metrics: ${r.statusText}`);
80
+ return r.json();
82
81
  },
83
82
  async completedMetric() {
84
- const a = await fetch(`${g()}${t}/completed/metric`, {
83
+ const r = await fetch(`${y()}${t}/completed/metric`, {
85
84
  method: "GET",
86
- headers: m()
85
+ headers: g()
87
86
  });
88
- if (!a.ok)
89
- throw new Error(`Failed to get completed activity metrics: ${a.statusText}`);
90
- return a.json();
87
+ if (!r.ok)
88
+ throw new Error(`Failed to get completed activity metrics: ${r.statusText}`);
89
+ return r.json();
91
90
  },
92
91
  // ── Instance-level ────────────────────────────────────────
93
- async read(a) {
94
- const s = await fetch(`${g()}${t}/${a}/read`, {
92
+ async read(r) {
93
+ const s = await fetch(`${y()}${t}/${r}/read`, {
95
94
  method: "GET",
96
- headers: m()
95
+ headers: g()
97
96
  });
98
97
  if (!s.ok)
99
98
  throw new Error(`Failed to read activity: ${s.statusText}`);
100
99
  return (await s.json()).Data;
101
100
  },
102
- async update(a, s) {
103
- const r = await fetch(`${g()}${t}/${a}/update`, {
101
+ async update(r, s) {
102
+ const a = await fetch(`${y()}${t}/${r}/update`, {
104
103
  method: "POST",
105
- headers: m(),
104
+ headers: g(),
106
105
  body: JSON.stringify(s)
107
106
  });
108
- if (!r.ok)
109
- throw new Error(`Failed to update activity: ${r.statusText}`);
110
- return r.json();
107
+ if (!a.ok)
108
+ throw new Error(`Failed to update activity: ${a.statusText}`);
109
+ return a.json();
111
110
  },
112
- async draftStart(a, s) {
113
- const r = await fetch(`${g()}${t}/${a}/draft`, {
111
+ async draftStart(r, s) {
112
+ const a = await fetch(`${y()}${t}/${r}/draft`, {
114
113
  method: "PATCH",
115
- headers: m(),
114
+ headers: g(),
116
115
  body: JSON.stringify(s)
117
116
  });
118
- if (!r.ok)
119
- throw new Error(`Failed to start draft: ${r.statusText}`);
120
- return r.json();
117
+ if (!a.ok)
118
+ throw new Error(`Failed to start draft: ${a.statusText}`);
119
+ return a.json();
121
120
  },
122
- async draftEnd(a, s) {
123
- const r = await fetch(`${g()}${t}/${a}/draft`, {
121
+ async draftEnd(r, s) {
122
+ const a = await fetch(`${y()}${t}/${r}/draft`, {
124
123
  method: "POST",
125
- headers: m(),
124
+ headers: g(),
126
125
  body: JSON.stringify(s)
127
126
  });
128
- if (!r.ok)
129
- throw new Error(`Failed to end draft: ${r.statusText}`);
130
- return r.json();
127
+ if (!a.ok)
128
+ throw new Error(`Failed to end draft: ${a.statusText}`);
129
+ return a.json();
131
130
  },
132
- async complete(a) {
133
- const s = await fetch(`${g()}${t}/${a}/done`, {
131
+ async complete(r) {
132
+ const s = await fetch(`${y()}${t}/${r}/done`, {
134
133
  method: "POST",
135
- headers: m()
134
+ headers: g()
136
135
  });
137
136
  if (!s.ok)
138
137
  throw new Error(`Failed to complete activity: ${s.statusText}`);
139
138
  return s.json();
140
139
  },
141
- async progress(a) {
142
- const s = await fetch(`${g()}${t}/${a}/progress`, {
140
+ async progress(r) {
141
+ const s = await fetch(`${y()}${t}/${r}/progress`, {
143
142
  method: "GET",
144
- headers: m()
143
+ headers: g()
145
144
  });
146
145
  if (!s.ok)
147
146
  throw new Error(`Failed to get activity progress: ${s.statusText}`);
@@ -150,14 +149,14 @@ class z {
150
149
  };
151
150
  }
152
151
  }
153
- class X {
154
- constructor(e, t, a, s) {
155
- p(this, "_id");
156
- p(this, "_data");
157
- p(this, "_ops");
158
- p(this, "_fields");
159
- p(this, "_accessorCache", /* @__PURE__ */ new Map());
160
- this._ops = e, this._id = t, this._data = { ...a }, this._fields = s;
152
+ class Q {
153
+ constructor(e, t, r, s) {
154
+ b(this, "_id");
155
+ b(this, "_data");
156
+ b(this, "_ops");
157
+ b(this, "_fields");
158
+ b(this, "_accessorCache", /* @__PURE__ */ new Map());
159
+ this._ops = e, this._id = t, this._data = { ...r }, this._fields = s;
161
160
  }
162
161
  // ============================================================
163
162
  // BDO ITEM METHODS
@@ -173,9 +172,9 @@ class X {
173
172
  */
174
173
  validate() {
175
174
  const e = [];
176
- for (const [t, a] of Object.entries(this._fields)) {
177
- const s = this._data[t], r = a.validate(s);
178
- r.valid || e.push(...r.errors);
175
+ for (const [t, r] of Object.entries(this._fields)) {
176
+ const s = this._data[t], a = r.validate(s);
177
+ a.valid || e.push(...a.errors);
179
178
  }
180
179
  return {
181
180
  valid: e.length === 0,
@@ -216,51 +215,51 @@ class X {
216
215
  _getAccessor(e) {
217
216
  if (this._accessorCache.has(e))
218
217
  return this._accessorCache.get(e);
219
- const t = this._fields[e], a = (t == null ? void 0 : t.meta) ?? {
218
+ const t = this._fields[e], r = (t == null ? void 0 : t.meta) ?? {
220
219
  _id: e,
221
220
  Name: e,
222
221
  Type: "String"
223
- }, s = (t == null ? void 0 : t.readOnly) ?? !1, r = () => t ? t.validate(this._data[e]) : { valid: !0, errors: [] };
222
+ }, s = (t == null ? void 0 : t.readOnly) ?? !1, a = () => t ? t.validate(this._data[e]) : { valid: !0, errors: [] };
224
223
  let i;
225
224
  return s ? i = {
226
225
  label: (t == null ? void 0 : t.label) ?? e,
227
226
  required: (t == null ? void 0 : t.required) ?? !1,
228
227
  readOnly: !0,
229
228
  defaultValue: t == null ? void 0 : t.defaultValue,
230
- meta: a,
229
+ meta: r,
231
230
  get: () => this._data[e],
232
- validate: r
231
+ validate: a
233
232
  } : i = {
234
233
  label: (t == null ? void 0 : t.label) ?? e,
235
234
  required: (t == null ? void 0 : t.required) ?? !1,
236
235
  readOnly: !1,
237
236
  defaultValue: t == null ? void 0 : t.defaultValue,
238
- meta: a,
237
+ meta: r,
239
238
  get: () => this._data[e],
240
- set: (d) => {
241
- this._data[e] = d;
239
+ set: (f) => {
240
+ this._data[e] = f;
242
241
  },
243
- validate: r
242
+ validate: a
244
243
  }, this._accessorCache.set(e, i), i;
245
244
  }
246
245
  }
247
- function Y(o, e, t, a) {
248
- const s = new X(
246
+ function X(o, e, t, r) {
247
+ const s = new Q(
249
248
  o,
250
249
  e,
251
250
  t,
252
- a
251
+ r
253
252
  );
254
253
  return new Proxy(s, {
255
- get(r, i, d) {
256
- 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);
254
+ get(a, i, f) {
255
+ 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(a, i, f) : i === "_id" ? a._id : a._getAccessor(i);
257
256
  },
258
- has(r, i) {
259
- return typeof i == "symbol" ? !1 : i === "validate" || i === "toJSON" || i === "update" || i === "save" || i === "complete" || i === "progress" || i === "_id" ? !0 : i in r._fields;
257
+ has(a, i) {
258
+ return typeof i == "symbol" ? !1 : i === "validate" || i === "toJSON" || i === "update" || i === "save" || i === "complete" || i === "progress" || i === "_id" ? !0 : i in a._fields;
260
259
  },
261
- ownKeys(r) {
260
+ ownKeys(a) {
262
261
  return [
263
- ...Object.keys(r._fields),
262
+ ...Object.keys(a._fields),
264
263
  "_id",
265
264
  "validate",
266
265
  "toJSON",
@@ -270,7 +269,7 @@ function Y(o, e, t, a) {
270
269
  "progress"
271
270
  ];
272
271
  },
273
- getOwnPropertyDescriptor(r, i) {
272
+ getOwnPropertyDescriptor(a, i) {
274
273
  if (typeof i != "symbol")
275
274
  return {
276
275
  configurable: !0,
@@ -279,12 +278,12 @@ function Y(o, e, t, a) {
279
278
  }
280
279
  });
281
280
  }
282
- class ut {
281
+ class ot {
283
282
  constructor() {
284
283
  // ============================================================
285
284
  // FIELD DISCOVERY (internal)
286
285
  // ============================================================
287
- p(this, "_fieldsCache", null);
286
+ b(this, "_fieldsCache", null);
288
287
  }
289
288
  // ============================================================
290
289
  // ACTIVITY OPERATIONS (internal)
@@ -304,8 +303,8 @@ class ut {
304
303
  if (this._fieldsCache) return this._fieldsCache;
305
304
  const e = {};
306
305
  for (const t of Object.keys(this)) {
307
- const a = this[t];
308
- a instanceof Q && (e[t] = a);
306
+ const r = this[t];
307
+ r instanceof K && (e[t] = r);
309
308
  }
310
309
  return this._fieldsCache = e, e;
311
310
  }
@@ -345,11 +344,11 @@ class ut {
345
344
  * @returns ActivityInstance with typed field accessors
346
345
  */
347
346
  async getInstance(e) {
348
- const t = this._ops(), a = await t.read(e), s = this._discoverFields();
349
- return Y(
347
+ const t = this._ops(), r = await t.read(e), s = this._discoverFields();
348
+ return X(
350
349
  t,
351
350
  e,
352
- a,
351
+ r,
353
352
  s
354
353
  );
355
354
  }
@@ -371,72 +370,72 @@ class ut {
371
370
  return this._ops();
372
371
  }
373
372
  }
374
- function Z(o) {
375
- return async (e, t, a) => {
376
- const s = {}, r = o._getFields(), i = (a == null ? void 0 : a.names) ?? Object.keys(r);
377
- for (const d of i) {
378
- const _ = r[d];
379
- if (!_ || _.readOnly) continue;
380
- const V = e[d], w = _.validate(V);
381
- !w.valid && w.errors.length > 0 && (s[d] = {
373
+ function Y(o) {
374
+ return async (e, t, r) => {
375
+ const s = {}, a = o._getFields(), i = (r == null ? void 0 : r.names) ?? Object.keys(a);
376
+ for (const f of i) {
377
+ const w = a[f];
378
+ if (!w || w.readOnly) continue;
379
+ const S = e[f], $ = w.validate(S);
380
+ !$.valid && $.errors.length > 0 && (s[f] = {
382
381
  type: "validate",
383
- message: w.errors[0] || `${d} is invalid`
382
+ message: $.errors[0] || `${f} is invalid`
384
383
  });
385
384
  }
386
385
  return Object.keys(s).length === 0 ? { values: e, errors: {} } : { values: {}, errors: s };
387
386
  };
388
387
  }
389
- function tt(o, e) {
388
+ function Z(o, e) {
390
389
  const t = o._getFields();
391
390
  return new Proxy(
392
391
  {},
393
392
  {
394
- get(a, s) {
393
+ get(r, s) {
395
394
  if (typeof s == "symbol")
396
395
  return;
397
396
  if (s === "toJSON")
398
397
  return () => e.getValues();
399
398
  if (s === "validate")
400
399
  return () => e.trigger();
401
- const r = t[s], i = (r == null ? void 0 : r.meta) ?? {
400
+ const a = t[s], i = (a == null ? void 0 : a.meta) ?? {
402
401
  _id: s,
403
402
  Name: s,
404
403
  Type: "String"
405
- }, d = (r == null ? void 0 : r.readOnly) ?? !1, _ = () => r ? r.validate(e.getValues(s)) : { valid: !0, errors: [] };
406
- return d ? {
407
- label: (r == null ? void 0 : r.label) ?? s,
408
- required: (r == null ? void 0 : r.required) ?? !1,
404
+ }, f = (a == null ? void 0 : a.readOnly) ?? !1, w = () => a ? a.validate(e.getValues(s)) : { valid: !0, errors: [] };
405
+ return f ? {
406
+ label: (a == null ? void 0 : a.label) ?? s,
407
+ required: (a == null ? void 0 : a.required) ?? !1,
409
408
  readOnly: !0,
410
- defaultValue: r == null ? void 0 : r.defaultValue,
409
+ defaultValue: a == null ? void 0 : a.defaultValue,
411
410
  meta: i,
412
411
  get: () => e.getValues(s),
413
- getOrDefault: (w) => e.getValues(s) ?? w,
414
- validate: _
412
+ getOrDefault: ($) => e.getValues(s) ?? $,
413
+ validate: w
415
414
  } : {
416
- label: (r == null ? void 0 : r.label) ?? s,
417
- required: (r == null ? void 0 : r.required) ?? !1,
415
+ label: (a == null ? void 0 : a.label) ?? s,
416
+ required: (a == null ? void 0 : a.required) ?? !1,
418
417
  readOnly: !1,
419
- defaultValue: r == null ? void 0 : r.defaultValue,
418
+ defaultValue: a == null ? void 0 : a.defaultValue,
420
419
  meta: i,
421
420
  get: () => e.getValues(s),
422
- getOrDefault: (v) => e.getValues(s) ?? v,
423
- set: (v) => {
424
- e.setValue(s, v, {
421
+ getOrDefault: (O) => e.getValues(s) ?? O,
422
+ set: (O) => {
423
+ e.setValue(s, O, {
425
424
  shouldDirty: !0,
426
425
  shouldTouch: !0,
427
426
  shouldValidate: !1
428
427
  });
429
428
  },
430
- validate: _
429
+ validate: w
431
430
  };
432
431
  },
433
- has(a, s) {
432
+ has(r, s) {
434
433
  return typeof s == "symbol" ? !1 : s === "toJSON" || s === "validate" ? !0 : s in t;
435
434
  },
436
- ownKeys(a) {
435
+ ownKeys(r) {
437
436
  return [...Object.keys(t), "toJSON", "validate"];
438
437
  },
439
- getOwnPropertyDescriptor(a, s) {
438
+ getOwnPropertyDescriptor(r, s) {
440
439
  if (typeof s != "symbol")
441
440
  return {
442
441
  configurable: !0,
@@ -446,66 +445,66 @@ function tt(o, e) {
446
445
  }
447
446
  );
448
447
  }
449
- function dt(o, e) {
448
+ function ct(o, e) {
450
449
  const {
451
450
  activity_instance_id: t,
452
- defaultValues: a = {},
451
+ defaultValues: r = {},
453
452
  mode: s = "onBlur",
454
- enabled: r = !0
455
- } = e, [i, d] = L(!1), [_, V] = L(null), [w, v] = L(!1), T = A(!1), E = A(null), j = P(
453
+ enabled: a = !0
454
+ } = e, [i, f] = k(!1), [w, S] = k(null), [$, O] = k(!1), x = A(!1), N = A(null), T = p(
456
455
  () => o._getFields(),
457
456
  [o]
458
- ), S = P(
459
- () => Object.keys(j).filter(
460
- (u) => j[u].readOnly
457
+ ), V = p(
458
+ () => Object.keys(T).filter(
459
+ (u) => T[u].readOnly
461
460
  ),
462
- [j]
463
- ), N = P(
464
- () => Z(o),
461
+ [T]
462
+ ), B = p(
463
+ () => Y(o),
465
464
  [o]
466
465
  ), n = W({
467
466
  mode: s,
468
- defaultValues: a,
469
- resolver: N
470
- }), k = P(
471
- () => tt(o, n),
467
+ defaultValues: r,
468
+ resolver: B
469
+ }), F = p(
470
+ () => Z(o, n),
472
471
  [o, n]
473
- ), $ = P(
472
+ ), v = p(
474
473
  () => o._getOps(),
475
474
  [o]
476
475
  );
477
476
  U(() => {
478
- if (!r) return;
477
+ if (!a) return;
479
478
  let u = !0;
480
479
  return (async () => {
481
- d(!0), V(null);
480
+ f(!0), S(null);
482
481
  try {
483
- const l = await $.read(t);
482
+ const l = await v.read(t);
484
483
  if (!u) return;
485
- l && typeof l == "object" && n.reset({ ...a, ...l });
484
+ l && typeof l == "object" && n.reset({ ...r, ...l });
486
485
  } catch (l) {
487
486
  if (!u) return;
488
- console.error("Failed to read activity data:", l), V(x(l));
487
+ console.error("Failed to read activity data:", l), S(C(l));
489
488
  } finally {
490
- u && d(!1);
489
+ u && f(!1);
491
490
  }
492
491
  })(), () => {
493
492
  u = !1;
494
493
  };
495
- }, [r, $, t]);
496
- const f = C(
494
+ }, [a, v, t]);
495
+ const E = j(
497
496
  async (u) => {
498
- S.length !== 0 && (T.current || (E.current && clearTimeout(E.current), E.current = setTimeout(async () => {
499
- if (!T.current) {
500
- T.current = !0;
497
+ V.length !== 0 && (x.current || (N.current && clearTimeout(N.current), N.current = setTimeout(async () => {
498
+ if (!x.current) {
499
+ x.current = !0;
501
500
  try {
502
- const c = n.getValues(), l = {}, h = new Set(S);
503
- Object.keys(c).forEach((b) => {
504
- h.has(b) || (l[b] = c[b]);
501
+ const c = n.getValues(), l = {}, d = new Set(V);
502
+ Object.keys(c).forEach((m) => {
503
+ d.has(m) || (l[m] = c[m]);
505
504
  });
506
- const y = await $.draftStart(t, l);
507
- y && typeof y == "object" && Object.entries(y).forEach(([b, O]) => {
508
- h.has(b) && n.getValues(b) !== O && n.setValue(b, O, {
505
+ const h = await v.draftStart(t, l);
506
+ h && typeof h == "object" && Object.entries(h).forEach(([m, _]) => {
507
+ d.has(m) && n.getValues(m) !== _ && n.setValue(m, _, {
509
508
  shouldDirty: !1,
510
509
  shouldValidate: !1
511
510
  });
@@ -513,75 +512,75 @@ function dt(o, e) {
513
512
  } catch (c) {
514
513
  console.warn("Draft computation failed:", c);
515
514
  } finally {
516
- T.current = !1;
515
+ x.current = !1;
517
516
  }
518
517
  }
519
518
  }, 300)));
520
519
  },
521
- [$, S, n]
522
- ), D = C(
520
+ [v, V, n]
521
+ ), R = j(
523
522
  (u, c) => {
524
- const l = j[u], h = l ? l.readOnly : !1, y = c == null ? void 0 : c.onBlur, b = async (q) => {
525
- y && await y(q);
526
- let F = !0;
527
- s === "onBlur" || s === "onTouched" || s === "all" ? F = await n.trigger(u) : F = !n.getFieldState(u, n.formState).error, F && await f(u);
528
- }, O = n.register(u, {
523
+ const l = T[u], d = l ? l.readOnly : !1, h = c == null ? void 0 : c.onBlur, m = async (J) => {
524
+ h && await h(J);
525
+ let P = !0;
526
+ s === "onBlur" || s === "onTouched" || s === "all" ? P = await n.trigger(u) : P = !n.getFieldState(u, n.formState).error, P && await E(u);
527
+ }, _ = n.register(u, {
529
528
  ...c,
530
- onBlur: b,
531
- ...h ? { disabled: !0 } : {}
529
+ onBlur: m,
530
+ ...d ? { disabled: !0 } : {}
532
531
  });
533
- return h ? { ...O, disabled: !0 } : O;
532
+ return d ? { ..._, disabled: !0 } : _;
534
533
  },
535
- [n, j, f, s]
536
- ), J = C(
534
+ [n, T, E, s]
535
+ ), D = j(
537
536
  (u, c) => n.handleSubmit(
538
- async (l, h) => {
539
- v(!0);
537
+ async (l, d) => {
538
+ O(!0);
540
539
  try {
541
- const y = {}, b = new Set(S);
542
- Object.keys(l).forEach((O) => {
543
- !b.has(O) && l[O] !== void 0 && (y[O] = l[O]);
544
- }), await $.update(t, y), await $.draftEnd(t, y), await (u == null ? void 0 : u(l, h));
545
- } catch (y) {
546
- c == null || c(x(y), h);
540
+ const h = {}, m = new Set(V);
541
+ Object.keys(l).forEach((_) => {
542
+ !m.has(_) && l[_] !== void 0 && (h[_] = l[_]);
543
+ }), await v.update(t, h), await v.draftEnd(t, h), await (u == null ? void 0 : u(l, d));
544
+ } catch (h) {
545
+ c == null || c(C(h), d);
547
546
  } finally {
548
- v(!1);
547
+ O(!1);
549
548
  }
550
549
  },
551
- (l, h) => {
552
- c == null || c(l, h);
550
+ (l, d) => {
551
+ c == null || c(l, d);
553
552
  }
554
553
  ),
555
- [n, $, S]
556
- ), B = C(
554
+ [n, v, V]
555
+ ), L = j(
557
556
  (u, c) => n.handleSubmit(
558
- async (l, h) => {
559
- v(!0);
557
+ async (l, d) => {
558
+ O(!0);
560
559
  try {
561
- await $.complete(t), await (u == null ? void 0 : u(l, h));
562
- } catch (y) {
563
- c == null || c(x(y), h);
560
+ await v.complete(t), await (u == null ? void 0 : u(l, d));
561
+ } catch (h) {
562
+ c == null || c(C(h), d);
564
563
  } finally {
565
- v(!1);
564
+ O(!1);
566
565
  }
567
566
  },
568
- (l, h) => {
569
- c == null || c(l, h);
567
+ (l, d) => {
568
+ c == null || c(l, d);
570
569
  }
571
570
  ),
572
- [n, $]
573
- ), G = C(() => {
571
+ [n, v]
572
+ ), M = j(() => {
574
573
  n.clearErrors();
575
- }, [n]), I = !!_;
574
+ }, [n]), q = !!w;
576
575
  return {
577
576
  // Item proxy
578
- item: k,
577
+ item: F,
579
578
  // Activity reference
580
579
  activity: o,
581
580
  // Form methods
582
- register: D,
583
- handleSubmit: J,
584
- handleComplete: B,
581
+ register: R,
582
+ handleSubmit: D,
583
+ handleComplete: L,
585
584
  watch: n.watch,
586
585
  setValue: n.setValue,
587
586
  getValues: n.getValues,
@@ -592,88 +591,19 @@ function dt(o, e) {
592
591
  errors: n.formState.errors,
593
592
  isValid: n.formState.isValid,
594
593
  isDirty: n.formState.isDirty,
595
- isSubmitting: n.formState.isSubmitting || w,
594
+ isSubmitting: n.formState.isSubmitting || $,
596
595
  isSubmitSuccessful: n.formState.isSubmitSuccessful,
597
596
  // Loading
598
597
  isLoading: i,
599
- loadError: _,
600
- hasError: I,
598
+ loadError: w,
599
+ hasError: q,
601
600
  // Operations
602
- clearErrors: G
603
- };
604
- }
605
- const R = {
606
- InProgress: "inprogress",
607
- Completed: "completed"
608
- };
609
- function ft(o, e) {
610
- const { status: t, onError: a, onSuccess: s } = e, { businessProcessId: r, activityId: i } = o.meta, {
611
- data: d,
612
- isLoading: _,
613
- isFetching: V,
614
- error: w,
615
- refetch: v
616
- } = M({
617
- queryKey: ["activity-table", r, i, t],
618
- queryFn: async () => {
619
- try {
620
- const f = t === R.InProgress ? await o.getInProgressList() : await o.getCompletedList();
621
- return s && s(f.Data), f;
622
- } catch (f) {
623
- throw a && a(x(f)), f;
624
- }
625
- },
626
- staleTime: 0,
627
- gcTime: 30 * 1e3
628
- }), {
629
- data: T,
630
- isLoading: E,
631
- isFetching: j,
632
- error: S,
633
- refetch: N
634
- } = M({
635
- queryKey: [
636
- "activity-table-count",
637
- r,
638
- i,
639
- t
640
- ],
641
- queryFn: async () => {
642
- try {
643
- return t === R.InProgress ? await o.inProgressMetrics() : await o.completedMetrics();
644
- } catch (f) {
645
- throw a && a(x(f)), f;
646
- }
647
- },
648
- staleTime: 0,
649
- gcTime: 30 * 1e3
650
- }), n = P(
651
- () => (d == null ? void 0 : d.Data) || [],
652
- [d]
653
- ), k = P(
654
- () => {
655
- var f;
656
- return ((f = T == null ? void 0 : T.Data[0]) == null ? void 0 : f.count__id) ?? 0;
657
- },
658
- [T]
659
- ), $ = C(async () => {
660
- const [f] = await Promise.all([v(), N()]);
661
- return f.data || { Data: [] };
662
- }, [v, N]);
663
- return {
664
- rows: n,
665
- totalItems: k,
666
- isLoading: _ || E,
667
- isFetching: V || j,
668
- error: w ? x(w) : S ? x(S) : null,
669
- refetch: $
601
+ clearErrors: M
670
602
  };
671
603
  }
672
604
  export {
673
- ut as Activity,
674
- X as ActivityInstance,
675
- R as ActivityTableStatus,
605
+ ot as Activity,
606
+ Q as ActivityInstance,
676
607
  z as Workflow,
677
- dt as useActivityForm,
678
- ft as useActivityTable
608
+ ct as useActivityForm
679
609
  };