@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.
- package/README.md +8 -16
- package/dist/{FileField-CZjS2uLh.js → FileField-BWrSHNRq.js} +3 -3
- package/dist/{FileField-DU4UWo_t.cjs → FileField-eDeuzln8.cjs} +1 -1
- package/dist/api.cjs +1 -1
- package/dist/api.mjs +1 -1
- package/dist/auth/authConfig.d.ts +1 -1
- package/dist/auth/types.d.ts +1 -1
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth.cjs +1 -1
- package/dist/auth.mjs +1 -1
- package/dist/bdo/core/Item.d.ts +4 -0
- package/dist/bdo/core/Item.d.ts.map +1 -1
- package/dist/bdo/fields/ReferenceField.d.ts +1 -1
- package/dist/bdo/fields/ReferenceField.d.ts.map +1 -1
- package/dist/bdo/fields/SelectField.d.ts +1 -1
- package/dist/bdo/fields/SelectField.d.ts.map +1 -1
- package/dist/bdo/fields/UserField.d.ts +1 -1
- package/dist/bdo/fields/UserField.d.ts.map +1 -1
- package/dist/bdo.cjs +1 -1
- package/dist/bdo.mjs +62 -53
- package/dist/components/hooks/useActivityForm/types.d.ts +5 -4
- package/dist/components/hooks/useActivityForm/types.d.ts.map +1 -1
- package/dist/components/hooks/useActivityForm/useActivityForm.d.ts.map +1 -1
- package/dist/components/hooks/useActivityTable/types.d.ts +4 -5
- package/dist/components/hooks/useActivityTable/types.d.ts.map +1 -1
- package/dist/components/hooks/useActivityTable/useActivityTable.d.ts.map +1 -1
- package/dist/components/hooks/useBDOForm/createItemProxy.d.ts +3 -2
- package/dist/components/hooks/useBDOForm/createItemProxy.d.ts.map +1 -1
- package/dist/components/hooks/useBDOTable/types.d.ts +12 -20
- package/dist/components/hooks/useBDOTable/types.d.ts.map +1 -1
- package/dist/components/hooks/useBDOTable/useBDOTable.d.ts +2 -2
- package/dist/components/hooks/useBDOTable/useBDOTable.d.ts.map +1 -1
- package/dist/{constants-Cyi942Yr.js → constants-ConHc1oS.js} +5 -5
- package/dist/constants-QX2RX-wu.cjs +1 -0
- package/dist/filter.cjs +1 -1
- package/dist/filter.mjs +1 -1
- package/dist/form.cjs +1 -1
- package/dist/form.mjs +243 -226
- package/dist/table.cjs +1 -1
- package/dist/table.mjs +16 -15
- package/dist/table.types.d.ts +1 -1
- package/dist/table.types.d.ts.map +1 -1
- package/dist/types/constants.d.ts +1 -1
- package/dist/workflow/Activity.d.ts +5 -8
- package/dist/workflow/Activity.d.ts.map +1 -1
- package/dist/workflow.cjs +1 -1
- package/dist/workflow.mjs +476 -461
- package/docs/api.md +95 -0
- package/docs/bdo.md +224 -0
- package/docs/gaps.md +360 -0
- package/docs/useActivityForm.md +393 -0
- package/docs/useActivityTable.md +418 -0
- package/docs/useBDOForm.md +498 -0
- package/docs/useBDOTable.md +284 -0
- package/docs/useFilter.md +188 -0
- package/docs/workflow.md +560 -0
- package/package.json +14 -15
- package/sdk/auth/authConfig.ts +1 -1
- package/sdk/auth/types.ts +1 -1
- package/sdk/bdo/core/Item.ts +10 -1
- package/sdk/bdo/fields/ReferenceField.ts +1 -1
- package/sdk/bdo/fields/SelectField.ts +1 -1
- package/sdk/bdo/fields/UserField.ts +1 -1
- package/sdk/components/hooks/useActivityForm/types.ts +6 -4
- package/sdk/components/hooks/useActivityForm/useActivityForm.ts +73 -10
- package/sdk/components/hooks/useActivityTable/types.ts +5 -4
- package/sdk/components/hooks/useActivityTable/useActivityTable.ts +8 -10
- package/sdk/components/hooks/useBDOForm/createItemProxy.ts +58 -17
- package/sdk/components/hooks/useBDOTable/types.ts +10 -20
- package/sdk/components/hooks/useBDOTable/useBDOTable.ts +8 -12
- package/sdk/table.types.ts +0 -2
- package/sdk/types/constants.ts +1 -1
- package/sdk/workflow/Activity.ts +7 -39
- package/dist/constants-DEmYwKfC.cjs +0 -1
- package/docs/README.md +0 -57
- package/docs/bdo/README.md +0 -161
- package/docs/bdo/api_reference.md +0 -281
- package/docs/examples/bdo/create-product.md +0 -69
- package/docs/examples/bdo/edit-product-dialog.md +0 -95
- package/docs/examples/bdo/filtered-product-table.md +0 -100
- package/docs/examples/bdo/product-listing.md +0 -73
- package/docs/examples/bdo/supplier-dropdown.md +0 -60
- package/docs/examples/fields/complex-fields.md +0 -248
- package/docs/examples/fields/primitive-fields.md +0 -217
- package/docs/examples/workflow/approve-leave-request.md +0 -76
- package/docs/examples/workflow/filtered-activity-table.md +0 -101
- package/docs/examples/workflow/my-pending-requests.md +0 -90
- package/docs/examples/workflow/start-new-workflow.md +0 -47
- package/docs/examples/workflow/submit-leave-request.md +0 -72
- package/docs/examples/workflow/workflow-progress.md +0 -49
- package/docs/fields/README.md +0 -141
- package/docs/fields/api_reference.md +0 -134
- package/docs/useActivityForm/README.md +0 -244
- package/docs/useActivityForm/api_reference.md +0 -279
- package/docs/useActivityTable/README.md +0 -263
- package/docs/useActivityTable/api_reference.md +0 -294
- package/docs/useBDOForm/README.md +0 -175
- package/docs/useBDOForm/api_reference.md +0 -244
- package/docs/useBDOTable/README.md +0 -242
- package/docs/useBDOTable/api_reference.md +0 -253
- package/docs/useFilter/README.md +0 -323
- package/docs/useFilter/api_reference.md +0 -228
- package/docs/workflow/README.md +0 -158
- package/docs/workflow/api_reference.md +0 -161
- /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
|
|
4
|
-
import { c as
|
|
5
|
-
import { B as ue, c as de, S as
|
|
6
|
-
import { useState as
|
|
7
|
-
import { v as
|
|
8
|
-
import { useQuery as
|
|
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
|
|
11
|
-
import { g as
|
|
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
|
-
|
|
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
|
-
`${
|
|
22
|
+
`${S()}/api/app/process/${this.bp_id}/start`,
|
|
23
23
|
{
|
|
24
24
|
method: "POST",
|
|
25
|
-
headers:
|
|
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
|
-
`${
|
|
40
|
+
`${S()}/api/app/process/${this.bp_id}/${t}/progress`,
|
|
41
41
|
{
|
|
42
42
|
method: "GET",
|
|
43
|
-
headers:
|
|
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(
|
|
59
|
-
const
|
|
58
|
+
async inProgressList(a) {
|
|
59
|
+
const n = await fetch(`${S()}${e}/inprogress/list`, {
|
|
60
60
|
method: "POST",
|
|
61
|
-
headers:
|
|
62
|
-
body:
|
|
61
|
+
headers: $(),
|
|
62
|
+
body: a ? JSON.stringify(a) : void 0
|
|
63
63
|
});
|
|
64
|
-
if (!
|
|
65
|
-
throw new Error(`Failed to list in-progress activities: ${
|
|
66
|
-
return
|
|
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(
|
|
69
|
-
const
|
|
68
|
+
async completedList(a) {
|
|
69
|
+
const n = await fetch(`${S()}${e}/completed/list`, {
|
|
70
70
|
method: "POST",
|
|
71
|
-
headers:
|
|
72
|
-
body:
|
|
71
|
+
headers: $(),
|
|
72
|
+
body: a ? JSON.stringify(a) : void 0
|
|
73
73
|
});
|
|
74
|
-
if (!
|
|
75
|
-
throw new Error(`Failed to list completed activities: ${
|
|
76
|
-
return
|
|
74
|
+
if (!n.ok)
|
|
75
|
+
throw new Error(`Failed to list completed activities: ${n.statusText}`);
|
|
76
|
+
return n.json();
|
|
77
77
|
},
|
|
78
|
-
async inProgressCount(
|
|
79
|
-
var
|
|
80
|
-
const
|
|
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
|
-
...(
|
|
85
|
-
},
|
|
84
|
+
...(a == null ? void 0 : a.Filter) && { Filter: a.Filter }
|
|
85
|
+
}, i = await fetch(`${S()}${e}/inprogress/metric`, {
|
|
86
86
|
method: "POST",
|
|
87
|
-
headers:
|
|
88
|
-
body: JSON.stringify(
|
|
87
|
+
headers: $(),
|
|
88
|
+
body: JSON.stringify(n)
|
|
89
89
|
});
|
|
90
|
-
if (!
|
|
91
|
-
throw new Error(`Failed to get in-progress count: ${
|
|
92
|
-
return { Count: ((
|
|
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(
|
|
95
|
-
var
|
|
96
|
-
const
|
|
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
|
-
...(
|
|
101
|
-
},
|
|
100
|
+
...(a == null ? void 0 : a.Filter) && { Filter: a.Filter }
|
|
101
|
+
}, i = await fetch(`${S()}${e}/completed/metric`, {
|
|
102
102
|
method: "POST",
|
|
103
|
-
headers:
|
|
104
|
-
body: JSON.stringify(
|
|
103
|
+
headers: $(),
|
|
104
|
+
body: JSON.stringify(n)
|
|
105
105
|
});
|
|
106
|
-
if (!
|
|
107
|
-
throw new Error(`Failed to get completed count: ${
|
|
108
|
-
return { Count: ((
|
|
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(
|
|
111
|
-
const
|
|
110
|
+
async inProgressMetric(a) {
|
|
111
|
+
const n = { Type: "Metric", ...a }, i = await fetch(`${S()}${e}/inprogress/metric`, {
|
|
112
112
|
method: "POST",
|
|
113
|
-
headers:
|
|
114
|
-
body: JSON.stringify(
|
|
113
|
+
headers: $(),
|
|
114
|
+
body: JSON.stringify(n)
|
|
115
115
|
});
|
|
116
|
-
if (!
|
|
117
|
-
throw new Error(`Failed to get in-progress metrics: ${
|
|
118
|
-
return
|
|
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(
|
|
121
|
-
const
|
|
120
|
+
async completedMetric(a) {
|
|
121
|
+
const n = { Type: "Metric", ...a }, i = await fetch(`${S()}${e}/completed/metric`, {
|
|
122
122
|
method: "POST",
|
|
123
|
-
headers:
|
|
124
|
-
body: JSON.stringify(
|
|
123
|
+
headers: $(),
|
|
124
|
+
body: JSON.stringify(n)
|
|
125
125
|
});
|
|
126
|
-
if (!
|
|
127
|
-
throw new Error(`Failed to get completed metrics: ${
|
|
128
|
-
return
|
|
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(
|
|
132
|
-
const
|
|
131
|
+
async read(a) {
|
|
132
|
+
const n = await fetch(`${S()}${e}/${a}/read`, {
|
|
133
133
|
method: "GET",
|
|
134
|
-
headers:
|
|
134
|
+
headers: $()
|
|
135
135
|
});
|
|
136
|
-
if (!
|
|
137
|
-
throw new Error(`Failed to read activity: ${
|
|
138
|
-
return (await
|
|
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(
|
|
141
|
-
const
|
|
140
|
+
async update(a, n) {
|
|
141
|
+
const i = await fetch(`${S()}${e}/${a}/update`, {
|
|
142
142
|
method: "POST",
|
|
143
|
-
headers:
|
|
144
|
-
body: JSON.stringify(
|
|
143
|
+
headers: $(),
|
|
144
|
+
body: JSON.stringify(n)
|
|
145
145
|
});
|
|
146
|
-
if (!
|
|
147
|
-
throw new Error(`Failed to update activity: ${
|
|
148
|
-
return
|
|
146
|
+
if (!i.ok)
|
|
147
|
+
throw new Error(`Failed to update activity: ${i.statusText}`);
|
|
148
|
+
return i.json();
|
|
149
149
|
},
|
|
150
|
-
async draftStart(
|
|
151
|
-
const
|
|
150
|
+
async draftStart(a, n) {
|
|
151
|
+
const i = await fetch(`${S()}${e}/${a}/draft`, {
|
|
152
152
|
method: "PATCH",
|
|
153
|
-
headers:
|
|
154
|
-
body: JSON.stringify(
|
|
153
|
+
headers: $(),
|
|
154
|
+
body: JSON.stringify(n)
|
|
155
155
|
});
|
|
156
|
-
if (!
|
|
157
|
-
throw new Error(`Failed to start draft: ${
|
|
158
|
-
return
|
|
156
|
+
if (!i.ok)
|
|
157
|
+
throw new Error(`Failed to start draft: ${i.statusText}`);
|
|
158
|
+
return i.json();
|
|
159
159
|
},
|
|
160
|
-
async draftEnd(
|
|
161
|
-
const
|
|
160
|
+
async draftEnd(a, n) {
|
|
161
|
+
const i = await fetch(`${S()}${e}/${a}/draft`, {
|
|
162
162
|
method: "POST",
|
|
163
|
-
headers:
|
|
164
|
-
body: JSON.stringify(
|
|
163
|
+
headers: $(),
|
|
164
|
+
body: JSON.stringify(n)
|
|
165
165
|
});
|
|
166
|
-
if (!
|
|
167
|
-
throw new Error(`Failed to end draft: ${
|
|
168
|
-
return
|
|
166
|
+
if (!i.ok)
|
|
167
|
+
throw new Error(`Failed to end draft: ${i.statusText}`);
|
|
168
|
+
return i.json();
|
|
169
169
|
},
|
|
170
|
-
async complete(
|
|
171
|
-
const
|
|
170
|
+
async complete(a) {
|
|
171
|
+
const n = await fetch(`${S()}${e}/${a}/done`, {
|
|
172
172
|
method: "POST",
|
|
173
|
-
headers:
|
|
173
|
+
headers: $()
|
|
174
174
|
});
|
|
175
|
-
if (!
|
|
176
|
-
throw new Error(`Failed to complete activity: ${
|
|
177
|
-
return
|
|
175
|
+
if (!n.ok)
|
|
176
|
+
throw new Error(`Failed to complete activity: ${n.statusText}`);
|
|
177
|
+
return n.json();
|
|
178
178
|
},
|
|
179
|
-
async progress(
|
|
180
|
-
const
|
|
179
|
+
async progress(a) {
|
|
180
|
+
const n = await fetch(`${S()}${e}/${a}/progress`, {
|
|
181
181
|
method: "GET",
|
|
182
|
-
headers:
|
|
182
|
+
headers: $()
|
|
183
183
|
});
|
|
184
|
-
if (!
|
|
185
|
-
throw new Error(`Failed to get activity progress: ${
|
|
186
|
-
return
|
|
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
|
|
192
|
-
constructor(t, e,
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
this._ops = t, this._id = e, this._data = { ...
|
|
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,
|
|
215
|
-
const
|
|
216
|
-
|
|
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],
|
|
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
|
-
},
|
|
262
|
-
let
|
|
263
|
-
return
|
|
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:
|
|
268
|
+
meta: a,
|
|
269
269
|
get: () => this._data[t],
|
|
270
|
-
validate:
|
|
271
|
-
} :
|
|
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:
|
|
276
|
+
meta: a,
|
|
277
277
|
get: () => this._data[t],
|
|
278
|
-
set: (
|
|
279
|
-
this._data[t] =
|
|
278
|
+
set: (y) => {
|
|
279
|
+
this._data[t] = y;
|
|
280
280
|
},
|
|
281
|
-
validate:
|
|
282
|
-
}, this._accessorCache.set(t,
|
|
281
|
+
validate: i
|
|
282
|
+
}, this._accessorCache.set(t, r), r;
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
|
-
function
|
|
286
|
-
const
|
|
285
|
+
function Ne(o, t, e, a) {
|
|
286
|
+
const n = new ke(
|
|
287
287
|
o,
|
|
288
288
|
t,
|
|
289
289
|
e,
|
|
290
|
-
|
|
290
|
+
a
|
|
291
291
|
);
|
|
292
|
-
return new Proxy(
|
|
293
|
-
get(
|
|
294
|
-
return
|
|
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(
|
|
297
|
-
return typeof
|
|
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(
|
|
299
|
+
ownKeys(i) {
|
|
300
300
|
return [
|
|
301
|
-
...Object.keys(
|
|
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(
|
|
312
|
-
if (typeof
|
|
311
|
+
getOwnPropertyDescriptor(i, r) {
|
|
312
|
+
if (typeof r != "symbol")
|
|
313
313
|
return {
|
|
314
314
|
configurable: !0,
|
|
315
|
-
enumerable:
|
|
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
|
-
|
|
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
|
|
346
|
-
|
|
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
|
-
*
|
|
355
|
+
* Accepts optional filter/sort/pagination options.
|
|
356
356
|
*/
|
|
357
357
|
async getInProgressList(t) {
|
|
358
|
-
|
|
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
|
-
*
|
|
362
|
+
* Accepts optional filter/sort/pagination options.
|
|
366
363
|
*/
|
|
367
364
|
async getCompletedList(t) {
|
|
368
|
-
|
|
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(),
|
|
409
|
-
return
|
|
402
|
+
const e = this._ops(), a = await e.read(t), n = this._discoverFields();
|
|
403
|
+
return Ne(
|
|
410
404
|
e,
|
|
411
405
|
t,
|
|
412
|
-
|
|
413
|
-
|
|
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
|
|
435
|
-
var
|
|
436
|
-
const e = { _id: o, ...t },
|
|
437
|
-
if (
|
|
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 (
|
|
433
|
+
switch (a) {
|
|
440
434
|
case "String":
|
|
441
|
-
return new
|
|
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
|
|
453
|
+
return new Q(e);
|
|
460
454
|
}
|
|
461
455
|
}
|
|
462
|
-
function
|
|
456
|
+
function je(o) {
|
|
463
457
|
const t = {};
|
|
464
|
-
for (const [e,
|
|
465
|
-
t[e] =
|
|
458
|
+
for (const [e, a] of Object.entries(o))
|
|
459
|
+
t[e] = ee(e, a);
|
|
466
460
|
return t;
|
|
467
461
|
}
|
|
468
|
-
function
|
|
469
|
-
var
|
|
470
|
-
const
|
|
471
|
-
if (!(
|
|
472
|
-
const
|
|
473
|
-
for (const
|
|
474
|
-
if (
|
|
475
|
-
return
|
|
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
|
|
479
|
-
return async (t, e,
|
|
480
|
-
const
|
|
481
|
-
for (const
|
|
482
|
-
const
|
|
483
|
-
if (!
|
|
484
|
-
let
|
|
485
|
-
typeof
|
|
486
|
-
const l =
|
|
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
|
-
|
|
482
|
+
n[y] = {
|
|
489
483
|
type: "validate",
|
|
490
|
-
message: l.errors[0] || `${
|
|
484
|
+
message: l.errors[0] || `${y} is invalid`
|
|
491
485
|
};
|
|
492
486
|
continue;
|
|
493
487
|
}
|
|
494
|
-
const
|
|
495
|
-
|
|
496
|
-
|
|
488
|
+
const w = ve(
|
|
489
|
+
m,
|
|
490
|
+
s
|
|
497
491
|
);
|
|
498
|
-
!
|
|
492
|
+
!w.valid && w.errors.length > 0 && (n[y] = {
|
|
499
493
|
type: "constraint",
|
|
500
|
-
message:
|
|
494
|
+
message: w.errors[0]
|
|
501
495
|
});
|
|
502
496
|
}
|
|
503
|
-
return Object.keys(
|
|
497
|
+
return Object.keys(n).length === 0 ? { values: t, errors: {} } : { values: {}, errors: n };
|
|
504
498
|
};
|
|
505
499
|
}
|
|
506
|
-
function
|
|
507
|
-
const
|
|
508
|
-
function
|
|
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(
|
|
519
|
-
if (typeof
|
|
512
|
+
get(m, s) {
|
|
513
|
+
if (typeof s == "symbol")
|
|
520
514
|
return;
|
|
521
|
-
if (
|
|
515
|
+
if (s === "_id")
|
|
522
516
|
return e;
|
|
523
|
-
if (
|
|
517
|
+
if (s === "toJSON")
|
|
524
518
|
return () => t.getValues();
|
|
525
|
-
if (
|
|
519
|
+
if (s === "validate")
|
|
526
520
|
return () => t.trigger();
|
|
527
|
-
if (
|
|
528
|
-
return
|
|
529
|
-
const l = s
|
|
530
|
-
_id:
|
|
531
|
-
Name:
|
|
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
|
-
},
|
|
534
|
-
t.getValues(
|
|
535
|
-
) : { valid: !0, errors: [] },
|
|
536
|
-
const
|
|
537
|
-
return
|
|
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 (!
|
|
540
|
-
const
|
|
541
|
-
const c = t.getValues(
|
|
542
|
-
return
|
|
543
|
-
},
|
|
544
|
-
label: (l == null ? void 0 : l.label) ??
|
|
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:
|
|
550
|
-
getOrDefault:
|
|
542
|
+
meta: w,
|
|
543
|
+
get: b,
|
|
544
|
+
getOrDefault: A,
|
|
551
545
|
set: (c) => {
|
|
552
|
-
t.setValue(
|
|
546
|
+
t.setValue(s, c, {
|
|
553
547
|
shouldDirty: !0,
|
|
554
548
|
shouldTouch: !0,
|
|
555
549
|
shouldValidate: !1
|
|
556
550
|
});
|
|
557
551
|
},
|
|
558
|
-
validate:
|
|
552
|
+
validate: R
|
|
559
553
|
};
|
|
560
|
-
return (
|
|
554
|
+
return (w.Type === "Image" || w.Type === "File") && (w.Type === "Image" ? (d.upload = async (c) => {
|
|
561
555
|
Y(c.name, "Image");
|
|
562
|
-
const
|
|
563
|
-
|
|
564
|
-
|
|
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(
|
|
567
|
+
await fetch(f.UploadUrl.URL, {
|
|
574
568
|
method: "PUT",
|
|
575
|
-
headers: { "Content-Type":
|
|
569
|
+
headers: { "Content-Type": f.ContentType },
|
|
576
570
|
body: c
|
|
577
571
|
});
|
|
578
|
-
const
|
|
579
|
-
_id:
|
|
580
|
-
_name:
|
|
581
|
-
FileName:
|
|
582
|
-
FileExtension:
|
|
583
|
-
Size:
|
|
584
|
-
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(
|
|
580
|
+
return t.setValue(s, _, {
|
|
587
581
|
shouldDirty: !0
|
|
588
|
-
}),
|
|
589
|
-
},
|
|
582
|
+
}), _;
|
|
583
|
+
}, d.deleteAttachment = async () => {
|
|
590
584
|
const c = t.getValues(
|
|
591
|
-
|
|
592
|
-
),
|
|
585
|
+
s
|
|
586
|
+
), h = y();
|
|
593
587
|
if (!(c != null && c._id))
|
|
594
|
-
throw new Error(`${
|
|
595
|
-
await
|
|
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
|
-
},
|
|
599
|
-
const
|
|
600
|
-
|
|
601
|
-
),
|
|
602
|
-
if (!(
|
|
603
|
-
throw new Error(`${
|
|
604
|
-
return
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
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
|
-
}) : (
|
|
611
|
-
for (const
|
|
612
|
-
Y(
|
|
613
|
-
const
|
|
614
|
-
FileName:
|
|
615
|
-
Size:
|
|
616
|
-
FileExtension: Z(
|
|
617
|
-
})),
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
),
|
|
622
|
-
c.map(async (
|
|
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":
|
|
619
|
+
"Content-Type": _[k].ContentType
|
|
626
620
|
},
|
|
627
|
-
body:
|
|
621
|
+
body: O
|
|
628
622
|
}), {
|
|
629
|
-
_id:
|
|
630
|
-
_name:
|
|
631
|
-
FileName:
|
|
632
|
-
FileExtension:
|
|
633
|
-
Size:
|
|
634
|
-
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
|
-
),
|
|
630
|
+
), u = t.getValues(s) ?? [];
|
|
637
631
|
return t.setValue(
|
|
638
|
-
|
|
639
|
-
[...
|
|
632
|
+
s,
|
|
633
|
+
[...u, ...M],
|
|
640
634
|
{ shouldDirty: !0 }
|
|
641
|
-
),
|
|
642
|
-
},
|
|
643
|
-
const
|
|
644
|
-
await
|
|
645
|
-
|
|
646
|
-
|
|
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
|
-
},
|
|
650
|
-
const
|
|
651
|
-
return
|
|
652
|
-
|
|
653
|
-
|
|
643
|
+
}, d.getDownloadUrl = async (c, h) => {
|
|
644
|
+
const f = y();
|
|
645
|
+
return r.getDownloadUrl(
|
|
646
|
+
f,
|
|
647
|
+
s,
|
|
654
648
|
c,
|
|
655
|
-
|
|
649
|
+
h
|
|
656
650
|
);
|
|
657
|
-
},
|
|
658
|
-
const
|
|
659
|
-
return
|
|
660
|
-
})),
|
|
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
|
|
663
|
-
const
|
|
664
|
-
return
|
|
665
|
-
},
|
|
666
|
-
label: (l == null ? void 0 : l.label) ??
|
|
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:
|
|
672
|
-
getOrDefault:
|
|
673
|
-
validate:
|
|
664
|
+
meta: w,
|
|
665
|
+
get: D,
|
|
666
|
+
getOrDefault: A,
|
|
667
|
+
validate: R
|
|
674
668
|
};
|
|
675
|
-
return (
|
|
676
|
-
const
|
|
677
|
-
|
|
678
|
-
), c =
|
|
679
|
-
if (!(
|
|
680
|
-
throw new Error(`${
|
|
681
|
-
return
|
|
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
|
-
|
|
684
|
-
|
|
685
|
-
|
|
677
|
+
s,
|
|
678
|
+
d._id,
|
|
679
|
+
b
|
|
686
680
|
);
|
|
687
|
-
} : (
|
|
688
|
-
const c =
|
|
689
|
-
return
|
|
681
|
+
} : (V.getDownloadUrl = async (b, d) => {
|
|
682
|
+
const c = y();
|
|
683
|
+
return r.getDownloadUrl(
|
|
690
684
|
c,
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
685
|
+
s,
|
|
686
|
+
b,
|
|
687
|
+
d
|
|
694
688
|
);
|
|
695
|
-
},
|
|
696
|
-
const
|
|
697
|
-
return
|
|
698
|
-
})),
|
|
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(
|
|
701
|
-
return typeof
|
|
694
|
+
has(m, s) {
|
|
695
|
+
return typeof s == "symbol" ? !1 : s === "_id" || s === "toJSON" || s === "validate" ? !0 : s in a;
|
|
702
696
|
},
|
|
703
|
-
ownKeys(
|
|
704
|
-
return [...Object.keys(
|
|
697
|
+
ownKeys(m) {
|
|
698
|
+
return [...Object.keys(a), "_id", "toJSON", "validate"];
|
|
705
699
|
},
|
|
706
|
-
getOwnPropertyDescriptor(
|
|
707
|
-
if (typeof
|
|
700
|
+
getOwnPropertyDescriptor(m, s) {
|
|
701
|
+
if (typeof s != "symbol")
|
|
708
702
|
return {
|
|
709
703
|
configurable: !0,
|
|
710
|
-
enumerable:
|
|
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:
|
|
720
|
-
mode:
|
|
721
|
-
enabled:
|
|
722
|
-
} = t, [
|
|
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: () =>
|
|
718
|
+
queryFn: () => Ve(o.meta.businessProcessId),
|
|
725
719
|
staleTime: 30 * 60 * 1e3
|
|
726
|
-
}),
|
|
727
|
-
const
|
|
728
|
-
return
|
|
729
|
-
(
|
|
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
|
-
}, [
|
|
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
|
-
...
|
|
727
|
+
...B,
|
|
734
728
|
// readonly fields from other activities
|
|
735
|
-
...
|
|
729
|
+
...h
|
|
736
730
|
// Input fields (editable + readonly)
|
|
737
731
|
}),
|
|
738
|
-
[
|
|
739
|
-
),
|
|
740
|
-
() => Object.keys(
|
|
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
|
-
),
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
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
|
-
|
|
754
|
-
if (!
|
|
755
|
-
let
|
|
747
|
+
Te(() => {
|
|
748
|
+
if (!i || c) return;
|
|
749
|
+
let g = !0;
|
|
756
750
|
return (async () => {
|
|
757
|
-
|
|
751
|
+
y(!0), s(null);
|
|
758
752
|
try {
|
|
759
|
-
const
|
|
760
|
-
if (!
|
|
761
|
-
if (
|
|
762
|
-
const
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
),
|
|
766
|
-
(
|
|
767
|
-
const
|
|
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
|
-
]),
|
|
780
|
-
for (const
|
|
781
|
-
if (!
|
|
782
|
-
const
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
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
|
-
|
|
788
|
-
...
|
|
781
|
+
v && (j[p] = ee(p, {
|
|
782
|
+
...v,
|
|
789
783
|
ReadOnly: !0
|
|
790
784
|
}));
|
|
791
785
|
}
|
|
792
|
-
Object.keys(
|
|
786
|
+
Object.keys(j).length > 0 && R(j);
|
|
793
787
|
}
|
|
794
|
-
} catch (
|
|
795
|
-
if (!
|
|
796
|
-
console.error("Failed to read activity data:",
|
|
788
|
+
} catch (F) {
|
|
789
|
+
if (!g) return;
|
|
790
|
+
console.error("Failed to read activity data:", F), s(K(F));
|
|
797
791
|
} finally {
|
|
798
|
-
|
|
792
|
+
g && y(!1);
|
|
799
793
|
}
|
|
800
794
|
})(), () => {
|
|
801
|
-
|
|
795
|
+
g = !1;
|
|
802
796
|
};
|
|
803
|
-
}, [
|
|
804
|
-
const
|
|
805
|
-
(
|
|
806
|
-
[
|
|
797
|
+
}, [i, c, O, e]);
|
|
798
|
+
const H = G(
|
|
799
|
+
(g, T) => O.update(e, {
|
|
800
|
+
[g]: T
|
|
807
801
|
}),
|
|
808
|
-
[
|
|
809
|
-
),
|
|
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
|
-
|
|
812
|
-
allFields:
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
814
|
+
rhf: u,
|
|
815
|
+
allFields: f,
|
|
816
|
+
syncField: J,
|
|
817
|
+
syncOnBlur: L,
|
|
818
|
+
syncOnChange: q
|
|
816
819
|
}),
|
|
817
|
-
[
|
|
818
|
-
),
|
|
820
|
+
[u, f, J, L, q]
|
|
821
|
+
), se = P(
|
|
819
822
|
() => $e({
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
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
|
-
[
|
|
835
|
-
),
|
|
836
|
-
(
|
|
837
|
-
async (
|
|
838
|
-
|
|
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
|
|
841
|
-
for (const
|
|
842
|
-
if (
|
|
843
|
-
const
|
|
844
|
-
|
|
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(
|
|
840
|
+
Object.keys(C).length > 0 && await O.update(
|
|
847
841
|
e,
|
|
848
|
-
|
|
849
|
-
);
|
|
850
|
-
|
|
851
|
-
|
|
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
|
-
|
|
847
|
+
w(!1);
|
|
856
848
|
}
|
|
857
849
|
},
|
|
858
|
-
(
|
|
859
|
-
|
|
850
|
+
(F, x) => {
|
|
851
|
+
T == null || T(F, x);
|
|
860
852
|
}
|
|
861
853
|
),
|
|
862
|
-
[
|
|
863
|
-
),
|
|
864
|
-
|
|
865
|
-
|
|
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:
|
|
886
|
+
item: k,
|
|
869
887
|
// Activity reference
|
|
870
888
|
activity: o,
|
|
871
889
|
// Form methods
|
|
872
|
-
register:
|
|
873
|
-
handleSubmit:
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
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:
|
|
882
|
-
isValid:
|
|
883
|
-
isDirty:
|
|
884
|
-
isSubmitting:
|
|
885
|
-
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:
|
|
906
|
+
isLoading: r || c,
|
|
888
907
|
isMetadataLoading: c,
|
|
889
|
-
loadError:
|
|
908
|
+
loadError: m,
|
|
890
909
|
hasError: ie,
|
|
891
910
|
// Metadata
|
|
892
|
-
bpMetadata:
|
|
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, ...
|
|
899
|
-
() => e === "inprogress" ?
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
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
|
|
910
|
-
queryKey: ["activity-table",
|
|
911
|
-
listFn:
|
|
912
|
-
countFn:
|
|
913
|
-
...
|
|
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
|
-
|
|
937
|
+
ke as ActivityInstance,
|
|
923
938
|
Qe as ActivityTableStatus,
|
|
924
939
|
xe as Workflow,
|
|
925
|
-
|
|
926
|
-
|
|
940
|
+
je as buildFieldsFromInput,
|
|
941
|
+
ee as createFieldFromMeta,
|
|
927
942
|
Ke as useActivityForm,
|
|
928
943
|
He as useActivityTable
|
|
929
944
|
};
|