@ram_28/kf-ai-sdk 2.0.12 → 2.0.14
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/dist/api/client.d.ts.map +1 -1
- package/dist/api.cjs +1 -1
- package/dist/api.mjs +2 -2
- package/dist/attachment-constants-B5jlqoKI.cjs +1 -0
- package/dist/attachment-constants-C2UHWxmp.js +63 -0
- package/dist/auth.cjs +1 -1
- package/dist/auth.mjs +1 -1
- package/dist/bdo/core/types.d.ts +4 -0
- package/dist/bdo/core/types.d.ts.map +1 -1
- package/dist/bdo/fields/NumberField.d.ts.map +1 -1
- package/dist/bdo/fields/ReferenceField.d.ts +3 -2
- 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 +5 -0
- package/dist/bdo/fields/UserField.d.ts.map +1 -1
- package/dist/bdo.cjs +1 -1
- package/dist/bdo.mjs +107 -153
- package/dist/client-DnO2KKrw.cjs +1 -0
- package/dist/{client-CMERmrC-.js → client-iQTqFDNI.js} +34 -30
- package/dist/components/hooks/useForm/createItemProxy.d.ts +4 -0
- package/dist/components/hooks/useForm/createItemProxy.d.ts.map +1 -1
- package/dist/components/hooks/useForm/createResolver.d.ts.map +1 -1
- package/dist/components/hooks/useForm/useForm.d.ts +1 -0
- package/dist/components/hooks/useForm/useForm.d.ts.map +1 -1
- package/dist/form.cjs +1 -1
- package/dist/form.mjs +368 -203
- package/dist/{metadata-BfJtHz84.cjs → metadata-DgLSJkF5.cjs} +1 -1
- package/dist/{metadata-CwAo6a8e.js → metadata-DpfI3zRN.js} +1 -1
- package/dist/table.cjs +1 -1
- package/dist/table.mjs +1 -1
- package/dist/workflow/types.d.ts +3 -2
- package/dist/workflow/types.d.ts.map +1 -1
- package/dist/workflow.cjs +1 -1
- package/dist/workflow.d.ts +0 -2
- package/dist/workflow.d.ts.map +1 -1
- package/dist/workflow.mjs +204 -274
- package/dist/workflow.types.d.ts +0 -1
- package/dist/workflow.types.d.ts.map +1 -1
- package/docs/api.md +45 -253
- package/docs/bdo.md +130 -711
- package/docs/useAuth.md +42 -104
- package/docs/useFilter.md +117 -1591
- package/docs/useForm.md +266 -861
- package/docs/useTable.md +255 -1096
- package/docs/workflow.md +10 -155
- package/package.json +1 -1
- package/sdk/api/client.ts +18 -4
- package/sdk/bdo/core/types.ts +1 -0
- package/sdk/bdo/fields/NumberField.ts +2 -1
- package/sdk/bdo/fields/ReferenceField.ts +4 -3
- package/sdk/bdo/fields/SelectField.ts +2 -2
- package/sdk/bdo/fields/UserField.ts +14 -0
- package/sdk/components/hooks/useForm/createItemProxy.ts +221 -4
- package/sdk/components/hooks/useForm/createResolver.ts +16 -1
- package/sdk/components/hooks/useForm/useForm.ts +151 -50
- package/sdk/workflow/types.ts +3 -2
- package/sdk/workflow.ts +0 -7
- package/sdk/workflow.types.ts +0 -7
- package/dist/client-BnVxSHAm.cjs +0 -1
- package/dist/workflow/components/useActivityTable/index.d.ts +0 -4
- package/dist/workflow/components/useActivityTable/index.d.ts.map +0 -1
- package/dist/workflow/components/useActivityTable/types.d.ts +0 -53
- package/dist/workflow/components/useActivityTable/types.d.ts.map +0 -1
- package/dist/workflow/components/useActivityTable/useActivityTable.d.ts +0 -4
- package/dist/workflow/components/useActivityTable/useActivityTable.d.ts.map +0 -1
- package/sdk/workflow/components/useActivityTable/index.ts +0 -8
- package/sdk/workflow/components/useActivityTable/types.ts +0 -67
- package/sdk/workflow/components/useActivityTable/useActivityTable.ts +0 -145
package/dist/bdo.mjs
CHANGED
|
@@ -1,68 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var c = (r, e, t) =>
|
|
4
|
-
import { a as i } from "./client-
|
|
1
|
+
var U = Object.defineProperty;
|
|
2
|
+
var C = (r, e, t) => e in r ? U(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var c = (r, e, t) => C(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { a as i } from "./client-iQTqFDNI.js";
|
|
5
|
+
import { v as F, e as E } from "./attachment-constants-C2UHWxmp.js";
|
|
5
6
|
import { B as f } from "./BaseField-B6da88U7.js";
|
|
6
|
-
import { d as
|
|
7
|
-
const C = /* @__PURE__ */ new Set([
|
|
8
|
-
"jpg",
|
|
9
|
-
"jpeg",
|
|
10
|
-
"png",
|
|
11
|
-
"gif",
|
|
12
|
-
"webp",
|
|
13
|
-
"bmp",
|
|
14
|
-
"tiff",
|
|
15
|
-
"tif",
|
|
16
|
-
"heic",
|
|
17
|
-
"heif"
|
|
18
|
-
]), D = /* @__PURE__ */ new Set([
|
|
19
|
-
// Images
|
|
20
|
-
"jpg",
|
|
21
|
-
"jpeg",
|
|
22
|
-
"png",
|
|
23
|
-
"gif",
|
|
24
|
-
"webp",
|
|
25
|
-
"bmp",
|
|
26
|
-
"tiff",
|
|
27
|
-
"tif",
|
|
28
|
-
"heic",
|
|
29
|
-
"heif",
|
|
30
|
-
// Videos
|
|
31
|
-
"mp4",
|
|
32
|
-
"mov",
|
|
33
|
-
"avi",
|
|
34
|
-
"webm",
|
|
35
|
-
"mkv",
|
|
36
|
-
"m4v",
|
|
37
|
-
"wmv",
|
|
38
|
-
"flv",
|
|
39
|
-
// Documents
|
|
40
|
-
"pdf",
|
|
41
|
-
"doc",
|
|
42
|
-
"docx",
|
|
43
|
-
"xls",
|
|
44
|
-
"xlsx",
|
|
45
|
-
"ppt",
|
|
46
|
-
"pptx",
|
|
47
|
-
// Other
|
|
48
|
-
"txt",
|
|
49
|
-
"csv",
|
|
50
|
-
"zip"
|
|
51
|
-
]);
|
|
52
|
-
function E(r) {
|
|
53
|
-
if (!r.includes(".")) return "";
|
|
54
|
-
const e = r.split(".");
|
|
55
|
-
return (e[e.length - 1] ?? "").toLowerCase();
|
|
56
|
-
}
|
|
57
|
-
function F(r, e) {
|
|
58
|
-
const t = E(r), s = e === "Image" ? C : D;
|
|
59
|
-
if (!t || !s.has(t)) {
|
|
60
|
-
const a = [...s].sort().join(", ");
|
|
61
|
-
throw new Error(
|
|
62
|
-
`File "${r}" has unsupported extension "${t || "(none)"}". Supported for ${e} fields: ${a}`
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
7
|
+
import { d as re } from "./constants-ConHc1oS.js";
|
|
66
8
|
class w {
|
|
67
9
|
constructor(e, t) {
|
|
68
10
|
c(this, "_data");
|
|
@@ -123,18 +65,18 @@ class w {
|
|
|
123
65
|
Type: "String"
|
|
124
66
|
}, n = (s == null ? void 0 : s.readOnly) ?? !1, u = () => {
|
|
125
67
|
if (s) {
|
|
126
|
-
const
|
|
127
|
-
if (!
|
|
128
|
-
return
|
|
68
|
+
const m = s.validate(this._data[e]);
|
|
69
|
+
if (!m.valid)
|
|
70
|
+
return m;
|
|
129
71
|
}
|
|
130
72
|
return this._bdo.hasMetadata() ? this._bdo.validateFieldExpression(
|
|
131
73
|
e,
|
|
132
74
|
this._data[e],
|
|
133
75
|
this.toJSON()
|
|
134
76
|
) : { valid: !0, errors: [] };
|
|
135
|
-
},
|
|
136
|
-
const
|
|
137
|
-
return
|
|
77
|
+
}, h = (m) => {
|
|
78
|
+
const y = this._data[e];
|
|
79
|
+
return y ?? m;
|
|
138
80
|
};
|
|
139
81
|
let g;
|
|
140
82
|
if (n ? g = {
|
|
@@ -144,7 +86,7 @@ class w {
|
|
|
144
86
|
defaultValue: s == null ? void 0 : s.defaultValue,
|
|
145
87
|
meta: a,
|
|
146
88
|
get: () => this._data[e],
|
|
147
|
-
getOrDefault:
|
|
89
|
+
getOrDefault: h,
|
|
148
90
|
validate: u
|
|
149
91
|
} : g = {
|
|
150
92
|
label: (s == null ? void 0 : s.label) ?? e,
|
|
@@ -153,30 +95,30 @@ class w {
|
|
|
153
95
|
defaultValue: s == null ? void 0 : s.defaultValue,
|
|
154
96
|
meta: a,
|
|
155
97
|
get: () => this._data[e],
|
|
156
|
-
getOrDefault:
|
|
157
|
-
set: (
|
|
158
|
-
this._data[e] =
|
|
98
|
+
getOrDefault: h,
|
|
99
|
+
set: (m) => {
|
|
100
|
+
this._data[e] = m;
|
|
159
101
|
},
|
|
160
102
|
validate: u
|
|
161
103
|
}, a.Type === "Image" || a.Type === "File") {
|
|
162
|
-
const
|
|
163
|
-
a.Type === "Image" ? (
|
|
104
|
+
const m = this._bdo.getBoId(), y = g;
|
|
105
|
+
a.Type === "Image" ? (y.getDownloadUrl = async (o) => {
|
|
164
106
|
const d = this._requireInstanceId(), _ = this._data[e];
|
|
165
107
|
if (!(_ != null && _._id))
|
|
166
108
|
throw new Error(`${e} has no image to download`);
|
|
167
|
-
return i(
|
|
109
|
+
return i(m).getDownloadUrl(
|
|
168
110
|
d,
|
|
169
111
|
e,
|
|
170
112
|
_._id,
|
|
171
113
|
o
|
|
172
114
|
);
|
|
173
|
-
}, n || (
|
|
115
|
+
}, n || (y.upload = async (o) => {
|
|
174
116
|
F(o.name, "Image");
|
|
175
117
|
const d = this._requireInstanceId(), _ = {
|
|
176
118
|
FileName: o.name,
|
|
177
119
|
Size: o.size,
|
|
178
120
|
FileExtension: E(o.name)
|
|
179
|
-
}, [l] = await i(
|
|
121
|
+
}, [l] = await i(m).getUploadUrl(
|
|
180
122
|
d,
|
|
181
123
|
e,
|
|
182
124
|
[_]
|
|
@@ -195,54 +137,54 @@ class w {
|
|
|
195
137
|
ContentType: l.ContentType
|
|
196
138
|
};
|
|
197
139
|
return this._data[e] = v, v;
|
|
198
|
-
},
|
|
140
|
+
}, y.deleteAttachment = async () => {
|
|
199
141
|
const o = this._requireInstanceId(), d = this._data[e];
|
|
200
142
|
if (!(d != null && d._id))
|
|
201
143
|
throw new Error(`${e} has no image to delete`);
|
|
202
|
-
await i(
|
|
203
|
-
})) : (
|
|
144
|
+
await i(m).deleteAttachment(o, e, d._id), this._data[e] = null;
|
|
145
|
+
})) : (y.getDownloadUrl = async (o, d) => {
|
|
204
146
|
const _ = this._requireInstanceId();
|
|
205
|
-
return i(
|
|
147
|
+
return i(m).getDownloadUrl(
|
|
206
148
|
_,
|
|
207
149
|
e,
|
|
208
150
|
o,
|
|
209
151
|
d
|
|
210
152
|
);
|
|
211
|
-
},
|
|
153
|
+
}, y.getDownloadUrls = async (o) => {
|
|
212
154
|
const d = this._requireInstanceId();
|
|
213
|
-
return i(
|
|
214
|
-
}, n || (
|
|
155
|
+
return i(m).getDownloadUrls(d, e, o);
|
|
156
|
+
}, n || (y.upload = async (o) => {
|
|
215
157
|
for (const N of o)
|
|
216
158
|
F(N.name, "File");
|
|
217
159
|
const d = this._requireInstanceId(), _ = o.map((N) => ({
|
|
218
160
|
FileName: N.name,
|
|
219
161
|
Size: N.size,
|
|
220
162
|
FileExtension: E(N.name)
|
|
221
|
-
})), l = await i(
|
|
163
|
+
})), l = await i(m).getUploadUrl(
|
|
222
164
|
d,
|
|
223
165
|
e,
|
|
224
166
|
_
|
|
225
167
|
), v = await Promise.all(
|
|
226
|
-
o.map(async (N,
|
|
168
|
+
o.map(async (N, p) => (await fetch(l[p].UploadUrl.URL, {
|
|
227
169
|
method: "PUT",
|
|
228
|
-
headers: { "Content-Type": l[
|
|
170
|
+
headers: { "Content-Type": l[p].ContentType },
|
|
229
171
|
body: N
|
|
230
172
|
}), {
|
|
231
|
-
_id: l[
|
|
232
|
-
_name: l[
|
|
233
|
-
FileName: l[
|
|
234
|
-
FileExtension: l[
|
|
235
|
-
Size: l[
|
|
236
|
-
ContentType: l[
|
|
173
|
+
_id: l[p]._id,
|
|
174
|
+
_name: l[p]._name,
|
|
175
|
+
FileName: l[p].FileName,
|
|
176
|
+
FileExtension: l[p].FileExtension,
|
|
177
|
+
Size: l[p].Size,
|
|
178
|
+
ContentType: l[p].ContentType
|
|
237
179
|
}))
|
|
238
|
-
),
|
|
180
|
+
), A = this._data[e] ?? [];
|
|
239
181
|
return this._data[e] = [
|
|
240
|
-
...
|
|
182
|
+
...A,
|
|
241
183
|
...v
|
|
242
184
|
], v;
|
|
243
|
-
},
|
|
185
|
+
}, y.deleteAttachment = async (o) => {
|
|
244
186
|
const d = this._requireInstanceId();
|
|
245
|
-
await i(
|
|
187
|
+
await i(m).deleteAttachment(
|
|
246
188
|
d,
|
|
247
189
|
e,
|
|
248
190
|
o
|
|
@@ -262,9 +204,9 @@ class w {
|
|
|
262
204
|
const e = this._bdo.getFields(), t = [], s = this.toJSON();
|
|
263
205
|
for (const [a, n] of Object.entries(e)) {
|
|
264
206
|
if (n.readOnly) continue;
|
|
265
|
-
const u = this._data[a],
|
|
266
|
-
if (!
|
|
267
|
-
t.push(...
|
|
207
|
+
const u = this._data[a], h = n.validate(u);
|
|
208
|
+
if (!h.valid) {
|
|
209
|
+
t.push(...h.errors);
|
|
268
210
|
continue;
|
|
269
211
|
}
|
|
270
212
|
if (this._bdo.hasMetadata()) {
|
|
@@ -328,7 +270,7 @@ class T extends f {
|
|
|
328
270
|
} : { valid: !0, errors: [] };
|
|
329
271
|
}
|
|
330
272
|
}
|
|
331
|
-
class
|
|
273
|
+
class O extends f {
|
|
332
274
|
constructor(e) {
|
|
333
275
|
super(e);
|
|
334
276
|
}
|
|
@@ -337,6 +279,17 @@ class A extends f {
|
|
|
337
279
|
var e;
|
|
338
280
|
return (e = this._meta.View) == null ? void 0 : e.BusinessEntity;
|
|
339
281
|
}
|
|
282
|
+
/**
|
|
283
|
+
* Fetch user records from the backend via the fetchField API.
|
|
284
|
+
* Requires the field to be bound to a parent BDO.
|
|
285
|
+
*/
|
|
286
|
+
async fetchOptions(e) {
|
|
287
|
+
if (!this._parentBoId)
|
|
288
|
+
throw new Error(
|
|
289
|
+
`Field ${this.id} not bound to a BDO. Cannot fetch options.`
|
|
290
|
+
);
|
|
291
|
+
return i(this._parentBoId).fetchField(e, this.id);
|
|
292
|
+
}
|
|
340
293
|
validate(e) {
|
|
341
294
|
if (e == null)
|
|
342
295
|
return { valid: !0, errors: [] };
|
|
@@ -352,7 +305,7 @@ class A extends f {
|
|
|
352
305
|
} : { valid: !0, errors: [] };
|
|
353
306
|
}
|
|
354
307
|
}
|
|
355
|
-
const
|
|
308
|
+
const S = {
|
|
356
309
|
// ============================================================
|
|
357
310
|
// STRING FUNCTIONS (7)
|
|
358
311
|
// ============================================================
|
|
@@ -522,7 +475,7 @@ const M = {
|
|
|
522
475
|
return (r === "x" ? e : e & 3 | 8).toString(16);
|
|
523
476
|
})
|
|
524
477
|
};
|
|
525
|
-
function
|
|
478
|
+
function D() {
|
|
526
479
|
const r = /* @__PURE__ */ new Date();
|
|
527
480
|
return {
|
|
528
481
|
NOW: r,
|
|
@@ -545,26 +498,26 @@ function b(r, e) {
|
|
|
545
498
|
case "Identifier":
|
|
546
499
|
return e.formValues[r.Name];
|
|
547
500
|
case "SystemIdentifier":
|
|
548
|
-
return
|
|
501
|
+
return M(r, e);
|
|
549
502
|
case "BinaryExpression":
|
|
550
|
-
return
|
|
503
|
+
return R(r, e);
|
|
551
504
|
case "LogicalExpression":
|
|
552
|
-
return
|
|
505
|
+
return I(r, e);
|
|
553
506
|
case "CallExpression":
|
|
554
|
-
return
|
|
507
|
+
return $(r, e);
|
|
555
508
|
case "MemberExpression":
|
|
556
|
-
return
|
|
509
|
+
return B(r, e);
|
|
557
510
|
case "AssignmentExpression":
|
|
558
511
|
return ((t = r.Arguments) == null ? void 0 : t.length) === 1 ? b(r.Arguments[0], e) : void 0;
|
|
559
512
|
default:
|
|
560
513
|
throw new Error(`Unsupported expression type: ${r.Type}`);
|
|
561
514
|
}
|
|
562
515
|
}
|
|
563
|
-
function
|
|
516
|
+
function M(r, e) {
|
|
564
517
|
const t = r.Name, s = e.systemValues[t];
|
|
565
518
|
return r.Property ? s && typeof s == "object" ? s[r.Property.Name] : void 0 : s;
|
|
566
519
|
}
|
|
567
|
-
function
|
|
520
|
+
function R(r, e) {
|
|
568
521
|
if (!r.Arguments || r.Arguments.length < 2)
|
|
569
522
|
throw new Error("BinaryExpression requires 2 arguments");
|
|
570
523
|
const [t, s] = r.Arguments, a = b(t, e), n = b(s, e);
|
|
@@ -595,7 +548,7 @@ function $(r, e) {
|
|
|
595
548
|
throw new Error(`Unsupported binary operator: ${r.Operator}`);
|
|
596
549
|
}
|
|
597
550
|
}
|
|
598
|
-
function
|
|
551
|
+
function I(r, e) {
|
|
599
552
|
if (!r.Arguments || r.Arguments.length === 0)
|
|
600
553
|
throw new Error("LogicalExpression requires at least 1 argument");
|
|
601
554
|
const t = r.Arguments;
|
|
@@ -610,23 +563,23 @@ function j(r, e) {
|
|
|
610
563
|
throw new Error(`Unsupported logical operator: ${r.Operator}`);
|
|
611
564
|
}
|
|
612
565
|
}
|
|
613
|
-
function
|
|
566
|
+
function $(r, e) {
|
|
614
567
|
if (!r.Callee)
|
|
615
568
|
throw new Error("CallExpression requires a Callee");
|
|
616
|
-
const t =
|
|
569
|
+
const t = S[r.Callee];
|
|
617
570
|
if (!t)
|
|
618
571
|
throw new Error(`Unknown function: ${r.Callee}`);
|
|
619
572
|
const s = (r.Arguments ?? []).map((a) => b(a, e));
|
|
620
573
|
return t(...s);
|
|
621
574
|
}
|
|
622
|
-
function
|
|
575
|
+
function B(r, e) {
|
|
623
576
|
var a, n;
|
|
624
577
|
if (!((a = r.Arguments) != null && a.length))
|
|
625
578
|
return;
|
|
626
579
|
const t = b(r.Arguments[0], e), s = (n = r.Arguments[0].Property) == null ? void 0 : n.Name;
|
|
627
580
|
return s && t && typeof t == "object" ? t[s] : t;
|
|
628
581
|
}
|
|
629
|
-
class
|
|
582
|
+
class V {
|
|
630
583
|
constructor() {
|
|
631
584
|
/**
|
|
632
585
|
* Map of field ID to its validation rules
|
|
@@ -653,11 +606,11 @@ class P {
|
|
|
653
606
|
for (const [a, n] of Object.entries(e.Fields)) {
|
|
654
607
|
const u = [];
|
|
655
608
|
if (n.Validation && Array.isArray(n.Validation)) {
|
|
656
|
-
for (const
|
|
657
|
-
if (typeof
|
|
658
|
-
u.push(
|
|
659
|
-
else if (typeof
|
|
660
|
-
const g = (s = (t = e.Rules) == null ? void 0 : t.Validation) == null ? void 0 : s[
|
|
609
|
+
for (const h of n.Validation)
|
|
610
|
+
if (typeof h == "object" && h.ExpressionTree)
|
|
611
|
+
u.push(h);
|
|
612
|
+
else if (typeof h == "string") {
|
|
613
|
+
const g = (s = (t = e.Rules) == null ? void 0 : t.Validation) == null ? void 0 : s[h];
|
|
661
614
|
g && u.push(g);
|
|
662
615
|
}
|
|
663
616
|
}
|
|
@@ -699,7 +652,7 @@ class P {
|
|
|
699
652
|
return { valid: !0, errors: [] };
|
|
700
653
|
const n = {
|
|
701
654
|
formValues: { ...s, [e]: t },
|
|
702
|
-
systemValues:
|
|
655
|
+
systemValues: D()
|
|
703
656
|
};
|
|
704
657
|
for (const u of a)
|
|
705
658
|
try {
|
|
@@ -708,10 +661,10 @@ class P {
|
|
|
708
661
|
valid: !1,
|
|
709
662
|
errors: [u.Message || `Validation failed: ${u.Name || u.Id}`]
|
|
710
663
|
};
|
|
711
|
-
} catch (
|
|
664
|
+
} catch (h) {
|
|
712
665
|
console.warn(
|
|
713
666
|
`Expression evaluation failed for rule ${u.Id}:`,
|
|
714
|
-
|
|
667
|
+
h
|
|
715
668
|
);
|
|
716
669
|
}
|
|
717
670
|
return { valid: !0, errors: [] };
|
|
@@ -737,7 +690,7 @@ class P {
|
|
|
737
690
|
};
|
|
738
691
|
}
|
|
739
692
|
}
|
|
740
|
-
class
|
|
693
|
+
class Y {
|
|
741
694
|
constructor() {
|
|
742
695
|
// ============================================================
|
|
743
696
|
// SYSTEM FIELDS (inherited by all BDOs)
|
|
@@ -745,8 +698,8 @@ class z {
|
|
|
745
698
|
c(this, "_id", new x({ _id: "_id", Name: "ID", Type: "String", ReadOnly: !0 }));
|
|
746
699
|
c(this, "_created_at", new T({ _id: "_created_at", Name: "Created At", Type: "DateTime", ReadOnly: !0 }));
|
|
747
700
|
c(this, "_modified_at", new T({ _id: "_modified_at", Name: "Modified At", Type: "DateTime", ReadOnly: !0 }));
|
|
748
|
-
c(this, "_created_by", new
|
|
749
|
-
c(this, "_modified_by", new
|
|
701
|
+
c(this, "_created_by", new O({ _id: "_created_by", Name: "Created By", Type: "User", ReadOnly: !0 }));
|
|
702
|
+
c(this, "_modified_by", new O({ _id: "_modified_by", Name: "Modified By", Type: "User", ReadOnly: !0 }));
|
|
750
703
|
c(this, "_version", new x({ _id: "_version", Name: "Version", Type: "String", ReadOnly: !0 }));
|
|
751
704
|
c(this, "_m_version", new x({ _id: "_m_version", Name: "Metadata Version", Type: "String", ReadOnly: !0 }));
|
|
752
705
|
/**
|
|
@@ -763,7 +716,7 @@ class z {
|
|
|
763
716
|
/**
|
|
764
717
|
* Expression engine instance for evaluating backend validation rules
|
|
765
718
|
*/
|
|
766
|
-
c(this, "_expressionEngine", new
|
|
719
|
+
c(this, "_expressionEngine", new V());
|
|
767
720
|
}
|
|
768
721
|
// ============================================================
|
|
769
722
|
// FIELD DEFINITIONS (auto-discovered)
|
|
@@ -963,7 +916,7 @@ class z {
|
|
|
963
916
|
return i(this.meta._id).deleteAttachment(e, t, s);
|
|
964
917
|
}
|
|
965
918
|
}
|
|
966
|
-
class
|
|
919
|
+
class z extends f {
|
|
967
920
|
constructor(e) {
|
|
968
921
|
super(e);
|
|
969
922
|
}
|
|
@@ -976,13 +929,13 @@ class J extends f {
|
|
|
976
929
|
return (e = this._meta.Constraint) == null ? void 0 : e.FractionPart;
|
|
977
930
|
}
|
|
978
931
|
validate(e) {
|
|
979
|
-
return e
|
|
932
|
+
return e == null || e === "" ? { valid: !0, errors: [] } : typeof e != "number" || isNaN(e) ? {
|
|
980
933
|
valid: !1,
|
|
981
934
|
errors: [`${this.label} must be a valid number`]
|
|
982
935
|
} : { valid: !0, errors: [] };
|
|
983
936
|
}
|
|
984
937
|
}
|
|
985
|
-
class
|
|
938
|
+
class J extends f {
|
|
986
939
|
constructor(e) {
|
|
987
940
|
super(e);
|
|
988
941
|
}
|
|
@@ -993,7 +946,7 @@ class k extends f {
|
|
|
993
946
|
} : { valid: !0, errors: [] };
|
|
994
947
|
}
|
|
995
948
|
}
|
|
996
|
-
class
|
|
949
|
+
class k extends f {
|
|
997
950
|
constructor(e) {
|
|
998
951
|
super(e);
|
|
999
952
|
}
|
|
@@ -1017,7 +970,7 @@ class G extends f {
|
|
|
1017
970
|
} : { valid: !0, errors: [] };
|
|
1018
971
|
}
|
|
1019
972
|
}
|
|
1020
|
-
class
|
|
973
|
+
class G extends f {
|
|
1021
974
|
constructor(e) {
|
|
1022
975
|
super(e);
|
|
1023
976
|
}
|
|
@@ -1046,7 +999,7 @@ class H extends f {
|
|
|
1046
999
|
`Field ${this.id} not bound to a BDO. Cannot fetch options.`
|
|
1047
1000
|
);
|
|
1048
1001
|
return (await i(this._parentBoId).fetchField(
|
|
1049
|
-
e
|
|
1002
|
+
e,
|
|
1050
1003
|
this.id
|
|
1051
1004
|
)).map((s) => ({
|
|
1052
1005
|
value: s.Value,
|
|
@@ -1054,7 +1007,7 @@ class H extends f {
|
|
|
1054
1007
|
}));
|
|
1055
1008
|
}
|
|
1056
1009
|
}
|
|
1057
|
-
class
|
|
1010
|
+
class H extends f {
|
|
1058
1011
|
constructor(e) {
|
|
1059
1012
|
super(e);
|
|
1060
1013
|
}
|
|
@@ -1085,14 +1038,15 @@ class X extends f {
|
|
|
1085
1038
|
} : { valid: !0, errors: [] };
|
|
1086
1039
|
}
|
|
1087
1040
|
/**
|
|
1088
|
-
* Fetch referenced records from the backend
|
|
1041
|
+
* Fetch referenced records from the backend via the fetchField API.
|
|
1042
|
+
* Requires the field to be bound to a parent BDO.
|
|
1089
1043
|
*/
|
|
1090
1044
|
async fetchOptions(e) {
|
|
1091
1045
|
if (!this._parentBoId)
|
|
1092
1046
|
throw new Error(
|
|
1093
1047
|
`Field ${this.id} not bound to a BDO. Cannot fetch options.`
|
|
1094
1048
|
);
|
|
1095
|
-
return i(this._parentBoId).fetchField(e
|
|
1049
|
+
return i(this._parentBoId).fetchField(e, this.id);
|
|
1096
1050
|
}
|
|
1097
1051
|
}
|
|
1098
1052
|
class K extends f {
|
|
@@ -1125,7 +1079,7 @@ class W extends f {
|
|
|
1125
1079
|
} : { valid: !0, errors: [] };
|
|
1126
1080
|
}
|
|
1127
1081
|
}
|
|
1128
|
-
class
|
|
1082
|
+
class X extends f {
|
|
1129
1083
|
constructor(e) {
|
|
1130
1084
|
super(e);
|
|
1131
1085
|
}
|
|
@@ -1141,7 +1095,7 @@ class Q extends f {
|
|
|
1141
1095
|
} : { valid: !0, errors: [] };
|
|
1142
1096
|
}
|
|
1143
1097
|
}
|
|
1144
|
-
class
|
|
1098
|
+
class Q extends f {
|
|
1145
1099
|
constructor(e) {
|
|
1146
1100
|
super(e);
|
|
1147
1101
|
}
|
|
@@ -1162,7 +1116,7 @@ class Z extends f {
|
|
|
1162
1116
|
return { valid: !0, errors: [] };
|
|
1163
1117
|
}
|
|
1164
1118
|
}
|
|
1165
|
-
class
|
|
1119
|
+
class Z extends f {
|
|
1166
1120
|
constructor(e) {
|
|
1167
1121
|
super(e);
|
|
1168
1122
|
}
|
|
@@ -1178,20 +1132,20 @@ class ee extends f {
|
|
|
1178
1132
|
}
|
|
1179
1133
|
export {
|
|
1180
1134
|
K as ArrayField,
|
|
1181
|
-
|
|
1135
|
+
Y as BaseBdo,
|
|
1182
1136
|
f as BaseField,
|
|
1183
|
-
|
|
1184
|
-
|
|
1137
|
+
J as BooleanField,
|
|
1138
|
+
k as DateField,
|
|
1185
1139
|
T as DateTimeField,
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1140
|
+
Q as FileField,
|
|
1141
|
+
Z as ImageField,
|
|
1142
|
+
z as NumberField,
|
|
1189
1143
|
W as ObjectField,
|
|
1190
|
-
|
|
1191
|
-
|
|
1144
|
+
H as ReferenceField,
|
|
1145
|
+
G as SelectField,
|
|
1192
1146
|
x as StringField,
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1147
|
+
re as SystemField,
|
|
1148
|
+
X as TextAreaField,
|
|
1149
|
+
X as TextField,
|
|
1150
|
+
O as UserField
|
|
1197
1151
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";let f={baseUrl:"",headers:{"Content-Type":"application/json"}};function l(o){f.baseUrl=o}function w(o){f.headers={...f.headers,...o}}function s(){return{...f.headers}}function u(){return f.baseUrl||""}function p(o){const a=f.baseUrl;return{async get(r){const t=await fetch(`${a}${o}/${r}/read`,{method:"GET",headers:s()});if(!t.ok)throw new Error(`Failed to get ${o} ${r}: ${t.statusText}`);return(await t.json()).Data},async create(r){const t=await fetch(`${a}${o}/create`,{method:"POST",headers:s(),body:JSON.stringify(r)});if(!t.ok)throw new Error(`Failed to create ${o}: ${t.statusText}`);return(await t.json()).Data},async update(r,t){const e=await fetch(`${a}${o}/${r}/update`,{method:"POST",headers:s(),body:JSON.stringify(t)});if(!e.ok)throw new Error(`Failed to update ${o} ${r}: ${e.statusText}`);return(await e.json()).Data},async delete(r){const t=await fetch(`${a}${o}/${r}/delete`,{method:"DELETE",headers:s()});if(!t.ok)throw new Error(`Failed to delete ${o} ${r}: ${t.statusText}`);return t.json()},async list(r){const t={Type:"List",...r},e=await fetch(`${a}${o}/list`,{method:"POST",headers:s(),body:JSON.stringify(t)});if(!e.ok)throw new Error(`Failed to list ${o}: ${e.statusText}`);return await e.json()},async count(r){var c,$;const t={Type:"Metric",GroupBy:[],Metric:[{Field:"_id",Type:"Count"}],...(r==null?void 0:r.Filter)&&{Filter:r.Filter}},e=await fetch(`${a}${o}/metric`,{method:"POST",headers:s(),body:JSON.stringify(t)});if(!e.ok)throw new Error(`Failed to count ${o}: ${e.statusText}`);return{Count:(($=(c=(await e.json()).Data)==null?void 0:c[0])==null?void 0:$.count__id)??0}},async draft(r){const t=await fetch(`${a}${o}/draft`,{method:"POST",headers:s(),body:JSON.stringify(r)});if(!t.ok)throw new Error(`Failed to create draft for ${o}: ${t.statusText}`);return t.json()},async draftUpdate(r,t){const e=await fetch(`${a}${o}/${r}/draft`,{method:"POST",headers:s(),body:JSON.stringify(t)});if(!e.ok)throw new Error(`Failed to update draft for ${o} ${r}: ${e.statusText}`);return e.json()},async draftPatch(r,t){const e=await fetch(`${a}${o}/${r}/draft`,{method:"PATCH",headers:s(),body:JSON.stringify(t)});if(!e.ok)throw new Error(`Failed to patch draft for ${o} ${r}: ${e.statusText}`);return e.json()},async draftInteraction(r){const t=await fetch(`${a}${o}/draft`,{method:"PATCH",headers:s(),body:JSON.stringify(r)});if(!t.ok)throw new Error(`Failed to create interactive draft for ${o}: ${t.statusText}`);const e=await t.json();return{...e.Data,_id:e.Data._id}},async metric(r){const t={Type:"Metric",...r},e=await fetch(`${a}${o}/metric`,{method:"POST",headers:s(),body:JSON.stringify(t)});if(!e.ok)throw new Error(`Failed to get metrics for ${o}: ${e.statusText}`);return e.json()},async pivot(r){const t={Type:"Pivot",...r},e=await fetch(`${a}${o}/pivot`,{method:"POST",headers:s(),body:JSON.stringify(t)});if(!e.ok)throw new Error(`Failed to get pivot data for ${o}: ${e.statusText}`);return e.json()},async fields(){const r=await fetch(`${a}${o}/fields`,{method:"GET",headers:s()});if(!r.ok)throw new Error(`Failed to get fields for ${o}: ${r.statusText}`);return r.json()},async fetchField(r,t){const e=await fetch(`${a}${o}/${r}/field/${t}/fetch`,{method:"GET",headers:s()});if(!e.ok)throw new Error(`Failed to fetch field ${t} for ${o}: ${e.statusText}`);return(await e.json()).Data},async getUploadUrl(r,t,e){const n=await fetch(`${a}${o}/${r}/field/${t}/attachment/upload`,{method:"POST",headers:s(),body:JSON.stringify(e)});if(!n.ok)throw new Error(`Failed to get upload URL for ${o}/${t}: ${n.statusText}`);return(await n.json()).Data},async getDownloadUrl(r,t,e,n){let d=`${a}${o}/${r}/field/${t}/attachment/${e}/read`;n&&(d+=`?view_type=${n}`);const c=await fetch(d,{method:"GET",headers:s()});if(!c.ok)throw new Error(`Failed to get download URL for ${o}/${t}/${e}: ${c.statusText}`);const i=(await c.json()).Data;return i&&i.DownloadUrl&&!i.URL&&(i.URL=i.DownloadUrl),i},async getDownloadUrls(r,t,e){let n=`${a}${o}/${r}/field/${t}/attachment/read`;e&&(n+=`?view_type=${e}`);const d=await fetch(n,{method:"GET",headers:s()});if(!d.ok)throw new Error(`Failed to get download URLs for ${o}/${t}: ${d.statusText}`);const $=(await d.json()).Data;return Array.isArray($)&&$.forEach(i=>{i&&i.DownloadUrl&&!i.URL&&(i.URL=i.DownloadUrl)}),$},async deleteAttachment(r,t,e){const n=await fetch(`${a}${o}/${r}/field/${t}/attachment/${e}/delete`,{method:"DELETE",headers:s()});if(!n.ok)throw new Error(`Failed to delete attachment ${e} for ${o}/${t}: ${n.statusText}`)}}}function y(o){return p(`/api/app/${o}`)}exports.api=y;exports.getApiBaseUrl=u;exports.getDefaultHeaders=s;exports.setApiBaseUrl=l;exports.setDefaultHeaders=w;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
let
|
|
1
|
+
let f = {
|
|
2
2
|
baseUrl: "",
|
|
3
3
|
headers: {
|
|
4
4
|
"Content-Type": "application/json"
|
|
5
5
|
}
|
|
6
6
|
};
|
|
7
|
-
function u(o) {
|
|
8
|
-
c.baseUrl = o;
|
|
9
|
-
}
|
|
10
7
|
function w(o) {
|
|
11
|
-
|
|
8
|
+
f.baseUrl = o;
|
|
9
|
+
}
|
|
10
|
+
function u(o) {
|
|
11
|
+
f.headers = { ...f.headers, ...o };
|
|
12
12
|
}
|
|
13
13
|
function n() {
|
|
14
|
-
return { ...
|
|
14
|
+
return { ...f.headers };
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
return
|
|
16
|
+
function p() {
|
|
17
|
+
return f.baseUrl || "";
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
const s =
|
|
19
|
+
function l(o) {
|
|
20
|
+
const s = f.baseUrl;
|
|
21
21
|
return {
|
|
22
22
|
async get(r) {
|
|
23
23
|
const t = await fetch(`${s}${o}/${r}/read`, {
|
|
@@ -38,7 +38,7 @@ function f(o) {
|
|
|
38
38
|
});
|
|
39
39
|
if (!t.ok)
|
|
40
40
|
throw new Error(`Failed to create ${o}: ${t.statusText}`);
|
|
41
|
-
return t.json();
|
|
41
|
+
return (await t.json()).Data;
|
|
42
42
|
},
|
|
43
43
|
async update(r, t) {
|
|
44
44
|
const e = await fetch(`${s}${o}/${r}/update`, {
|
|
@@ -50,7 +50,7 @@ function f(o) {
|
|
|
50
50
|
throw new Error(
|
|
51
51
|
`Failed to update ${o} ${r}: ${e.statusText}`
|
|
52
52
|
);
|
|
53
|
-
return e.json();
|
|
53
|
+
return (await e.json()).Data;
|
|
54
54
|
},
|
|
55
55
|
async delete(r) {
|
|
56
56
|
const t = await fetch(`${s}${o}/${r}/delete`, {
|
|
@@ -77,7 +77,7 @@ function f(o) {
|
|
|
77
77
|
return await e.json();
|
|
78
78
|
},
|
|
79
79
|
async count(r) {
|
|
80
|
-
var
|
|
80
|
+
var c, $;
|
|
81
81
|
const t = {
|
|
82
82
|
Type: "Metric",
|
|
83
83
|
GroupBy: [],
|
|
@@ -90,7 +90,7 @@ function f(o) {
|
|
|
90
90
|
});
|
|
91
91
|
if (!e.ok)
|
|
92
92
|
throw new Error(`Failed to count ${o}: ${e.statusText}`);
|
|
93
|
-
return { Count: (($ = (
|
|
93
|
+
return { Count: (($ = (c = (await e.json()).Data) == null ? void 0 : c[0]) == null ? void 0 : $.count__id) ?? 0 };
|
|
94
94
|
},
|
|
95
95
|
// ============================================================
|
|
96
96
|
// DRAFT/INTERACTIVE OPERATIONS
|
|
@@ -227,30 +227,34 @@ function f(o) {
|
|
|
227
227
|
return (await a.json()).Data;
|
|
228
228
|
},
|
|
229
229
|
async getDownloadUrl(r, t, e, a) {
|
|
230
|
-
let
|
|
231
|
-
a && (
|
|
232
|
-
const
|
|
230
|
+
let d = `${s}${o}/${r}/field/${t}/attachment/${e}/read`;
|
|
231
|
+
a && (d += `?view_type=${a}`);
|
|
232
|
+
const c = await fetch(d, {
|
|
233
233
|
method: "GET",
|
|
234
234
|
headers: n()
|
|
235
235
|
});
|
|
236
|
-
if (!
|
|
236
|
+
if (!c.ok)
|
|
237
237
|
throw new Error(
|
|
238
|
-
`Failed to get download URL for ${o}/${t}/${e}: ${
|
|
238
|
+
`Failed to get download URL for ${o}/${t}/${e}: ${c.statusText}`
|
|
239
239
|
);
|
|
240
|
-
|
|
240
|
+
const i = (await c.json()).Data;
|
|
241
|
+
return i && i.DownloadUrl && !i.URL && (i.URL = i.DownloadUrl), i;
|
|
241
242
|
},
|
|
242
243
|
async getDownloadUrls(r, t, e) {
|
|
243
244
|
let a = `${s}${o}/${r}/field/${t}/attachment/read`;
|
|
244
245
|
e && (a += `?view_type=${e}`);
|
|
245
|
-
const
|
|
246
|
+
const d = await fetch(a, {
|
|
246
247
|
method: "GET",
|
|
247
248
|
headers: n()
|
|
248
249
|
});
|
|
249
|
-
if (!
|
|
250
|
+
if (!d.ok)
|
|
250
251
|
throw new Error(
|
|
251
|
-
`Failed to get download URLs for ${o}/${t}: ${
|
|
252
|
+
`Failed to get download URLs for ${o}/${t}: ${d.statusText}`
|
|
252
253
|
);
|
|
253
|
-
|
|
254
|
+
const $ = (await d.json()).Data;
|
|
255
|
+
return Array.isArray($) && $.forEach((i) => {
|
|
256
|
+
i && i.DownloadUrl && !i.URL && (i.URL = i.DownloadUrl);
|
|
257
|
+
}), $;
|
|
254
258
|
},
|
|
255
259
|
async deleteAttachment(r, t, e) {
|
|
256
260
|
const a = await fetch(
|
|
@@ -267,13 +271,13 @@ function f(o) {
|
|
|
267
271
|
}
|
|
268
272
|
};
|
|
269
273
|
}
|
|
270
|
-
function
|
|
271
|
-
return
|
|
274
|
+
function y(o) {
|
|
275
|
+
return l(`/api/app/${o}`);
|
|
272
276
|
}
|
|
273
277
|
export {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
278
|
+
y as a,
|
|
279
|
+
u as b,
|
|
280
|
+
p as c,
|
|
277
281
|
n as g,
|
|
278
|
-
|
|
282
|
+
w as s
|
|
279
283
|
};
|