@ram_28/kf-ai-sdk 2.0.0 → 2.0.2
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 +36 -39
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/metadata.d.ts +26 -22
- package/dist/api/metadata.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/base-types.d.ts +1 -1
- package/dist/base-types.d.ts.map +1 -1
- package/dist/bdo/core/BaseBdo.d.ts +8 -20
- package/dist/bdo/core/BaseBdo.d.ts.map +1 -1
- package/dist/bdo/core/Item.d.ts +8 -44
- package/dist/bdo/core/Item.d.ts.map +1 -1
- package/dist/bdo/core/types.d.ts +124 -41
- package/dist/bdo/core/types.d.ts.map +1 -1
- package/dist/bdo/fields/ArrayField.d.ts +5 -4
- package/dist/bdo/fields/ArrayField.d.ts.map +1 -1
- package/dist/bdo/fields/BaseField.d.ts +14 -19
- package/dist/bdo/fields/BaseField.d.ts.map +1 -1
- package/dist/bdo/fields/BooleanField.d.ts +3 -4
- package/dist/bdo/fields/BooleanField.d.ts.map +1 -1
- package/dist/bdo/fields/DateField.d.ts +18 -0
- package/dist/bdo/fields/DateField.d.ts.map +1 -0
- package/dist/bdo/fields/DateTimeField.d.ts +5 -4
- package/dist/bdo/fields/DateTimeField.d.ts.map +1 -1
- package/dist/bdo/fields/FileField.d.ts +18 -0
- package/dist/bdo/fields/FileField.d.ts.map +1 -0
- package/dist/bdo/fields/NumberField.d.ts +6 -4
- package/dist/bdo/fields/NumberField.d.ts.map +1 -1
- package/dist/bdo/fields/ObjectField.d.ts +20 -0
- package/dist/bdo/fields/ObjectField.d.ts.map +1 -0
- package/dist/bdo/fields/ReferenceField.d.ts +13 -14
- package/dist/bdo/fields/ReferenceField.d.ts.map +1 -1
- package/dist/bdo/fields/SelectField.d.ts +10 -17
- package/dist/bdo/fields/SelectField.d.ts.map +1 -1
- package/dist/bdo/fields/StringField.d.ts +6 -4
- package/dist/bdo/fields/StringField.d.ts.map +1 -1
- package/dist/bdo/fields/TextAreaField.d.ts +2 -0
- package/dist/bdo/fields/TextAreaField.d.ts.map +1 -0
- package/dist/bdo/fields/TextField.d.ts +22 -0
- package/dist/bdo/fields/TextField.d.ts.map +1 -0
- package/dist/bdo/fields/UserField.d.ts +20 -0
- package/dist/bdo/fields/UserField.d.ts.map +1 -0
- package/dist/bdo/fields/index.d.ts +6 -0
- package/dist/bdo/fields/index.d.ts.map +1 -1
- package/dist/bdo/index.d.ts +2 -2
- package/dist/bdo/index.d.ts.map +1 -1
- package/dist/bdo.cjs +1 -1
- package/dist/bdo.d.ts +1 -5
- package/dist/bdo.d.ts.map +1 -1
- package/dist/bdo.mjs +349 -230
- package/dist/bdo.types.d.ts +2 -3
- package/dist/bdo.types.d.ts.map +1 -1
- package/dist/client-Bo-RLKJi.cjs +1 -0
- package/dist/client-eA4VvNTo.js +178 -0
- package/dist/components/hooks/useFilter/useFilter.d.ts.map +1 -1
- package/dist/components/hooks/useForm/createItemProxy.d.ts.map +1 -1
- package/dist/components/hooks/useForm/createResolver.d.ts +12 -2
- package/dist/components/hooks/useForm/createResolver.d.ts.map +1 -1
- 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 +62 -6
- package/dist/components/hooks/useForm/types.d.ts.map +1 -1
- package/dist/components/hooks/useForm/useForm.d.ts +1 -27
- package/dist/components/hooks/useForm/useForm.d.ts.map +1 -1
- package/dist/components/hooks/useTable/useTable.d.ts.map +1 -1
- package/dist/{constants-DaX7GLgl.js → constants-CM9xOACN.js} +37 -13
- package/dist/constants-D0J69if5.cjs +1 -0
- package/dist/filter.cjs +1 -1
- package/dist/filter.mjs +2 -2
- package/dist/form.cjs +1 -1
- package/dist/form.d.ts +1 -1
- package/dist/form.d.ts.map +1 -1
- package/dist/form.mjs +879 -809
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/{metadata-Bz8zJqC1.cjs → metadata-BN57S6W9.cjs} +1 -1
- package/dist/{metadata-VbQzyD2C.js → metadata-P7DGCgIG.js} +1 -1
- package/dist/table.cjs +1 -1
- package/dist/table.mjs +74 -70
- package/dist/types/base-fields.d.ts +25 -60
- package/dist/types/base-fields.d.ts.map +1 -1
- package/dist/types/constants.d.ts +6 -0
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/useFilter-Bg0jvIL6.cjs +1 -0
- package/dist/useFilter-DPNLKY3H.js +118 -0
- package/dist/utils/formatting.d.ts +10 -1
- package/dist/utils/formatting.d.ts.map +1 -1
- package/docs/api.md +140 -572
- package/docs/bdo.md +742 -0
- package/docs/useAuth.md +10 -4
- package/docs/useFilter.md +40 -40
- package/docs/useForm.md +91 -62
- package/docs/useTable.md +38 -38
- package/package.json +1 -1
- package/sdk/api/client.ts +52 -65
- package/sdk/api/metadata.ts +22 -20
- package/sdk/base-types.ts +9 -9
- package/sdk/bdo/core/BaseBdo.ts +13 -38
- package/sdk/bdo/core/Item.ts +34 -56
- package/sdk/bdo/core/types.ts +147 -45
- package/sdk/bdo/fields/ArrayField.ts +9 -5
- package/sdk/bdo/fields/BaseField.ts +19 -29
- package/sdk/bdo/fields/BooleanField.ts +4 -5
- package/sdk/bdo/fields/DateField.ts +55 -0
- package/sdk/bdo/fields/DateTimeField.ts +9 -5
- package/sdk/bdo/fields/FileField.ts +39 -0
- package/sdk/bdo/fields/NumberField.ts +8 -5
- package/sdk/bdo/fields/ObjectField.ts +46 -0
- package/sdk/bdo/fields/ReferenceField.ts +22 -28
- package/sdk/bdo/fields/SelectField.ts +15 -28
- package/sdk/bdo/fields/StringField.ts +10 -5
- package/sdk/bdo/fields/TextAreaField.ts +6 -0
- package/sdk/bdo/fields/TextField.ts +42 -0
- package/sdk/bdo/fields/UserField.ts +52 -0
- package/sdk/bdo/fields/index.ts +6 -0
- package/sdk/bdo/index.ts +19 -4
- package/sdk/bdo.ts +7 -28
- package/sdk/bdo.types.ts +26 -21
- package/sdk/components/hooks/useFilter/useFilter.ts +13 -30
- package/sdk/components/hooks/useForm/createItemProxy.ts +47 -11
- package/sdk/components/hooks/useForm/createResolver.ts +65 -6
- package/sdk/components/hooks/useForm/index.ts +3 -0
- package/sdk/components/hooks/useForm/types.ts +75 -6
- package/sdk/components/hooks/useForm/useForm.ts +35 -50
- package/sdk/components/hooks/useTable/useTable.ts +10 -2
- package/sdk/form.ts +1 -12
- package/sdk/index.ts +3 -3
- package/sdk/types/base-fields.ts +29 -73
- package/sdk/types/constants.ts +6 -0
- package/sdk/utils/formatting.ts +13 -1
- package/dist/client-BIkaIr2y.js +0 -217
- package/dist/client-DxjRcEtN.cjs +0 -1
- package/dist/constants-C49b9Exc.cjs +0 -1
- package/dist/useFilter-DzpP_ag0.cjs +0 -1
- package/dist/useFilter-H5bgAZQF.js +0 -120
package/dist/bdo.mjs
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
var
|
|
2
|
-
var y = (r, e, t) => e in r ?
|
|
1
|
+
var b = Object.defineProperty;
|
|
2
|
+
var y = (r, e, t) => e in r ? b(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
3
|
var n = (r, e, t) => y(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { a as u } from "./client-
|
|
5
|
-
import { d as
|
|
6
|
-
class
|
|
4
|
+
import { a as u } from "./client-eA4VvNTo.js";
|
|
5
|
+
import { d as L } from "./constants-CM9xOACN.js";
|
|
6
|
+
class f {
|
|
7
7
|
constructor(e, t) {
|
|
8
8
|
n(this, "_data");
|
|
9
9
|
n(this, "_bdo");
|
|
10
10
|
n(this, "_accessorCache", /* @__PURE__ */ new Map());
|
|
11
11
|
return this._bdo = e, this._data = { ...t }, new Proxy(this, {
|
|
12
|
-
get(
|
|
13
|
-
return
|
|
12
|
+
get(s, a, i) {
|
|
13
|
+
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);
|
|
14
14
|
},
|
|
15
|
-
set(
|
|
16
|
-
return
|
|
15
|
+
set(s, a, i) {
|
|
16
|
+
return a === "_bdo" || a === "_data" || a === "_accessorCache" || a === "validate" || a === "toJSON" ? !1 : typeof a == "symbol" ? Reflect.set(s, a, i) : (s._data[a] = i, !0);
|
|
17
17
|
},
|
|
18
|
-
has(
|
|
19
|
-
return
|
|
18
|
+
has(s, a) {
|
|
19
|
+
return a === "validate" || a === "toJSON" ? !0 : a in s._data || a in s._bdo.getFields();
|
|
20
20
|
},
|
|
21
|
-
ownKeys(
|
|
22
|
-
return [...Object.keys(
|
|
21
|
+
ownKeys(s) {
|
|
22
|
+
return [...Object.keys(s._bdo.getFields()), "validate", "toJSON"];
|
|
23
23
|
},
|
|
24
|
-
getOwnPropertyDescriptor(
|
|
25
|
-
if (
|
|
24
|
+
getOwnPropertyDescriptor(s, a) {
|
|
25
|
+
if (a === "validate" || a === "toJSON")
|
|
26
26
|
return {
|
|
27
27
|
configurable: !0,
|
|
28
28
|
enumerable: !1,
|
|
29
|
-
value:
|
|
29
|
+
value: s[a]
|
|
30
30
|
};
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
31
|
+
const i = s._bdo.getFields();
|
|
32
|
+
if (a in i || a in s._data)
|
|
33
33
|
return {
|
|
34
34
|
configurable: !0,
|
|
35
35
|
enumerable: !0,
|
|
36
|
-
get: () =>
|
|
36
|
+
get: () => s._getAccessor(a)
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
});
|
|
@@ -45,15 +45,15 @@ class h {
|
|
|
45
45
|
_getAccessor(e) {
|
|
46
46
|
if (this._accessorCache.has(e))
|
|
47
47
|
return this._accessorCache.get(e);
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
if (
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
56
|
-
return
|
|
48
|
+
const s = this._bdo.getFields()[e], a = (s == null ? void 0 : s.meta) ?? {
|
|
49
|
+
_id: e,
|
|
50
|
+
Name: e,
|
|
51
|
+
Type: "String"
|
|
52
|
+
}, i = (s == null ? void 0 : s.readOnly) ?? !1, o = () => {
|
|
53
|
+
if (s) {
|
|
54
|
+
const c = s.validate(this._data[e]);
|
|
55
|
+
if (!c.valid)
|
|
56
|
+
return c;
|
|
57
57
|
}
|
|
58
58
|
return this._bdo.hasMetadata() ? this._bdo.validateFieldExpression(
|
|
59
59
|
e,
|
|
@@ -61,38 +61,47 @@ class h {
|
|
|
61
61
|
this.toJSON()
|
|
62
62
|
) : { valid: !0, errors: [] };
|
|
63
63
|
};
|
|
64
|
-
let
|
|
65
|
-
return
|
|
66
|
-
|
|
64
|
+
let l;
|
|
65
|
+
return i ? l = {
|
|
66
|
+
label: (s == null ? void 0 : s.label) ?? e,
|
|
67
|
+
required: (s == null ? void 0 : s.required) ?? !1,
|
|
68
|
+
readOnly: !0,
|
|
69
|
+
defaultValue: s == null ? void 0 : s.defaultValue,
|
|
70
|
+
meta: a,
|
|
67
71
|
get: () => this._data[e],
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
validate: o
|
|
73
|
+
} : l = {
|
|
74
|
+
label: (s == null ? void 0 : s.label) ?? e,
|
|
75
|
+
required: (s == null ? void 0 : s.required) ?? !1,
|
|
76
|
+
readOnly: !1,
|
|
77
|
+
defaultValue: s == null ? void 0 : s.defaultValue,
|
|
78
|
+
meta: a,
|
|
74
79
|
get: () => this._data[e],
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
set: (c) => {
|
|
81
|
+
this._data[e] = c;
|
|
82
|
+
},
|
|
83
|
+
validate: o
|
|
84
|
+
}, this._accessorCache.set(e, l), l;
|
|
77
85
|
}
|
|
78
86
|
/**
|
|
79
87
|
* Validate all fields and return combined results
|
|
80
88
|
*/
|
|
81
89
|
validate() {
|
|
82
|
-
const e = this._bdo.getFields(), t = [],
|
|
83
|
-
for (const [
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
90
|
+
const e = this._bdo.getFields(), t = [], s = this.toJSON();
|
|
91
|
+
for (const [a, i] of Object.entries(e)) {
|
|
92
|
+
if (i.readOnly) continue;
|
|
93
|
+
const o = this._data[a], l = i.validate(o);
|
|
94
|
+
if (!l.valid) {
|
|
95
|
+
t.push(...l.errors);
|
|
87
96
|
continue;
|
|
88
97
|
}
|
|
89
98
|
if (this._bdo.hasMetadata()) {
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
99
|
+
const c = this._bdo.validateFieldExpression(
|
|
100
|
+
a,
|
|
101
|
+
o,
|
|
102
|
+
s
|
|
94
103
|
);
|
|
95
|
-
|
|
104
|
+
c.valid || t.push(...c.errors);
|
|
96
105
|
}
|
|
97
106
|
}
|
|
98
107
|
return {
|
|
@@ -107,29 +116,49 @@ class h {
|
|
|
107
116
|
return { ...this._data };
|
|
108
117
|
}
|
|
109
118
|
}
|
|
110
|
-
class
|
|
119
|
+
class d {
|
|
111
120
|
constructor(e) {
|
|
112
|
-
|
|
113
|
-
n(this, "
|
|
114
|
-
n(this, "editable");
|
|
121
|
+
/** Full raw backend meta */
|
|
122
|
+
n(this, "_meta");
|
|
115
123
|
n(this, "_parentBoId");
|
|
116
|
-
this.
|
|
124
|
+
this._meta = e;
|
|
117
125
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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) */
|
|
121
149
|
get meta() {
|
|
122
|
-
return
|
|
123
|
-
id: this.id,
|
|
124
|
-
label: this.label,
|
|
125
|
-
isEditable: this.editable
|
|
126
|
-
};
|
|
150
|
+
return this._meta;
|
|
127
151
|
}
|
|
128
152
|
}
|
|
129
|
-
class
|
|
153
|
+
class h extends d {
|
|
130
154
|
constructor(e) {
|
|
131
155
|
super(e);
|
|
132
156
|
}
|
|
157
|
+
/** String-specific: max length constraint */
|
|
158
|
+
get length() {
|
|
159
|
+
var e;
|
|
160
|
+
return (e = this._meta.Constraint) == null ? void 0 : e.Length;
|
|
161
|
+
}
|
|
133
162
|
validate(e) {
|
|
134
163
|
return e != null && typeof e != "string" ? {
|
|
135
164
|
valid: !1,
|
|
@@ -137,10 +166,15 @@ class m extends f {
|
|
|
137
166
|
} : { valid: !0, errors: [] };
|
|
138
167
|
}
|
|
139
168
|
}
|
|
140
|
-
class
|
|
169
|
+
class _ extends d {
|
|
141
170
|
constructor(e) {
|
|
142
171
|
super(e);
|
|
143
172
|
}
|
|
173
|
+
/** DateTime-specific: precision */
|
|
174
|
+
get precision() {
|
|
175
|
+
var e;
|
|
176
|
+
return ((e = this._meta.Constraint) == null ? void 0 : e.Precision) ?? "Second";
|
|
177
|
+
}
|
|
144
178
|
validate(e) {
|
|
145
179
|
if (e == null || e === "")
|
|
146
180
|
return { valid: !0, errors: [] };
|
|
@@ -156,53 +190,31 @@ class b extends f {
|
|
|
156
190
|
} : { valid: !0, errors: [] };
|
|
157
191
|
}
|
|
158
192
|
}
|
|
159
|
-
class
|
|
160
|
-
constructor(
|
|
161
|
-
super(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
193
|
+
class g extends d {
|
|
194
|
+
constructor(e) {
|
|
195
|
+
super(e);
|
|
196
|
+
}
|
|
197
|
+
/** Business entity ID for user lookup */
|
|
198
|
+
get businessEntity() {
|
|
199
|
+
var e;
|
|
200
|
+
return (e = this._meta.View) == null ? void 0 : e.BusinessEntity;
|
|
201
|
+
}
|
|
202
|
+
validate(e) {
|
|
203
|
+
if (e == null)
|
|
168
204
|
return { valid: !0, errors: [] };
|
|
169
|
-
if (typeof
|
|
205
|
+
if (typeof e != "object")
|
|
170
206
|
return {
|
|
171
207
|
valid: !1,
|
|
172
|
-
errors: [`${this.label} must be a valid
|
|
208
|
+
errors: [`${this.label} must be a valid user object`]
|
|
173
209
|
};
|
|
174
|
-
const
|
|
175
|
-
return !("_id" in
|
|
210
|
+
const t = e;
|
|
211
|
+
return !("_id" in t) || typeof t._id != "string" ? {
|
|
176
212
|
valid: !1,
|
|
177
213
|
errors: [`${this.label} must have a valid _id`]
|
|
178
214
|
} : { valid: !0, errors: [] };
|
|
179
215
|
}
|
|
180
|
-
/**
|
|
181
|
-
* Fetch referenced records from the backend, returned as typed TRef[]
|
|
182
|
-
*/
|
|
183
|
-
async fetchOptions(t) {
|
|
184
|
-
if (!this._parentBoId)
|
|
185
|
-
throw new Error(
|
|
186
|
-
`Field ${this.id} not bound to a BDO. Cannot fetch options.`
|
|
187
|
-
);
|
|
188
|
-
return u(this._parentBoId).fetchField(t ?? "new", this.id);
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Get field metadata including reference info
|
|
192
|
-
*/
|
|
193
|
-
get meta() {
|
|
194
|
-
return {
|
|
195
|
-
id: this.id,
|
|
196
|
-
label: this.label,
|
|
197
|
-
isEditable: this.editable,
|
|
198
|
-
reference: {
|
|
199
|
-
bdo: this.referenceBdo,
|
|
200
|
-
fields: [...this.referenceFields]
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
216
|
}
|
|
205
|
-
const
|
|
217
|
+
const N = {
|
|
206
218
|
// ============================================================
|
|
207
219
|
// STRING FUNCTIONS (7)
|
|
208
220
|
// ============================================================
|
|
@@ -261,7 +273,7 @@ const p = {
|
|
|
261
273
|
*/
|
|
262
274
|
AVG: (...r) => {
|
|
263
275
|
const e = r.filter((t) => t != null && !isNaN(Number(t)));
|
|
264
|
-
return e.length === 0 ? 0 : e.reduce((t,
|
|
276
|
+
return e.length === 0 ? 0 : e.reduce((t, s) => t + Number(s), 0) / e.length;
|
|
265
277
|
},
|
|
266
278
|
/**
|
|
267
279
|
* Get minimum value
|
|
@@ -331,10 +343,10 @@ const p = {
|
|
|
331
343
|
* @example DATE_DIFF("2024-01-15", "2024-01-10") => 5
|
|
332
344
|
*/
|
|
333
345
|
DATE_DIFF: (r, e) => {
|
|
334
|
-
const t = new Date(r),
|
|
335
|
-
if (isNaN(t.getTime()) || isNaN(
|
|
336
|
-
const
|
|
337
|
-
return Math.ceil(
|
|
346
|
+
const t = new Date(r), s = new Date(e);
|
|
347
|
+
if (isNaN(t.getTime()) || isNaN(s.getTime())) return 0;
|
|
348
|
+
const a = Math.abs(t.getTime() - s.getTime());
|
|
349
|
+
return Math.ceil(a / (1e3 * 60 * 60 * 24));
|
|
338
350
|
},
|
|
339
351
|
/**
|
|
340
352
|
* Add days to a date
|
|
@@ -372,7 +384,7 @@ const p = {
|
|
|
372
384
|
return (r === "x" ? e : e & 3 | 8).toString(16);
|
|
373
385
|
})
|
|
374
386
|
};
|
|
375
|
-
function
|
|
387
|
+
function p() {
|
|
376
388
|
const r = /* @__PURE__ */ new Date();
|
|
377
389
|
return {
|
|
378
390
|
NOW: r,
|
|
@@ -387,7 +399,7 @@ function v() {
|
|
|
387
399
|
}
|
|
388
400
|
};
|
|
389
401
|
}
|
|
390
|
-
function
|
|
402
|
+
function m(r, e) {
|
|
391
403
|
var t;
|
|
392
404
|
switch (r.Type) {
|
|
393
405
|
case "Literal":
|
|
@@ -395,88 +407,88 @@ function c(r, e) {
|
|
|
395
407
|
case "Identifier":
|
|
396
408
|
return e.formValues[r.Name];
|
|
397
409
|
case "SystemIdentifier":
|
|
398
|
-
return
|
|
410
|
+
return v(r, e);
|
|
399
411
|
case "BinaryExpression":
|
|
400
412
|
return x(r, e);
|
|
401
413
|
case "LogicalExpression":
|
|
402
|
-
return
|
|
414
|
+
return w(r, e);
|
|
403
415
|
case "CallExpression":
|
|
404
|
-
return
|
|
416
|
+
return O(r, e);
|
|
405
417
|
case "MemberExpression":
|
|
406
|
-
return
|
|
418
|
+
return E(r, e);
|
|
407
419
|
case "AssignmentExpression":
|
|
408
|
-
return ((t = r.Arguments) == null ? void 0 : t.length) === 1 ?
|
|
420
|
+
return ((t = r.Arguments) == null ? void 0 : t.length) === 1 ? m(r.Arguments[0], e) : void 0;
|
|
409
421
|
default:
|
|
410
422
|
throw new Error(`Unsupported expression type: ${r.Type}`);
|
|
411
423
|
}
|
|
412
424
|
}
|
|
413
|
-
function
|
|
414
|
-
const t = r.Name,
|
|
415
|
-
return r.Property ?
|
|
425
|
+
function v(r, e) {
|
|
426
|
+
const t = r.Name, s = e.systemValues[t];
|
|
427
|
+
return r.Property ? s && typeof s == "object" ? s[r.Property.Name] : void 0 : s;
|
|
416
428
|
}
|
|
417
429
|
function x(r, e) {
|
|
418
430
|
if (!r.Arguments || r.Arguments.length < 2)
|
|
419
431
|
throw new Error("BinaryExpression requires 2 arguments");
|
|
420
|
-
const [t,
|
|
432
|
+
const [t, s] = r.Arguments, a = m(t, e), i = m(s, e);
|
|
421
433
|
switch (r.Operator) {
|
|
422
434
|
case "==":
|
|
423
|
-
return
|
|
435
|
+
return a == i;
|
|
424
436
|
case "!=":
|
|
425
|
-
return
|
|
437
|
+
return a != i;
|
|
426
438
|
case "<":
|
|
427
|
-
return Number(
|
|
439
|
+
return Number(a) < Number(i);
|
|
428
440
|
case "<=":
|
|
429
|
-
return Number(
|
|
441
|
+
return Number(a) <= Number(i);
|
|
430
442
|
case ">":
|
|
431
|
-
return Number(
|
|
443
|
+
return Number(a) > Number(i);
|
|
432
444
|
case ">=":
|
|
433
|
-
return Number(
|
|
445
|
+
return Number(a) >= Number(i);
|
|
434
446
|
case "+":
|
|
435
|
-
return Number(
|
|
447
|
+
return Number(a) + Number(i);
|
|
436
448
|
case "-":
|
|
437
|
-
return Number(
|
|
449
|
+
return Number(a) - Number(i);
|
|
438
450
|
case "*":
|
|
439
|
-
return Number(
|
|
451
|
+
return Number(a) * Number(i);
|
|
440
452
|
case "/":
|
|
441
|
-
return Number(
|
|
453
|
+
return Number(i) !== 0 ? Number(a) / Number(i) : 0;
|
|
442
454
|
case "%":
|
|
443
|
-
return Number(
|
|
455
|
+
return Number(a) % Number(i);
|
|
444
456
|
default:
|
|
445
457
|
throw new Error(`Unsupported binary operator: ${r.Operator}`);
|
|
446
458
|
}
|
|
447
459
|
}
|
|
448
|
-
function
|
|
460
|
+
function w(r, e) {
|
|
449
461
|
if (!r.Arguments || r.Arguments.length === 0)
|
|
450
462
|
throw new Error("LogicalExpression requires at least 1 argument");
|
|
451
463
|
const t = r.Arguments;
|
|
452
464
|
switch (r.Operator) {
|
|
453
465
|
case "AND":
|
|
454
|
-
return t.every((
|
|
466
|
+
return t.every((s) => !!m(s, e));
|
|
455
467
|
case "OR":
|
|
456
|
-
return t.some((
|
|
468
|
+
return t.some((s) => !!m(s, e));
|
|
457
469
|
case "!":
|
|
458
|
-
return !
|
|
470
|
+
return !m(t[0], e);
|
|
459
471
|
default:
|
|
460
472
|
throw new Error(`Unsupported logical operator: ${r.Operator}`);
|
|
461
473
|
}
|
|
462
474
|
}
|
|
463
|
-
function
|
|
475
|
+
function O(r, e) {
|
|
464
476
|
if (!r.Callee)
|
|
465
477
|
throw new Error("CallExpression requires a Callee");
|
|
466
|
-
const t =
|
|
478
|
+
const t = N[r.Callee];
|
|
467
479
|
if (!t)
|
|
468
480
|
throw new Error(`Unknown function: ${r.Callee}`);
|
|
469
|
-
const
|
|
470
|
-
return t(...
|
|
481
|
+
const s = (r.Arguments ?? []).map((a) => m(a, e));
|
|
482
|
+
return t(...s);
|
|
471
483
|
}
|
|
472
|
-
function
|
|
473
|
-
var
|
|
474
|
-
if (!((
|
|
484
|
+
function E(r, e) {
|
|
485
|
+
var a, i;
|
|
486
|
+
if (!((a = r.Arguments) != null && a.length))
|
|
475
487
|
return;
|
|
476
|
-
const t =
|
|
477
|
-
return
|
|
488
|
+
const t = m(r.Arguments[0], e), s = (i = r.Arguments[0].Property) == null ? void 0 : i.Name;
|
|
489
|
+
return s && t && typeof t == "object" ? t[s] : t;
|
|
478
490
|
}
|
|
479
|
-
class
|
|
491
|
+
class F {
|
|
480
492
|
constructor() {
|
|
481
493
|
/**
|
|
482
494
|
* Map of field ID to its validation rules
|
|
@@ -498,20 +510,20 @@ class D {
|
|
|
498
510
|
* @param metadata - The BDO metadata from the backend
|
|
499
511
|
*/
|
|
500
512
|
loadMetadata(e) {
|
|
501
|
-
var t,
|
|
513
|
+
var t, s;
|
|
502
514
|
this.metadata = e, this.fieldRules.clear();
|
|
503
|
-
for (const [
|
|
504
|
-
const
|
|
505
|
-
if (
|
|
506
|
-
for (const
|
|
507
|
-
if (typeof
|
|
508
|
-
|
|
509
|
-
else if (typeof
|
|
510
|
-
const
|
|
511
|
-
|
|
515
|
+
for (const [a, i] of Object.entries(e.Fields)) {
|
|
516
|
+
const o = [];
|
|
517
|
+
if (i.Validation && Array.isArray(i.Validation)) {
|
|
518
|
+
for (const l of i.Validation)
|
|
519
|
+
if (typeof l == "object" && l.ExpressionTree)
|
|
520
|
+
o.push(l);
|
|
521
|
+
else if (typeof l == "string") {
|
|
522
|
+
const c = (s = (t = e.Rules) == null ? void 0 : t.Validation) == null ? void 0 : s[l];
|
|
523
|
+
c && o.push(c);
|
|
512
524
|
}
|
|
513
525
|
}
|
|
514
|
-
|
|
526
|
+
o.length > 0 && this.fieldRules.set(a, o);
|
|
515
527
|
}
|
|
516
528
|
}
|
|
517
529
|
/**
|
|
@@ -543,25 +555,25 @@ class D {
|
|
|
543
555
|
* @param allValues - All form field values (for cross-field validation)
|
|
544
556
|
* @returns ValidationResult with valid=true if all rules pass
|
|
545
557
|
*/
|
|
546
|
-
validateField(e, t,
|
|
547
|
-
const
|
|
548
|
-
if (!
|
|
558
|
+
validateField(e, t, s) {
|
|
559
|
+
const a = this.fieldRules.get(e);
|
|
560
|
+
if (!a || a.length === 0)
|
|
549
561
|
return { valid: !0, errors: [] };
|
|
550
|
-
const
|
|
551
|
-
formValues: { ...
|
|
552
|
-
systemValues:
|
|
562
|
+
const i = {
|
|
563
|
+
formValues: { ...s, [e]: t },
|
|
564
|
+
systemValues: p()
|
|
553
565
|
};
|
|
554
|
-
for (const
|
|
566
|
+
for (const o of a)
|
|
555
567
|
try {
|
|
556
|
-
if (!
|
|
568
|
+
if (!m(o.ExpressionTree, i))
|
|
557
569
|
return {
|
|
558
570
|
valid: !1,
|
|
559
|
-
errors: [
|
|
571
|
+
errors: [o.Message || `Validation failed: ${o.Name || o.Id}`]
|
|
560
572
|
};
|
|
561
|
-
} catch (
|
|
573
|
+
} catch (l) {
|
|
562
574
|
console.warn(
|
|
563
|
-
`Expression evaluation failed for rule ${
|
|
564
|
-
|
|
575
|
+
`Expression evaluation failed for rule ${o.Id}:`,
|
|
576
|
+
l
|
|
565
577
|
);
|
|
566
578
|
}
|
|
567
579
|
return { valid: !0, errors: [] };
|
|
@@ -577,9 +589,9 @@ class D {
|
|
|
577
589
|
*/
|
|
578
590
|
validateAll(e) {
|
|
579
591
|
const t = [];
|
|
580
|
-
for (const
|
|
581
|
-
const
|
|
582
|
-
|
|
592
|
+
for (const s of this.fieldRules.keys()) {
|
|
593
|
+
const a = this.validateField(s, e[s], e);
|
|
594
|
+
a.valid || t.push(...a.errors);
|
|
583
595
|
}
|
|
584
596
|
return {
|
|
585
597
|
valid: t.length === 0,
|
|
@@ -587,29 +599,18 @@ class D {
|
|
|
587
599
|
};
|
|
588
600
|
}
|
|
589
601
|
}
|
|
590
|
-
|
|
591
|
-
class S {
|
|
602
|
+
class C {
|
|
592
603
|
constructor() {
|
|
593
604
|
// ============================================================
|
|
594
605
|
// SYSTEM FIELDS (inherited by all BDOs)
|
|
595
606
|
// ============================================================
|
|
596
|
-
n(this, "_id", new
|
|
597
|
-
n(this, "_created_at", new
|
|
598
|
-
n(this, "_modified_at", new
|
|
599
|
-
n(this, "_created_by", new
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
referenceFields: ["_id", "username"]
|
|
604
|
-
}));
|
|
605
|
-
n(this, "_modified_by", new _({
|
|
606
|
-
id: "_modified_by",
|
|
607
|
-
label: "Modified By",
|
|
608
|
-
referenceBdo: g,
|
|
609
|
-
referenceFields: ["_id", "username"]
|
|
610
|
-
}));
|
|
611
|
-
n(this, "_version", new m({ id: "_version", label: "Version" }));
|
|
612
|
-
n(this, "_m_version", new m({ id: "_m_version", label: "Metadata Version" }));
|
|
607
|
+
n(this, "_id", new h({ _id: "_id", Name: "ID", Type: "String", ReadOnly: !0 }));
|
|
608
|
+
n(this, "_created_at", new _({ _id: "_created_at", Name: "Created At", Type: "DateTime", ReadOnly: !0 }));
|
|
609
|
+
n(this, "_modified_at", new _({ _id: "_modified_at", Name: "Modified At", Type: "DateTime", ReadOnly: !0 }));
|
|
610
|
+
n(this, "_created_by", new g({ _id: "_created_by", Name: "Created By", Type: "User", ReadOnly: !0 }));
|
|
611
|
+
n(this, "_modified_by", new g({ _id: "_modified_by", Name: "Modified By", Type: "User", ReadOnly: !0 }));
|
|
612
|
+
n(this, "_version", new h({ _id: "_version", Name: "Version", Type: "String", ReadOnly: !0 }));
|
|
613
|
+
n(this, "_m_version", new h({ _id: "_m_version", Name: "Metadata Version", Type: "String", ReadOnly: !0 }));
|
|
613
614
|
// ============================================================
|
|
614
615
|
// FIELD DEFINITIONS (auto-discovered)
|
|
615
616
|
// ============================================================
|
|
@@ -627,7 +628,7 @@ class S {
|
|
|
627
628
|
/**
|
|
628
629
|
* Expression engine instance for evaluating backend validation rules
|
|
629
630
|
*/
|
|
630
|
-
n(this, "_expressionEngine", new
|
|
631
|
+
n(this, "_expressionEngine", new F());
|
|
631
632
|
}
|
|
632
633
|
/**
|
|
633
634
|
* Get all field definitions (system + business) with automatic binding.
|
|
@@ -639,8 +640,8 @@ class S {
|
|
|
639
640
|
return this._fieldsCache;
|
|
640
641
|
const e = {};
|
|
641
642
|
for (const t of Object.keys(this)) {
|
|
642
|
-
const
|
|
643
|
-
|
|
643
|
+
const s = this[t];
|
|
644
|
+
s instanceof d && (e[t] = s);
|
|
644
645
|
}
|
|
645
646
|
if (!this._fieldsBound) {
|
|
646
647
|
for (const t of Object.values(e))
|
|
@@ -681,8 +682,8 @@ class S {
|
|
|
681
682
|
* @param allValues - All form field values (for cross-field validation)
|
|
682
683
|
* @returns ValidationResultType from expression evaluation
|
|
683
684
|
*/
|
|
684
|
-
validateFieldExpression(e, t,
|
|
685
|
-
return this._expressionEngine.hasMetadata() ? this._expressionEngine.validateField(e, t,
|
|
685
|
+
validateFieldExpression(e, t, s) {
|
|
686
|
+
return this._expressionEngine.hasMetadata() ? this._expressionEngine.validateField(e, t, s) : { valid: !0, errors: [] };
|
|
686
687
|
}
|
|
687
688
|
// ============================================================
|
|
688
689
|
// READ OPERATIONS
|
|
@@ -692,14 +693,14 @@ class S {
|
|
|
692
693
|
*/
|
|
693
694
|
async get(e) {
|
|
694
695
|
const t = await u(this.meta._id).get(e);
|
|
695
|
-
return new
|
|
696
|
+
return new f(this, t);
|
|
696
697
|
}
|
|
697
698
|
/**
|
|
698
699
|
* List records with optional filtering, sorting, and pagination
|
|
699
700
|
*/
|
|
700
701
|
async list(e) {
|
|
701
702
|
return (await u(this.meta._id).list(e)).Data.map(
|
|
702
|
-
(
|
|
703
|
+
(s) => new f(this, s)
|
|
703
704
|
);
|
|
704
705
|
}
|
|
705
706
|
/**
|
|
@@ -717,7 +718,7 @@ class S {
|
|
|
717
718
|
*/
|
|
718
719
|
async create(e) {
|
|
719
720
|
const t = await u(this.meta._id).create(e);
|
|
720
|
-
return new
|
|
721
|
+
return new f(
|
|
721
722
|
this,
|
|
722
723
|
{ ...e, _id: t._id }
|
|
723
724
|
);
|
|
@@ -761,7 +762,7 @@ class S {
|
|
|
761
762
|
* Use this when you need get/set/validate methods on fields
|
|
762
763
|
*/
|
|
763
764
|
createItem(e) {
|
|
764
|
-
return new
|
|
765
|
+
return new f(this, e ?? {});
|
|
765
766
|
}
|
|
766
767
|
/**
|
|
767
768
|
* Patch an existing draft - compute fields during editing
|
|
@@ -785,10 +786,18 @@ class S {
|
|
|
785
786
|
return u(this.meta._id).pivot(e);
|
|
786
787
|
}
|
|
787
788
|
}
|
|
788
|
-
class
|
|
789
|
+
class R extends d {
|
|
789
790
|
constructor(e) {
|
|
790
791
|
super(e);
|
|
791
792
|
}
|
|
793
|
+
get integerPart() {
|
|
794
|
+
var e;
|
|
795
|
+
return ((e = this._meta.Constraint) == null ? void 0 : e.IntegerPart) ?? 9;
|
|
796
|
+
}
|
|
797
|
+
get fractionPart() {
|
|
798
|
+
var e;
|
|
799
|
+
return (e = this._meta.Constraint) == null ? void 0 : e.FractionPart;
|
|
800
|
+
}
|
|
792
801
|
validate(e) {
|
|
793
802
|
return e != null && (typeof e != "number" || isNaN(e)) ? {
|
|
794
803
|
valid: !1,
|
|
@@ -796,7 +805,7 @@ class B extends f {
|
|
|
796
805
|
} : { valid: !0, errors: [] };
|
|
797
806
|
}
|
|
798
807
|
}
|
|
799
|
-
class
|
|
808
|
+
class M extends d {
|
|
800
809
|
constructor(e) {
|
|
801
810
|
super(e);
|
|
802
811
|
}
|
|
@@ -807,55 +816,116 @@ class C extends f {
|
|
|
807
816
|
} : { valid: !0, errors: [] };
|
|
808
817
|
}
|
|
809
818
|
}
|
|
810
|
-
class
|
|
811
|
-
constructor(
|
|
812
|
-
super(
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
if (
|
|
819
|
+
class S extends d {
|
|
820
|
+
constructor(e) {
|
|
821
|
+
super(e);
|
|
822
|
+
}
|
|
823
|
+
validate(e) {
|
|
824
|
+
if (e == null || e === "")
|
|
825
|
+
return { valid: !0, errors: [] };
|
|
826
|
+
if (typeof e != "string")
|
|
827
|
+
return {
|
|
828
|
+
valid: !1,
|
|
829
|
+
errors: [`${this.label} must be a valid date string`]
|
|
830
|
+
};
|
|
831
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(e))
|
|
832
|
+
return {
|
|
833
|
+
valid: !1,
|
|
834
|
+
errors: [`${this.label} must be in YYYY-MM-DD format`]
|
|
835
|
+
};
|
|
836
|
+
const t = /* @__PURE__ */ new Date(e + "T00:00:00");
|
|
837
|
+
return isNaN(t.getTime()) ? {
|
|
838
|
+
valid: !1,
|
|
839
|
+
errors: [`${this.label} is not a valid date`]
|
|
840
|
+
} : { valid: !0, errors: [] };
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
class D extends d {
|
|
844
|
+
constructor(e) {
|
|
845
|
+
super(e);
|
|
846
|
+
}
|
|
847
|
+
/** Static options derived from Constraint.Enum */
|
|
848
|
+
get options() {
|
|
849
|
+
var t;
|
|
850
|
+
return (((t = this._meta.Constraint) == null ? void 0 : t.Enum) ?? []).map((s) => ({ value: s, label: s }));
|
|
851
|
+
}
|
|
852
|
+
validate(e) {
|
|
853
|
+
if (e == null || e === "")
|
|
818
854
|
return { valid: !0, errors: [] };
|
|
819
855
|
if (this.options.length === 0)
|
|
820
856
|
return { valid: !0, errors: [] };
|
|
821
|
-
const
|
|
822
|
-
return
|
|
857
|
+
const t = this.options.map((s) => s.value);
|
|
858
|
+
return t.includes(e) ? { valid: !0, errors: [] } : {
|
|
823
859
|
valid: !1,
|
|
824
|
-
errors: [`${this.label} must be one of: ${
|
|
860
|
+
errors: [`${this.label} must be one of: ${t.join(", ")}`]
|
|
825
861
|
};
|
|
826
862
|
}
|
|
827
863
|
/**
|
|
828
864
|
* Fetch dynamic options from the backend, returned as typed SelectOption[]
|
|
829
865
|
*/
|
|
830
|
-
async fetchOptions(
|
|
866
|
+
async fetchOptions(e) {
|
|
831
867
|
if (!this._parentBoId)
|
|
832
868
|
throw new Error(
|
|
833
869
|
`Field ${this.id} not bound to a BDO. Cannot fetch options.`
|
|
834
870
|
);
|
|
835
871
|
return (await u(this._parentBoId).fetchField(
|
|
836
|
-
|
|
872
|
+
e ?? "new",
|
|
837
873
|
this.id
|
|
838
874
|
)).map((s) => ({
|
|
839
875
|
value: s.Value,
|
|
840
876
|
label: s.Label
|
|
841
877
|
}));
|
|
842
878
|
}
|
|
879
|
+
}
|
|
880
|
+
class V extends d {
|
|
881
|
+
constructor(e) {
|
|
882
|
+
super(e);
|
|
883
|
+
}
|
|
884
|
+
get referenceBdo() {
|
|
885
|
+
var e, t;
|
|
886
|
+
return ((t = (e = this._meta.View) == null ? void 0 : e.DataObject) == null ? void 0 : t.Id) ?? "";
|
|
887
|
+
}
|
|
888
|
+
get referenceFields() {
|
|
889
|
+
var e;
|
|
890
|
+
return ((e = this._meta.View) == null ? void 0 : e.Fields) ?? ["_id"];
|
|
891
|
+
}
|
|
892
|
+
get searchFields() {
|
|
893
|
+
var e;
|
|
894
|
+
return ((e = this._meta.View) == null ? void 0 : e.Search) ?? [];
|
|
895
|
+
}
|
|
896
|
+
validate(e) {
|
|
897
|
+
if (e == null)
|
|
898
|
+
return { valid: !0, errors: [] };
|
|
899
|
+
if (typeof e != "object")
|
|
900
|
+
return {
|
|
901
|
+
valid: !1,
|
|
902
|
+
errors: [`${this.label} must be a valid reference object`]
|
|
903
|
+
};
|
|
904
|
+
const t = e;
|
|
905
|
+
return !("_id" in t) || typeof t._id != "string" ? {
|
|
906
|
+
valid: !1,
|
|
907
|
+
errors: [`${this.label} must have a valid _id`]
|
|
908
|
+
} : { valid: !0, errors: [] };
|
|
909
|
+
}
|
|
843
910
|
/**
|
|
844
|
-
*
|
|
911
|
+
* Fetch referenced records from the backend, returned as typed TRef[]
|
|
845
912
|
*/
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
};
|
|
913
|
+
async fetchOptions(e) {
|
|
914
|
+
if (!this._parentBoId)
|
|
915
|
+
throw new Error(
|
|
916
|
+
`Field ${this.id} not bound to a BDO. Cannot fetch options.`
|
|
917
|
+
);
|
|
918
|
+
return u(this._parentBoId).fetchField(e ?? "new", this.id);
|
|
853
919
|
}
|
|
854
920
|
}
|
|
855
|
-
class
|
|
921
|
+
class B extends d {
|
|
856
922
|
constructor(e) {
|
|
857
923
|
super(e);
|
|
858
924
|
}
|
|
925
|
+
/** Element type descriptor for array items */
|
|
926
|
+
get elementType() {
|
|
927
|
+
return this._meta.Property;
|
|
928
|
+
}
|
|
859
929
|
validate(e) {
|
|
860
930
|
return e != null && !Array.isArray(e) ? {
|
|
861
931
|
valid: !1,
|
|
@@ -863,14 +933,63 @@ class T extends f {
|
|
|
863
933
|
} : { valid: !0, errors: [] };
|
|
864
934
|
}
|
|
865
935
|
}
|
|
936
|
+
class $ extends d {
|
|
937
|
+
constructor(e) {
|
|
938
|
+
super(e);
|
|
939
|
+
}
|
|
940
|
+
/** Nested property definitions */
|
|
941
|
+
get properties() {
|
|
942
|
+
return this._meta.Property;
|
|
943
|
+
}
|
|
944
|
+
validate(e) {
|
|
945
|
+
return e == null ? { valid: !0, errors: [] } : typeof e != "object" || Array.isArray(e) ? {
|
|
946
|
+
valid: !1,
|
|
947
|
+
errors: [`${this.label} must be a valid object`]
|
|
948
|
+
} : { valid: !0, errors: [] };
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
class j extends d {
|
|
952
|
+
constructor(e) {
|
|
953
|
+
super(e);
|
|
954
|
+
}
|
|
955
|
+
/** Text-specific: format */
|
|
956
|
+
get format() {
|
|
957
|
+
var e;
|
|
958
|
+
return ((e = this._meta.Constraint) == null ? void 0 : e.Format) ?? "Plain";
|
|
959
|
+
}
|
|
960
|
+
validate(e) {
|
|
961
|
+
return e != null && typeof e != "string" ? {
|
|
962
|
+
valid: !1,
|
|
963
|
+
errors: [`${this.label} must be a string`]
|
|
964
|
+
} : { valid: !0, errors: [] };
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
class U extends d {
|
|
968
|
+
constructor(e) {
|
|
969
|
+
super(e);
|
|
970
|
+
}
|
|
971
|
+
validate(e) {
|
|
972
|
+
return e == null ? { valid: !0, errors: [] } : typeof e != "object" || Array.isArray(e) ? {
|
|
973
|
+
valid: !1,
|
|
974
|
+
errors: [`${this.label} must be a valid file object`]
|
|
975
|
+
} : { valid: !0, errors: [] };
|
|
976
|
+
}
|
|
977
|
+
}
|
|
866
978
|
export {
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
_ as
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
979
|
+
B as ArrayField,
|
|
980
|
+
C as BaseBdo,
|
|
981
|
+
d as BaseField,
|
|
982
|
+
M as BooleanField,
|
|
983
|
+
S as DateField,
|
|
984
|
+
_ as DateTimeField,
|
|
985
|
+
U as FileField,
|
|
986
|
+
R as NumberField,
|
|
987
|
+
$ as ObjectField,
|
|
988
|
+
V as ReferenceField,
|
|
989
|
+
D as SelectField,
|
|
990
|
+
h as StringField,
|
|
991
|
+
L as SystemField,
|
|
992
|
+
j as TextAreaField,
|
|
993
|
+
j as TextField,
|
|
994
|
+
g as UserField
|
|
876
995
|
};
|