@ram_28/kf-ai-sdk 2.0.2 → 2.0.3
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/BaseField-B6da88U7.js +40 -0
- package/dist/BaseField-Drp0-OxL.cjs +1 -0
- package/dist/api/client.d.ts +7 -0
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api.cjs +1 -1
- package/dist/api.mjs +3 -3
- package/dist/auth.cjs +1 -1
- package/dist/auth.mjs +2 -2
- package/dist/bdo/core/BaseBdo.d.ts +4 -0
- package/dist/bdo/core/BaseBdo.d.ts.map +1 -1
- package/dist/bdo.cjs +1 -1
- package/dist/bdo.mjs +91 -118
- package/dist/client-BULEEaCP.js +222 -0
- package/dist/client-DtPpfJc1.cjs +1 -0
- package/dist/components/hooks/useForm/index.d.ts +1 -1
- package/dist/components/hooks/useForm/index.d.ts.map +1 -1
- package/dist/components/hooks/useForm/types.d.ts +15 -2
- package/dist/components/hooks/useForm/types.d.ts.map +1 -1
- package/dist/components/hooks/useForm/useDraftInteraction.d.ts +26 -0
- package/dist/components/hooks/useForm/useDraftInteraction.d.ts.map +1 -0
- package/dist/components/hooks/useForm/useForm.d.ts +1 -0
- package/dist/components/hooks/useForm/useForm.d.ts.map +1 -1
- package/dist/{constants-CM9xOACN.js → constants-BQrBcCON.js} +5 -5
- package/dist/error-handling-CAoD0Kwb.cjs +1 -0
- package/dist/error-handling-CrhTtD88.js +14 -0
- package/dist/filter.mjs +1 -1
- package/dist/form.cjs +1 -1
- package/dist/form.mjs +308 -1187
- package/dist/form.types.d.ts +1 -1
- package/dist/form.types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm-Cj63v5ny.js +1014 -0
- package/dist/index.esm-DuwT11sx.cjs +1 -0
- package/dist/{metadata-BN57S6W9.cjs → metadata-BJWukIqS.cjs} +1 -1
- package/dist/{metadata-P7DGCgIG.js → metadata-CJuFxytC.js} +1 -1
- package/dist/table.cjs +1 -1
- package/dist/table.mjs +83 -93
- package/dist/types/constants.d.ts +2 -2
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/workflow/Activity.d.ts +85 -0
- package/dist/workflow/Activity.d.ts.map +1 -0
- package/dist/workflow/ActivityInstance.d.ts +96 -0
- package/dist/workflow/ActivityInstance.d.ts.map +1 -0
- package/dist/workflow/client.d.ts +39 -0
- package/dist/workflow/client.d.ts.map +1 -0
- package/dist/workflow/components/useActivityForm/createActivityItemProxy.d.ts +16 -0
- package/dist/workflow/components/useActivityForm/createActivityItemProxy.d.ts.map +1 -0
- package/dist/workflow/components/useActivityForm/createActivityResolver.d.ts +22 -0
- package/dist/workflow/components/useActivityForm/createActivityResolver.d.ts.map +1 -0
- package/dist/workflow/components/useActivityForm/index.d.ts +3 -0
- package/dist/workflow/components/useActivityForm/index.d.ts.map +1 -0
- package/dist/workflow/components/useActivityForm/types.d.ts +80 -0
- package/dist/workflow/components/useActivityForm/types.d.ts.map +1 -0
- package/dist/workflow/components/useActivityForm/useActivityForm.d.ts +4 -0
- package/dist/workflow/components/useActivityForm/useActivityForm.d.ts.map +1 -0
- package/dist/workflow/index.d.ts +8 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/types.d.ts +53 -0
- package/dist/workflow/types.d.ts.map +1 -0
- package/dist/workflow.cjs +1 -0
- package/dist/workflow.d.ts +8 -0
- package/dist/workflow.d.ts.map +1 -0
- package/dist/workflow.mjs +565 -0
- package/dist/workflow.types.cjs +1 -0
- package/dist/workflow.types.d.ts +2 -0
- package/dist/workflow.types.d.ts.map +1 -0
- package/dist/workflow.types.mjs +1 -0
- package/docs/workflow.md +703 -0
- package/package.json +21 -1
- package/sdk/api/client.ts +85 -52
- package/sdk/api/index.ts +1 -0
- package/sdk/bdo/core/BaseBdo.ts +10 -0
- package/sdk/components/hooks/useForm/index.ts +1 -0
- package/sdk/components/hooks/useForm/types.ts +17 -3
- package/sdk/components/hooks/useForm/useDraftInteraction.ts +251 -0
- package/sdk/components/hooks/useForm/useForm.ts +106 -19
- package/sdk/form.types.ts +1 -0
- package/sdk/index.ts +6 -0
- package/sdk/types/constants.ts +2 -2
- package/sdk/workflow/Activity.ts +181 -0
- package/sdk/workflow/ActivityInstance.ts +339 -0
- package/sdk/workflow/client.ts +208 -0
- package/sdk/workflow/components/useActivityForm/createActivityItemProxy.ts +126 -0
- package/sdk/workflow/components/useActivityForm/createActivityResolver.ts +61 -0
- package/sdk/workflow/components/useActivityForm/index.ts +5 -0
- package/sdk/workflow/components/useActivityForm/types.ts +166 -0
- package/sdk/workflow/components/useActivityForm/useActivityForm.ts +386 -0
- package/sdk/workflow/index.ts +20 -0
- package/sdk/workflow/types.ts +84 -0
- package/sdk/workflow.ts +25 -0
- package/sdk/workflow.types.ts +11 -0
- package/dist/client-Bo-RLKJi.cjs +0 -1
- package/dist/client-eA4VvNTo.js +0 -178
package/dist/bdo.mjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
var
|
|
2
|
-
var y = (r, e, t) => e in r ?
|
|
3
|
-
var
|
|
4
|
-
import { a as u } from "./client-
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
var g = Object.defineProperty;
|
|
2
|
+
var y = (r, e, t) => e in r ? g(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var l = (r, e, t) => y(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { a as u } from "./client-BULEEaCP.js";
|
|
5
|
+
import { B as d } from "./BaseField-B6da88U7.js";
|
|
6
|
+
import { d as Y } from "./constants-BQrBcCON.js";
|
|
7
|
+
class m {
|
|
7
8
|
constructor(e, t) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
l(this, "_data");
|
|
10
|
+
l(this, "_bdo");
|
|
11
|
+
l(this, "_accessorCache", /* @__PURE__ */ new Map());
|
|
11
12
|
return this._bdo = e, this._data = { ...t }, new Proxy(this, {
|
|
12
13
|
get(s, a, i) {
|
|
13
14
|
return a === "validate" || a === "toJSON" || a === "_bdo" || a === "_data" || a === "_accessorCache" || a === "_getAccessor" || typeof a == "symbol" ? Reflect.get(s, a, i) : a === "_id" ? s._data._id : s._getAccessor(a);
|
|
@@ -49,7 +50,7 @@ class f {
|
|
|
49
50
|
_id: e,
|
|
50
51
|
Name: e,
|
|
51
52
|
Type: "String"
|
|
52
|
-
}, i = (s == null ? void 0 : s.readOnly) ?? !1,
|
|
53
|
+
}, i = (s == null ? void 0 : s.readOnly) ?? !1, n = () => {
|
|
53
54
|
if (s) {
|
|
54
55
|
const c = s.validate(this._data[e]);
|
|
55
56
|
if (!c.valid)
|
|
@@ -61,16 +62,16 @@ class f {
|
|
|
61
62
|
this.toJSON()
|
|
62
63
|
) : { valid: !0, errors: [] };
|
|
63
64
|
};
|
|
64
|
-
let
|
|
65
|
-
return i ?
|
|
65
|
+
let o;
|
|
66
|
+
return i ? o = {
|
|
66
67
|
label: (s == null ? void 0 : s.label) ?? e,
|
|
67
68
|
required: (s == null ? void 0 : s.required) ?? !1,
|
|
68
69
|
readOnly: !0,
|
|
69
70
|
defaultValue: s == null ? void 0 : s.defaultValue,
|
|
70
71
|
meta: a,
|
|
71
72
|
get: () => this._data[e],
|
|
72
|
-
validate:
|
|
73
|
-
} :
|
|
73
|
+
validate: n
|
|
74
|
+
} : o = {
|
|
74
75
|
label: (s == null ? void 0 : s.label) ?? e,
|
|
75
76
|
required: (s == null ? void 0 : s.required) ?? !1,
|
|
76
77
|
readOnly: !1,
|
|
@@ -80,8 +81,8 @@ class f {
|
|
|
80
81
|
set: (c) => {
|
|
81
82
|
this._data[e] = c;
|
|
82
83
|
},
|
|
83
|
-
validate:
|
|
84
|
-
}, this._accessorCache.set(e,
|
|
84
|
+
validate: n
|
|
85
|
+
}, this._accessorCache.set(e, o), o;
|
|
85
86
|
}
|
|
86
87
|
/**
|
|
87
88
|
* Validate all fields and return combined results
|
|
@@ -90,15 +91,15 @@ class f {
|
|
|
90
91
|
const e = this._bdo.getFields(), t = [], s = this.toJSON();
|
|
91
92
|
for (const [a, i] of Object.entries(e)) {
|
|
92
93
|
if (i.readOnly) continue;
|
|
93
|
-
const
|
|
94
|
-
if (!
|
|
95
|
-
t.push(...
|
|
94
|
+
const n = this._data[a], o = i.validate(n);
|
|
95
|
+
if (!o.valid) {
|
|
96
|
+
t.push(...o.errors);
|
|
96
97
|
continue;
|
|
97
98
|
}
|
|
98
99
|
if (this._bdo.hasMetadata()) {
|
|
99
100
|
const c = this._bdo.validateFieldExpression(
|
|
100
101
|
a,
|
|
101
|
-
|
|
102
|
+
n,
|
|
102
103
|
s
|
|
103
104
|
);
|
|
104
105
|
c.valid || t.push(...c.errors);
|
|
@@ -116,40 +117,6 @@ class f {
|
|
|
116
117
|
return { ...this._data };
|
|
117
118
|
}
|
|
118
119
|
}
|
|
119
|
-
class d {
|
|
120
|
-
constructor(e) {
|
|
121
|
-
/** Full raw backend meta */
|
|
122
|
-
n(this, "_meta");
|
|
123
|
-
n(this, "_parentBoId");
|
|
124
|
-
this._meta = e;
|
|
125
|
-
}
|
|
126
|
-
// === Convenience getters (transform backend naming → SDK naming) ===
|
|
127
|
-
get id() {
|
|
128
|
-
return this._meta._id;
|
|
129
|
-
}
|
|
130
|
-
get label() {
|
|
131
|
-
return this._meta.Name || this._meta._id;
|
|
132
|
-
}
|
|
133
|
-
get readOnly() {
|
|
134
|
-
return this._meta.ReadOnly ?? !1;
|
|
135
|
-
}
|
|
136
|
-
get required() {
|
|
137
|
-
var e;
|
|
138
|
-
return ((e = this._meta.Constraint) == null ? void 0 : e.Required) ?? this._meta.Required ?? !1;
|
|
139
|
-
}
|
|
140
|
-
get defaultValue() {
|
|
141
|
-
var e;
|
|
142
|
-
return this._meta.DefaultValue ?? ((e = this._meta.Constraint) == null ? void 0 : e.DefaultValue);
|
|
143
|
-
}
|
|
144
|
-
get primaryKey() {
|
|
145
|
-
var e;
|
|
146
|
-
return ((e = this._meta.Constraint) == null ? void 0 : e.PrimaryKey) ?? !1;
|
|
147
|
-
}
|
|
148
|
-
/** Full raw meta (the exact JSON passed to constructor) */
|
|
149
|
-
get meta() {
|
|
150
|
-
return this._meta;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
120
|
class h extends d {
|
|
154
121
|
constructor(e) {
|
|
155
122
|
super(e);
|
|
@@ -166,7 +133,7 @@ class h extends d {
|
|
|
166
133
|
} : { valid: !0, errors: [] };
|
|
167
134
|
}
|
|
168
135
|
}
|
|
169
|
-
class
|
|
136
|
+
class b extends d {
|
|
170
137
|
constructor(e) {
|
|
171
138
|
super(e);
|
|
172
139
|
}
|
|
@@ -190,7 +157,7 @@ class _ extends d {
|
|
|
190
157
|
} : { valid: !0, errors: [] };
|
|
191
158
|
}
|
|
192
159
|
}
|
|
193
|
-
class
|
|
160
|
+
class _ extends d {
|
|
194
161
|
constructor(e) {
|
|
195
162
|
super(e);
|
|
196
163
|
}
|
|
@@ -399,7 +366,7 @@ function p() {
|
|
|
399
366
|
}
|
|
400
367
|
};
|
|
401
368
|
}
|
|
402
|
-
function
|
|
369
|
+
function f(r, e) {
|
|
403
370
|
var t;
|
|
404
371
|
switch (r.Type) {
|
|
405
372
|
case "Literal":
|
|
@@ -413,11 +380,11 @@ function m(r, e) {
|
|
|
413
380
|
case "LogicalExpression":
|
|
414
381
|
return w(r, e);
|
|
415
382
|
case "CallExpression":
|
|
416
|
-
return O(r, e);
|
|
417
|
-
case "MemberExpression":
|
|
418
383
|
return E(r, e);
|
|
384
|
+
case "MemberExpression":
|
|
385
|
+
return O(r, e);
|
|
419
386
|
case "AssignmentExpression":
|
|
420
|
-
return ((t = r.Arguments) == null ? void 0 : t.length) === 1 ?
|
|
387
|
+
return ((t = r.Arguments) == null ? void 0 : t.length) === 1 ? f(r.Arguments[0], e) : void 0;
|
|
421
388
|
default:
|
|
422
389
|
throw new Error(`Unsupported expression type: ${r.Type}`);
|
|
423
390
|
}
|
|
@@ -429,7 +396,7 @@ function v(r, e) {
|
|
|
429
396
|
function x(r, e) {
|
|
430
397
|
if (!r.Arguments || r.Arguments.length < 2)
|
|
431
398
|
throw new Error("BinaryExpression requires 2 arguments");
|
|
432
|
-
const [t, s] = r.Arguments, a =
|
|
399
|
+
const [t, s] = r.Arguments, a = f(t, e), i = f(s, e);
|
|
433
400
|
switch (r.Operator) {
|
|
434
401
|
case "==":
|
|
435
402
|
return a == i;
|
|
@@ -463,29 +430,29 @@ function w(r, e) {
|
|
|
463
430
|
const t = r.Arguments;
|
|
464
431
|
switch (r.Operator) {
|
|
465
432
|
case "AND":
|
|
466
|
-
return t.every((s) => !!
|
|
433
|
+
return t.every((s) => !!f(s, e));
|
|
467
434
|
case "OR":
|
|
468
|
-
return t.some((s) => !!
|
|
435
|
+
return t.some((s) => !!f(s, e));
|
|
469
436
|
case "!":
|
|
470
|
-
return !
|
|
437
|
+
return !f(t[0], e);
|
|
471
438
|
default:
|
|
472
439
|
throw new Error(`Unsupported logical operator: ${r.Operator}`);
|
|
473
440
|
}
|
|
474
441
|
}
|
|
475
|
-
function
|
|
442
|
+
function E(r, e) {
|
|
476
443
|
if (!r.Callee)
|
|
477
444
|
throw new Error("CallExpression requires a Callee");
|
|
478
445
|
const t = N[r.Callee];
|
|
479
446
|
if (!t)
|
|
480
447
|
throw new Error(`Unknown function: ${r.Callee}`);
|
|
481
|
-
const s = (r.Arguments ?? []).map((a) =>
|
|
448
|
+
const s = (r.Arguments ?? []).map((a) => f(a, e));
|
|
482
449
|
return t(...s);
|
|
483
450
|
}
|
|
484
|
-
function
|
|
451
|
+
function O(r, e) {
|
|
485
452
|
var a, i;
|
|
486
453
|
if (!((a = r.Arguments) != null && a.length))
|
|
487
454
|
return;
|
|
488
|
-
const t =
|
|
455
|
+
const t = f(r.Arguments[0], e), s = (i = r.Arguments[0].Property) == null ? void 0 : i.Name;
|
|
489
456
|
return s && t && typeof t == "object" ? t[s] : t;
|
|
490
457
|
}
|
|
491
458
|
class F {
|
|
@@ -493,11 +460,11 @@ class F {
|
|
|
493
460
|
/**
|
|
494
461
|
* Map of field ID to its validation rules
|
|
495
462
|
*/
|
|
496
|
-
|
|
463
|
+
l(this, "fieldRules", /* @__PURE__ */ new Map());
|
|
497
464
|
/**
|
|
498
465
|
* The loaded BDO metadata
|
|
499
466
|
*/
|
|
500
|
-
|
|
467
|
+
l(this, "metadata", null);
|
|
501
468
|
}
|
|
502
469
|
/**
|
|
503
470
|
* Load metadata and extract field validation rules
|
|
@@ -513,17 +480,17 @@ class F {
|
|
|
513
480
|
var t, s;
|
|
514
481
|
this.metadata = e, this.fieldRules.clear();
|
|
515
482
|
for (const [a, i] of Object.entries(e.Fields)) {
|
|
516
|
-
const
|
|
483
|
+
const n = [];
|
|
517
484
|
if (i.Validation && Array.isArray(i.Validation)) {
|
|
518
|
-
for (const
|
|
519
|
-
if (typeof
|
|
520
|
-
|
|
521
|
-
else if (typeof
|
|
522
|
-
const c = (s = (t = e.Rules) == null ? void 0 : t.Validation) == null ? void 0 : s[
|
|
523
|
-
c &&
|
|
485
|
+
for (const o of i.Validation)
|
|
486
|
+
if (typeof o == "object" && o.ExpressionTree)
|
|
487
|
+
n.push(o);
|
|
488
|
+
else if (typeof o == "string") {
|
|
489
|
+
const c = (s = (t = e.Rules) == null ? void 0 : t.Validation) == null ? void 0 : s[o];
|
|
490
|
+
c && n.push(c);
|
|
524
491
|
}
|
|
525
492
|
}
|
|
526
|
-
|
|
493
|
+
n.length > 0 && this.fieldRules.set(a, n);
|
|
527
494
|
}
|
|
528
495
|
}
|
|
529
496
|
/**
|
|
@@ -563,17 +530,17 @@ class F {
|
|
|
563
530
|
formValues: { ...s, [e]: t },
|
|
564
531
|
systemValues: p()
|
|
565
532
|
};
|
|
566
|
-
for (const
|
|
533
|
+
for (const n of a)
|
|
567
534
|
try {
|
|
568
|
-
if (!
|
|
535
|
+
if (!f(n.ExpressionTree, i))
|
|
569
536
|
return {
|
|
570
537
|
valid: !1,
|
|
571
|
-
errors: [
|
|
538
|
+
errors: [n.Message || `Validation failed: ${n.Name || n.Id}`]
|
|
572
539
|
};
|
|
573
|
-
} catch (
|
|
540
|
+
} catch (o) {
|
|
574
541
|
console.warn(
|
|
575
|
-
`Expression evaluation failed for rule ${
|
|
576
|
-
|
|
542
|
+
`Expression evaluation failed for rule ${n.Id}:`,
|
|
543
|
+
o
|
|
577
544
|
);
|
|
578
545
|
}
|
|
579
546
|
return { valid: !0, errors: [] };
|
|
@@ -604,31 +571,31 @@ class C {
|
|
|
604
571
|
// ============================================================
|
|
605
572
|
// SYSTEM FIELDS (inherited by all BDOs)
|
|
606
573
|
// ============================================================
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
574
|
+
l(this, "_id", new h({ _id: "_id", Name: "ID", Type: "String", ReadOnly: !0 }));
|
|
575
|
+
l(this, "_created_at", new b({ _id: "_created_at", Name: "Created At", Type: "DateTime", ReadOnly: !0 }));
|
|
576
|
+
l(this, "_modified_at", new b({ _id: "_modified_at", Name: "Modified At", Type: "DateTime", ReadOnly: !0 }));
|
|
577
|
+
l(this, "_created_by", new _({ _id: "_created_by", Name: "Created By", Type: "User", ReadOnly: !0 }));
|
|
578
|
+
l(this, "_modified_by", new _({ _id: "_modified_by", Name: "Modified By", Type: "User", ReadOnly: !0 }));
|
|
579
|
+
l(this, "_version", new h({ _id: "_version", Name: "Version", Type: "String", ReadOnly: !0 }));
|
|
580
|
+
l(this, "_m_version", new h({ _id: "_m_version", Name: "Metadata Version", Type: "String", ReadOnly: !0 }));
|
|
614
581
|
// ============================================================
|
|
615
582
|
// FIELD DEFINITIONS (auto-discovered)
|
|
616
583
|
// ============================================================
|
|
617
584
|
/**
|
|
618
585
|
* Whether fields have been bound to this BDO
|
|
619
586
|
*/
|
|
620
|
-
|
|
587
|
+
l(this, "_fieldsBound", !1);
|
|
621
588
|
/**
|
|
622
589
|
* Cached field map
|
|
623
590
|
*/
|
|
624
|
-
|
|
591
|
+
l(this, "_fieldsCache", null);
|
|
625
592
|
// ============================================================
|
|
626
593
|
// EXPRESSION ENGINE (for backend validation rules)
|
|
627
594
|
// ============================================================
|
|
628
595
|
/**
|
|
629
596
|
* Expression engine instance for evaluating backend validation rules
|
|
630
597
|
*/
|
|
631
|
-
|
|
598
|
+
l(this, "_expressionEngine", new F());
|
|
632
599
|
}
|
|
633
600
|
/**
|
|
634
601
|
* Get all field definitions (system + business) with automatic binding.
|
|
@@ -693,14 +660,14 @@ class C {
|
|
|
693
660
|
*/
|
|
694
661
|
async get(e) {
|
|
695
662
|
const t = await u(this.meta._id).get(e);
|
|
696
|
-
return new
|
|
663
|
+
return new m(this, t);
|
|
697
664
|
}
|
|
698
665
|
/**
|
|
699
666
|
* List records with optional filtering, sorting, and pagination
|
|
700
667
|
*/
|
|
701
668
|
async list(e) {
|
|
702
669
|
return (await u(this.meta._id).list(e)).Data.map(
|
|
703
|
-
(s) => new
|
|
670
|
+
(s) => new m(this, s)
|
|
704
671
|
);
|
|
705
672
|
}
|
|
706
673
|
/**
|
|
@@ -718,7 +685,7 @@ class C {
|
|
|
718
685
|
*/
|
|
719
686
|
async create(e) {
|
|
720
687
|
const t = await u(this.meta._id).create(e);
|
|
721
|
-
return new
|
|
688
|
+
return new m(
|
|
722
689
|
this,
|
|
723
690
|
{ ...e, _id: t._id }
|
|
724
691
|
);
|
|
@@ -762,7 +729,13 @@ class C {
|
|
|
762
729
|
* Use this when you need get/set/validate methods on fields
|
|
763
730
|
*/
|
|
764
731
|
createItem(e) {
|
|
765
|
-
return new
|
|
732
|
+
return new m(this, e ?? {});
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
735
|
+
* Commit an update draft - finalize changes on an existing record
|
|
736
|
+
*/
|
|
737
|
+
async draftUpdate(e, t) {
|
|
738
|
+
return u(this.meta._id).draftUpdate(e, t);
|
|
766
739
|
}
|
|
767
740
|
/**
|
|
768
741
|
* Patch an existing draft - compute fields during editing
|
|
@@ -805,7 +778,7 @@ class R extends d {
|
|
|
805
778
|
} : { valid: !0, errors: [] };
|
|
806
779
|
}
|
|
807
780
|
}
|
|
808
|
-
class
|
|
781
|
+
class S extends d {
|
|
809
782
|
constructor(e) {
|
|
810
783
|
super(e);
|
|
811
784
|
}
|
|
@@ -816,7 +789,7 @@ class M extends d {
|
|
|
816
789
|
} : { valid: !0, errors: [] };
|
|
817
790
|
}
|
|
818
791
|
}
|
|
819
|
-
class
|
|
792
|
+
class D extends d {
|
|
820
793
|
constructor(e) {
|
|
821
794
|
super(e);
|
|
822
795
|
}
|
|
@@ -840,7 +813,7 @@ class S extends d {
|
|
|
840
813
|
} : { valid: !0, errors: [] };
|
|
841
814
|
}
|
|
842
815
|
}
|
|
843
|
-
class
|
|
816
|
+
class V extends d {
|
|
844
817
|
constructor(e) {
|
|
845
818
|
super(e);
|
|
846
819
|
}
|
|
@@ -877,7 +850,7 @@ class D extends d {
|
|
|
877
850
|
}));
|
|
878
851
|
}
|
|
879
852
|
}
|
|
880
|
-
class
|
|
853
|
+
class B extends d {
|
|
881
854
|
constructor(e) {
|
|
882
855
|
super(e);
|
|
883
856
|
}
|
|
@@ -918,7 +891,7 @@ class V extends d {
|
|
|
918
891
|
return u(this._parentBoId).fetchField(e ?? "new", this.id);
|
|
919
892
|
}
|
|
920
893
|
}
|
|
921
|
-
class
|
|
894
|
+
class $ extends d {
|
|
922
895
|
constructor(e) {
|
|
923
896
|
super(e);
|
|
924
897
|
}
|
|
@@ -933,7 +906,7 @@ class B extends d {
|
|
|
933
906
|
} : { valid: !0, errors: [] };
|
|
934
907
|
}
|
|
935
908
|
}
|
|
936
|
-
class
|
|
909
|
+
class j extends d {
|
|
937
910
|
constructor(e) {
|
|
938
911
|
super(e);
|
|
939
912
|
}
|
|
@@ -948,7 +921,7 @@ class $ extends d {
|
|
|
948
921
|
} : { valid: !0, errors: [] };
|
|
949
922
|
}
|
|
950
923
|
}
|
|
951
|
-
class
|
|
924
|
+
class U extends d {
|
|
952
925
|
constructor(e) {
|
|
953
926
|
super(e);
|
|
954
927
|
}
|
|
@@ -964,7 +937,7 @@ class j extends d {
|
|
|
964
937
|
} : { valid: !0, errors: [] };
|
|
965
938
|
}
|
|
966
939
|
}
|
|
967
|
-
class
|
|
940
|
+
class P extends d {
|
|
968
941
|
constructor(e) {
|
|
969
942
|
super(e);
|
|
970
943
|
}
|
|
@@ -976,20 +949,20 @@ class U extends d {
|
|
|
976
949
|
}
|
|
977
950
|
}
|
|
978
951
|
export {
|
|
979
|
-
|
|
952
|
+
$ as ArrayField,
|
|
980
953
|
C as BaseBdo,
|
|
981
954
|
d as BaseField,
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
955
|
+
S as BooleanField,
|
|
956
|
+
D as DateField,
|
|
957
|
+
b as DateTimeField,
|
|
958
|
+
P as FileField,
|
|
986
959
|
R as NumberField,
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
960
|
+
j as ObjectField,
|
|
961
|
+
B as ReferenceField,
|
|
962
|
+
V as SelectField,
|
|
990
963
|
h as StringField,
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
964
|
+
Y as SystemField,
|
|
965
|
+
U as TextAreaField,
|
|
966
|
+
U as TextField,
|
|
967
|
+
_ as UserField
|
|
995
968
|
};
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
let a = {
|
|
2
|
+
baseUrl: "",
|
|
3
|
+
headers: {
|
|
4
|
+
"Content-Type": "application/json"
|
|
5
|
+
}
|
|
6
|
+
};
|
|
7
|
+
function u(o) {
|
|
8
|
+
a.baseUrl = o;
|
|
9
|
+
}
|
|
10
|
+
function w(o) {
|
|
11
|
+
a.headers = { ...a.headers, ...o };
|
|
12
|
+
}
|
|
13
|
+
function n() {
|
|
14
|
+
return { ...a.headers };
|
|
15
|
+
}
|
|
16
|
+
function y() {
|
|
17
|
+
return a.baseUrl || "";
|
|
18
|
+
}
|
|
19
|
+
function f(o) {
|
|
20
|
+
const s = a.baseUrl;
|
|
21
|
+
return {
|
|
22
|
+
async get(t) {
|
|
23
|
+
const e = await fetch(`${s}${o}/${t}/read`, {
|
|
24
|
+
method: "GET",
|
|
25
|
+
headers: n()
|
|
26
|
+
});
|
|
27
|
+
if (!e.ok)
|
|
28
|
+
throw new Error(
|
|
29
|
+
`Failed to get ${o} ${t}: ${e.statusText}`
|
|
30
|
+
);
|
|
31
|
+
return (await e.json()).Data;
|
|
32
|
+
},
|
|
33
|
+
async create(t) {
|
|
34
|
+
const e = await fetch(`${s}${o}/create`, {
|
|
35
|
+
method: "POST",
|
|
36
|
+
headers: n(),
|
|
37
|
+
body: JSON.stringify(t)
|
|
38
|
+
});
|
|
39
|
+
if (!e.ok)
|
|
40
|
+
throw new Error(`Failed to create ${o}: ${e.statusText}`);
|
|
41
|
+
return e.json();
|
|
42
|
+
},
|
|
43
|
+
async update(t, e) {
|
|
44
|
+
const r = await fetch(`${s}${o}/${t}/update`, {
|
|
45
|
+
method: "POST",
|
|
46
|
+
headers: n(),
|
|
47
|
+
body: JSON.stringify(e)
|
|
48
|
+
});
|
|
49
|
+
if (!r.ok)
|
|
50
|
+
throw new Error(
|
|
51
|
+
`Failed to update ${o} ${t}: ${r.statusText}`
|
|
52
|
+
);
|
|
53
|
+
return r.json();
|
|
54
|
+
},
|
|
55
|
+
async delete(t) {
|
|
56
|
+
const e = await fetch(`${s}${o}/${t}/delete`, {
|
|
57
|
+
method: "DELETE",
|
|
58
|
+
headers: n()
|
|
59
|
+
});
|
|
60
|
+
if (!e.ok)
|
|
61
|
+
throw new Error(
|
|
62
|
+
`Failed to delete ${o} ${t}: ${e.statusText}`
|
|
63
|
+
);
|
|
64
|
+
return e.json();
|
|
65
|
+
},
|
|
66
|
+
async list(t) {
|
|
67
|
+
const e = {
|
|
68
|
+
Type: "List",
|
|
69
|
+
...t
|
|
70
|
+
}, r = await fetch(`${s}${o}/list`, {
|
|
71
|
+
method: "POST",
|
|
72
|
+
headers: n(),
|
|
73
|
+
body: JSON.stringify(e)
|
|
74
|
+
});
|
|
75
|
+
if (!r.ok)
|
|
76
|
+
throw new Error(`Failed to list ${o}: ${r.statusText}`);
|
|
77
|
+
return await r.json();
|
|
78
|
+
},
|
|
79
|
+
async count(t) {
|
|
80
|
+
var d, c;
|
|
81
|
+
const e = {
|
|
82
|
+
Type: "Metric",
|
|
83
|
+
GroupBy: [],
|
|
84
|
+
Metric: [{ Field: "_id", Type: "Count" }],
|
|
85
|
+
...(t == null ? void 0 : t.Filter) && { Filter: t.Filter }
|
|
86
|
+
}, r = await fetch(`${s}${o}/metric`, {
|
|
87
|
+
method: "POST",
|
|
88
|
+
headers: n(),
|
|
89
|
+
body: JSON.stringify(e)
|
|
90
|
+
});
|
|
91
|
+
if (!r.ok)
|
|
92
|
+
throw new Error(`Failed to count ${o}: ${r.statusText}`);
|
|
93
|
+
return { Count: ((c = (d = (await r.json()).Data) == null ? void 0 : d[0]) == null ? void 0 : c.count__id) ?? 0 };
|
|
94
|
+
},
|
|
95
|
+
// ============================================================
|
|
96
|
+
// DRAFT/INTERACTIVE OPERATIONS
|
|
97
|
+
// ============================================================
|
|
98
|
+
async draft(t) {
|
|
99
|
+
const e = await fetch(`${s}${o}/draft`, {
|
|
100
|
+
method: "POST",
|
|
101
|
+
headers: n(),
|
|
102
|
+
body: JSON.stringify(t)
|
|
103
|
+
});
|
|
104
|
+
if (!e.ok)
|
|
105
|
+
throw new Error(
|
|
106
|
+
`Failed to create draft for ${o}: ${e.statusText}`
|
|
107
|
+
);
|
|
108
|
+
return e.json();
|
|
109
|
+
},
|
|
110
|
+
async draftUpdate(t, e) {
|
|
111
|
+
const r = await fetch(`${s}${o}/${t}/draft`, {
|
|
112
|
+
method: "POST",
|
|
113
|
+
headers: n(),
|
|
114
|
+
body: JSON.stringify(e)
|
|
115
|
+
});
|
|
116
|
+
if (!r.ok)
|
|
117
|
+
throw new Error(
|
|
118
|
+
`Failed to update draft for ${o} ${t}: ${r.statusText}`
|
|
119
|
+
);
|
|
120
|
+
return r.json();
|
|
121
|
+
},
|
|
122
|
+
async draftPatch(t, e) {
|
|
123
|
+
const r = await fetch(`${s}${o}/${t}/draft`, {
|
|
124
|
+
method: "PATCH",
|
|
125
|
+
headers: n(),
|
|
126
|
+
body: JSON.stringify(e)
|
|
127
|
+
});
|
|
128
|
+
if (!r.ok)
|
|
129
|
+
throw new Error(
|
|
130
|
+
`Failed to patch draft for ${o} ${t}: ${r.statusText}`
|
|
131
|
+
);
|
|
132
|
+
return r.json();
|
|
133
|
+
},
|
|
134
|
+
async draftInteraction(t) {
|
|
135
|
+
const e = await fetch(`${s}${o}/draft`, {
|
|
136
|
+
method: "PATCH",
|
|
137
|
+
headers: n(),
|
|
138
|
+
body: JSON.stringify(t)
|
|
139
|
+
});
|
|
140
|
+
if (!e.ok)
|
|
141
|
+
throw new Error(
|
|
142
|
+
`Failed to create interactive draft for ${o}: ${e.statusText}`
|
|
143
|
+
);
|
|
144
|
+
const r = await e.json();
|
|
145
|
+
return {
|
|
146
|
+
...r.Data,
|
|
147
|
+
_id: r.Data._id
|
|
148
|
+
};
|
|
149
|
+
},
|
|
150
|
+
// ============================================================
|
|
151
|
+
// QUERY OPERATIONS
|
|
152
|
+
// ============================================================
|
|
153
|
+
async metric(t) {
|
|
154
|
+
const e = {
|
|
155
|
+
Type: "Metric",
|
|
156
|
+
...t
|
|
157
|
+
}, r = await fetch(`${s}${o}/metric`, {
|
|
158
|
+
method: "POST",
|
|
159
|
+
headers: n(),
|
|
160
|
+
body: JSON.stringify(e)
|
|
161
|
+
});
|
|
162
|
+
if (!r.ok)
|
|
163
|
+
throw new Error(
|
|
164
|
+
`Failed to get metrics for ${o}: ${r.statusText}`
|
|
165
|
+
);
|
|
166
|
+
return r.json();
|
|
167
|
+
},
|
|
168
|
+
async pivot(t) {
|
|
169
|
+
const e = {
|
|
170
|
+
Type: "Pivot",
|
|
171
|
+
...t
|
|
172
|
+
}, r = await fetch(`${s}${o}/pivot`, {
|
|
173
|
+
method: "POST",
|
|
174
|
+
headers: n(),
|
|
175
|
+
body: JSON.stringify(e)
|
|
176
|
+
});
|
|
177
|
+
if (!r.ok)
|
|
178
|
+
throw new Error(
|
|
179
|
+
`Failed to get pivot data for ${o}: ${r.statusText}`
|
|
180
|
+
);
|
|
181
|
+
return r.json();
|
|
182
|
+
},
|
|
183
|
+
// ============================================================
|
|
184
|
+
// METADATA OPERATIONS
|
|
185
|
+
// ============================================================
|
|
186
|
+
async fields() {
|
|
187
|
+
const t = await fetch(`${s}${o}/fields`, {
|
|
188
|
+
method: "GET",
|
|
189
|
+
headers: n()
|
|
190
|
+
});
|
|
191
|
+
if (!t.ok)
|
|
192
|
+
throw new Error(
|
|
193
|
+
`Failed to get fields for ${o}: ${t.statusText}`
|
|
194
|
+
);
|
|
195
|
+
return t.json();
|
|
196
|
+
},
|
|
197
|
+
async fetchField(t, e) {
|
|
198
|
+
const r = await fetch(
|
|
199
|
+
`${s}${o}/${t}/field/${e}/fetch`,
|
|
200
|
+
{
|
|
201
|
+
method: "GET",
|
|
202
|
+
headers: n()
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
if (!r.ok)
|
|
206
|
+
throw new Error(
|
|
207
|
+
`Failed to fetch field ${e} for ${o}: ${r.statusText}`
|
|
208
|
+
);
|
|
209
|
+
return (await r.json()).Data;
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
function l(o) {
|
|
214
|
+
return f(`/api/app/${o}`);
|
|
215
|
+
}
|
|
216
|
+
export {
|
|
217
|
+
l as a,
|
|
218
|
+
w as b,
|
|
219
|
+
y as c,
|
|
220
|
+
n as g,
|
|
221
|
+
u as s
|
|
222
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";let a={baseUrl:"",headers:{"Content-Type":"application/json"}};function f(o){a.baseUrl=o}function $(o){a.headers={...a.headers,...o}}function s(){return{...a.headers}}function u(){return a.baseUrl||""}function l(o){const n=a.baseUrl;return{async get(t){const e=await fetch(`${n}${o}/${t}/read`,{method:"GET",headers:s()});if(!e.ok)throw new Error(`Failed to get ${o} ${t}: ${e.statusText}`);return(await e.json()).Data},async create(t){const e=await fetch(`${n}${o}/create`,{method:"POST",headers:s(),body:JSON.stringify(t)});if(!e.ok)throw new Error(`Failed to create ${o}: ${e.statusText}`);return e.json()},async update(t,e){const r=await fetch(`${n}${o}/${t}/update`,{method:"POST",headers:s(),body:JSON.stringify(e)});if(!r.ok)throw new Error(`Failed to update ${o} ${t}: ${r.statusText}`);return r.json()},async delete(t){const e=await fetch(`${n}${o}/${t}/delete`,{method:"DELETE",headers:s()});if(!e.ok)throw new Error(`Failed to delete ${o} ${t}: ${e.statusText}`);return e.json()},async list(t){const e={Type:"List",...t},r=await fetch(`${n}${o}/list`,{method:"POST",headers:s(),body:JSON.stringify(e)});if(!r.ok)throw new Error(`Failed to list ${o}: ${r.statusText}`);return await r.json()},async count(t){var d,c;const e={Type:"Metric",GroupBy:[],Metric:[{Field:"_id",Type:"Count"}],...(t==null?void 0:t.Filter)&&{Filter:t.Filter}},r=await fetch(`${n}${o}/metric`,{method:"POST",headers:s(),body:JSON.stringify(e)});if(!r.ok)throw new Error(`Failed to count ${o}: ${r.statusText}`);return{Count:((c=(d=(await r.json()).Data)==null?void 0:d[0])==null?void 0:c.count__id)??0}},async draft(t){const e=await fetch(`${n}${o}/draft`,{method:"POST",headers:s(),body:JSON.stringify(t)});if(!e.ok)throw new Error(`Failed to create draft for ${o}: ${e.statusText}`);return e.json()},async draftUpdate(t,e){const r=await fetch(`${n}${o}/${t}/draft`,{method:"POST",headers:s(),body:JSON.stringify(e)});if(!r.ok)throw new Error(`Failed to update draft for ${o} ${t}: ${r.statusText}`);return r.json()},async draftPatch(t,e){const r=await fetch(`${n}${o}/${t}/draft`,{method:"PATCH",headers:s(),body:JSON.stringify(e)});if(!r.ok)throw new Error(`Failed to patch draft for ${o} ${t}: ${r.statusText}`);return r.json()},async draftInteraction(t){const e=await fetch(`${n}${o}/draft`,{method:"PATCH",headers:s(),body:JSON.stringify(t)});if(!e.ok)throw new Error(`Failed to create interactive draft for ${o}: ${e.statusText}`);const r=await e.json();return{...r.Data,_id:r.Data._id}},async metric(t){const e={Type:"Metric",...t},r=await fetch(`${n}${o}/metric`,{method:"POST",headers:s(),body:JSON.stringify(e)});if(!r.ok)throw new Error(`Failed to get metrics for ${o}: ${r.statusText}`);return r.json()},async pivot(t){const e={Type:"Pivot",...t},r=await fetch(`${n}${o}/pivot`,{method:"POST",headers:s(),body:JSON.stringify(e)});if(!r.ok)throw new Error(`Failed to get pivot data for ${o}: ${r.statusText}`);return r.json()},async fields(){const t=await fetch(`${n}${o}/fields`,{method:"GET",headers:s()});if(!t.ok)throw new Error(`Failed to get fields for ${o}: ${t.statusText}`);return t.json()},async fetchField(t,e){const r=await fetch(`${n}${o}/${t}/field/${e}/fetch`,{method:"GET",headers:s()});if(!r.ok)throw new Error(`Failed to fetch field ${e} for ${o}: ${r.statusText}`);return(await r.json()).Data}}}function w(o){return l(`/api/app/${o}`)}exports.api=w;exports.getApiBaseUrl=u;exports.getDefaultHeaders=s;exports.setApiBaseUrl=f;exports.setDefaultHeaders=$;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { useForm } from "./useForm";
|
|
2
2
|
export { createResolver } from "./createResolver";
|
|
3
3
|
export { createItemProxy } from "./createItemProxy";
|
|
4
|
-
export type { UseFormOptionsType, UseFormReturnType, FormItemType, EditableFormFieldAccessorType, ReadonlyFormFieldAccessorType, FormRegisterType, HandleSubmitType, ExtractEditableType, ExtractReadonlyType, AllFieldsType, CreatableBdo, UpdatableBdo, FormBdo, } from "./types";
|
|
4
|
+
export type { UseFormOptionsType, UseFormReturnType, FormItemType, EditableFormFieldAccessorType, ReadonlyFormFieldAccessorType, FormRegisterType, HandleSubmitType, ExtractEditableType, ExtractReadonlyType, AllFieldsType, CreatableBdo, UpdatableBdo, FormBdo, InteractiveCreatableBdo, } from "./types";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|