@ram_28/kf-ai-sdk 2.0.14 → 2.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/README.md +10 -9
  2. package/dist/FileField-BWrSHNRq.js +296 -0
  3. package/dist/FileField-eDeuzln8.cjs +1 -0
  4. package/dist/api.cjs +1 -1
  5. package/dist/api.mjs +2 -2
  6. package/dist/auth.cjs +1 -1
  7. package/dist/auth.mjs +1 -1
  8. package/dist/bdo/core/BaseBdo.d.ts +1 -1
  9. package/dist/bdo.cjs +1 -1
  10. package/dist/bdo.mjs +230 -474
  11. package/dist/{client-DnO2KKrw.cjs → client-D5k4SYuw.cjs} +1 -1
  12. package/dist/{client-iQTqFDNI.js → client-_ayziI1d.js} +33 -32
  13. package/dist/components/hooks/index.d.ts +9 -3
  14. package/dist/components/hooks/index.d.ts.map +1 -1
  15. package/dist/{workflow/components → components/hooks}/useActivityForm/createActivityItemProxy.d.ts +9 -5
  16. package/dist/components/hooks/useActivityForm/createActivityItemProxy.d.ts.map +1 -0
  17. package/dist/components/hooks/useActivityForm/createActivityResolver.d.ts +23 -0
  18. package/dist/components/hooks/useActivityForm/createActivityResolver.d.ts.map +1 -0
  19. package/dist/components/hooks/useActivityForm/index.d.ts.map +1 -0
  20. package/dist/{workflow/components → components/hooks}/useActivityForm/types.d.ts +12 -8
  21. package/dist/components/hooks/useActivityForm/types.d.ts.map +1 -0
  22. package/dist/{workflow/components → components/hooks}/useActivityForm/useActivityForm.d.ts +2 -2
  23. package/dist/components/hooks/useActivityForm/useActivityForm.d.ts.map +1 -0
  24. package/dist/components/hooks/useActivityTable/index.d.ts +4 -0
  25. package/dist/components/hooks/useActivityTable/index.d.ts.map +1 -0
  26. package/dist/components/hooks/useActivityTable/types.d.ts +36 -0
  27. package/dist/components/hooks/useActivityTable/types.d.ts.map +1 -0
  28. package/dist/components/hooks/useActivityTable/useActivityTable.d.ts +4 -0
  29. package/dist/components/hooks/useActivityTable/useActivityTable.d.ts.map +1 -0
  30. package/dist/components/hooks/useBDOForm/createItemProxy.d.ts.map +1 -0
  31. package/dist/components/hooks/useBDOForm/createResolver.d.ts.map +1 -0
  32. package/dist/components/hooks/useBDOForm/index.d.ts +6 -0
  33. package/dist/components/hooks/useBDOForm/index.d.ts.map +1 -0
  34. package/dist/components/hooks/useBDOForm/shared.d.ts +50 -0
  35. package/dist/components/hooks/useBDOForm/shared.d.ts.map +1 -0
  36. package/dist/components/hooks/{useForm → useBDOForm}/types.d.ts +6 -6
  37. package/dist/components/hooks/useBDOForm/types.d.ts.map +1 -0
  38. package/dist/components/hooks/{useForm/useForm.d.ts → useBDOForm/useBDOForm.d.ts} +4 -4
  39. package/dist/components/hooks/useBDOForm/useBDOForm.d.ts.map +1 -0
  40. package/dist/components/hooks/useBDOTable/index.d.ts +3 -0
  41. package/dist/components/hooks/useBDOTable/index.d.ts.map +1 -0
  42. package/dist/components/hooks/useBDOTable/types.d.ts +24 -0
  43. package/dist/components/hooks/useBDOTable/types.d.ts.map +1 -0
  44. package/dist/components/hooks/useBDOTable/useBDOTable.d.ts +3 -0
  45. package/dist/components/hooks/useBDOTable/useBDOTable.d.ts.map +1 -0
  46. package/dist/components/hooks/useTable/index.d.ts +2 -2
  47. package/dist/components/hooks/useTable/index.d.ts.map +1 -1
  48. package/dist/components/hooks/useTable/types.d.ts +11 -10
  49. package/dist/components/hooks/useTable/types.d.ts.map +1 -1
  50. package/dist/components/hooks/useTable/useTable.d.ts +1 -1
  51. package/dist/components/hooks/useTable/useTable.d.ts.map +1 -1
  52. package/dist/form.cjs +1 -1
  53. package/dist/form.d.ts +1 -1
  54. package/dist/form.d.ts.map +1 -1
  55. package/dist/form.mjs +279 -344
  56. package/dist/form.types.d.ts +1 -1
  57. package/dist/form.types.d.ts.map +1 -1
  58. package/dist/{metadata-DpfI3zRN.js → metadata-Cc1mBcLS.js} +1 -1
  59. package/dist/{metadata-DgLSJkF5.cjs → metadata-DWXQPDav.cjs} +1 -1
  60. package/dist/shared-5a7UkED1.js +1180 -0
  61. package/dist/shared-nnmlRVs7.cjs +1 -0
  62. package/dist/table.cjs +1 -1
  63. package/dist/table.d.ts +1 -0
  64. package/dist/table.d.ts.map +1 -1
  65. package/dist/table.mjs +17 -192
  66. package/dist/table.types.d.ts +2 -1
  67. package/dist/table.types.d.ts.map +1 -1
  68. package/dist/types/base-fields.d.ts +4 -4
  69. package/dist/types/base-fields.d.ts.map +1 -1
  70. package/dist/types/constants.d.ts +3 -3
  71. package/dist/useTable-CeRklbdT.cjs +1 -0
  72. package/dist/useTable-DS0-WInw.js +203 -0
  73. package/dist/workflow/Activity.d.ts +19 -7
  74. package/dist/workflow/Activity.d.ts.map +1 -1
  75. package/dist/workflow/client.d.ts +2 -2
  76. package/dist/workflow/client.d.ts.map +1 -1
  77. package/dist/workflow/createFieldFromMeta.d.ts +29 -0
  78. package/dist/workflow/createFieldFromMeta.d.ts.map +1 -0
  79. package/dist/workflow/index.d.ts +1 -2
  80. package/dist/workflow/index.d.ts.map +1 -1
  81. package/dist/workflow/types.d.ts +16 -12
  82. package/dist/workflow/types.d.ts.map +1 -1
  83. package/dist/workflow.cjs +1 -1
  84. package/dist/workflow.d.ts +5 -2
  85. package/dist/workflow.d.ts.map +1 -1
  86. package/dist/workflow.mjs +687 -352
  87. package/dist/workflow.types.d.ts +1 -0
  88. package/dist/workflow.types.d.ts.map +1 -1
  89. package/docs/bdo.md +1 -1
  90. package/docs/gaps.md +360 -0
  91. package/docs/useActivityForm.md +393 -0
  92. package/docs/useActivityTable.md +418 -0
  93. package/docs/{useForm.md → useBDOForm.md} +24 -24
  94. package/docs/useBDOTable.md +284 -0
  95. package/docs/workflow.md +148 -297
  96. package/package.json +2 -2
  97. package/sdk/bdo/core/BaseBdo.ts +2 -2
  98. package/sdk/bdo/fields/UserField.ts +1 -1
  99. package/sdk/components/hooks/index.ts +28 -5
  100. package/sdk/components/hooks/useActivityForm/createActivityItemProxy.ts +400 -0
  101. package/sdk/components/hooks/useActivityForm/createActivityResolver.ts +87 -0
  102. package/sdk/{workflow/components → components/hooks}/useActivityForm/types.ts +24 -11
  103. package/sdk/components/hooks/useActivityForm/useActivityForm.ts +478 -0
  104. package/sdk/components/hooks/useActivityTable/index.ts +8 -0
  105. package/sdk/components/hooks/useActivityTable/types.ts +47 -0
  106. package/sdk/components/hooks/useActivityTable/useActivityTable.ts +40 -0
  107. package/sdk/components/hooks/{useForm → useBDOForm}/index.ts +4 -3
  108. package/sdk/components/hooks/useBDOForm/shared.ts +250 -0
  109. package/sdk/components/hooks/{useForm → useBDOForm}/types.ts +9 -9
  110. package/sdk/components/hooks/{useForm/useForm.ts → useBDOForm/useBDOForm.ts} +70 -96
  111. package/sdk/components/hooks/useBDOTable/index.ts +2 -0
  112. package/sdk/components/hooks/useBDOTable/types.ts +22 -0
  113. package/sdk/components/hooks/useBDOTable/useBDOTable.ts +16 -0
  114. package/sdk/components/hooks/useTable/index.ts +3 -3
  115. package/sdk/components/hooks/useTable/types.ts +16 -12
  116. package/sdk/components/hooks/useTable/useTable.ts +56 -49
  117. package/sdk/form.ts +2 -2
  118. package/sdk/form.types.ts +4 -4
  119. package/sdk/table.ts +4 -1
  120. package/sdk/table.types.ts +7 -4
  121. package/sdk/types/base-fields.ts +4 -4
  122. package/sdk/types/constants.ts +3 -3
  123. package/sdk/workflow/Activity.ts +36 -12
  124. package/sdk/workflow/client.ts +65 -12
  125. package/sdk/workflow/createFieldFromMeta.ts +110 -0
  126. package/sdk/workflow/index.ts +1 -6
  127. package/sdk/workflow/types.ts +20 -11
  128. package/sdk/workflow.ts +11 -2
  129. package/sdk/workflow.types.ts +7 -0
  130. package/dist/BaseField-B6da88U7.js +0 -40
  131. package/dist/BaseField-Drp0-OxL.cjs +0 -1
  132. package/dist/components/hooks/useForm/createItemProxy.d.ts.map +0 -1
  133. package/dist/components/hooks/useForm/createResolver.d.ts.map +0 -1
  134. package/dist/components/hooks/useForm/index.d.ts +0 -5
  135. package/dist/components/hooks/useForm/index.d.ts.map +0 -1
  136. package/dist/components/hooks/useForm/types.d.ts.map +0 -1
  137. package/dist/components/hooks/useForm/useForm.d.ts.map +0 -1
  138. package/dist/error-handling-CAoD0Kwb.cjs +0 -1
  139. package/dist/error-handling-CrhTtD88.js +0 -14
  140. package/dist/index.esm-Cj63v5ny.js +0 -1014
  141. package/dist/index.esm-DuwT11sx.cjs +0 -1
  142. package/dist/workflow/components/useActivityForm/createActivityItemProxy.d.ts.map +0 -1
  143. package/dist/workflow/components/useActivityForm/createActivityResolver.d.ts +0 -22
  144. package/dist/workflow/components/useActivityForm/createActivityResolver.d.ts.map +0 -1
  145. package/dist/workflow/components/useActivityForm/index.d.ts.map +0 -1
  146. package/dist/workflow/components/useActivityForm/types.d.ts.map +0 -1
  147. package/dist/workflow/components/useActivityForm/useActivityForm.d.ts.map +0 -1
  148. package/docs/useTable.md +0 -369
  149. package/sdk/workflow/components/useActivityForm/createActivityItemProxy.ts +0 -130
  150. package/sdk/workflow/components/useActivityForm/createActivityResolver.ts +0 -61
  151. package/sdk/workflow/components/useActivityForm/useActivityForm.ts +0 -386
  152. /package/dist/{workflow/components → components/hooks}/useActivityForm/index.d.ts +0 -0
  153. /package/dist/components/hooks/{useForm → useBDOForm}/createItemProxy.d.ts +0 -0
  154. /package/dist/components/hooks/{useForm → useBDOForm}/createResolver.d.ts +0 -0
  155. /package/sdk/{workflow/components → components/hooks}/useActivityForm/index.ts +0 -0
  156. /package/sdk/components/hooks/{useForm → useBDOForm}/createItemProxy.ts +0 -0
  157. /package/sdk/components/hooks/{useForm → useBDOForm}/createResolver.ts +0 -0
package/dist/bdo.mjs CHANGED
@@ -1,41 +1,42 @@
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";
6
- import { B as f } from "./BaseField-B6da88U7.js";
7
- import { d as re } from "./constants-ConHc1oS.js";
1
+ var O = Object.defineProperty;
2
+ var S = (r, e, t) => e in r ? O(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var d = (r, e, t) => S(r, typeof e != "symbol" ? e + "" : e, t);
4
+ import { a as i } from "./client-_ayziI1d.js";
5
+ import { v, e as E } from "./attachment-constants-C2UHWxmp.js";
6
+ import { S as F, D as T, U, B as x } from "./FileField-BWrSHNRq.js";
7
+ import { a as K, b as W, F as X, N as Q, R as Z, c as ee, T as te, T as re } from "./FileField-BWrSHNRq.js";
8
+ import { d as se } from "./constants-ConHc1oS.js";
8
9
  class w {
9
10
  constructor(e, t) {
10
- c(this, "_data");
11
- c(this, "_bdo");
12
- c(this, "_accessorCache", /* @__PURE__ */ new Map());
11
+ d(this, "_data");
12
+ d(this, "_bdo");
13
+ d(this, "_accessorCache", /* @__PURE__ */ new Map());
13
14
  return this._bdo = e, this._data = { ...t }, new Proxy(this, {
14
- get(s, a, n) {
15
- return a === "validate" || a === "toJSON" || a === "_bdo" || a === "_data" || a === "_accessorCache" || a === "_getAccessor" || a === "_requireInstanceId" || typeof a == "symbol" ? Reflect.get(s, a, n) : a === "_id" ? s._data._id : s._getAccessor(a);
15
+ get(a, s, n) {
16
+ return s === "validate" || s === "toJSON" || s === "_bdo" || s === "_data" || s === "_accessorCache" || s === "_getAccessor" || s === "_requireInstanceId" || typeof s == "symbol" ? Reflect.get(a, s, n) : s === "_id" ? a._data._id : a._getAccessor(s);
16
17
  },
17
- set(s, a, n) {
18
- return a === "_bdo" || a === "_data" || a === "_accessorCache" || a === "validate" || a === "toJSON" ? !1 : typeof a == "symbol" ? Reflect.set(s, a, n) : (s._data[a] = n, !0);
18
+ set(a, s, n) {
19
+ return s === "_bdo" || s === "_data" || s === "_accessorCache" || s === "validate" || s === "toJSON" ? !1 : typeof s == "symbol" ? Reflect.set(a, s, n) : (a._data[s] = n, !0);
19
20
  },
20
- has(s, a) {
21
- return a === "validate" || a === "toJSON" ? !0 : a in s._data || a in s._bdo.getFields();
21
+ has(a, s) {
22
+ return s === "validate" || s === "toJSON" ? !0 : s in a._data || s in a._bdo.getFields();
22
23
  },
23
- ownKeys(s) {
24
- return [...Object.keys(s._bdo.getFields()), "validate", "toJSON"];
24
+ ownKeys(a) {
25
+ return [...Object.keys(a._bdo.getFields()), "validate", "toJSON"];
25
26
  },
26
- getOwnPropertyDescriptor(s, a) {
27
- if (a === "validate" || a === "toJSON")
27
+ getOwnPropertyDescriptor(a, s) {
28
+ if (s === "validate" || s === "toJSON")
28
29
  return {
29
30
  configurable: !0,
30
31
  enumerable: !1,
31
- value: s[a]
32
+ value: a[s]
32
33
  };
33
- const n = s._bdo.getFields();
34
- if (a in n || a in s._data)
34
+ const n = a._bdo.getFields();
35
+ if (s in n || s in a._data)
35
36
  return {
36
37
  configurable: !0,
37
38
  enumerable: !0,
38
- get: () => s._getAccessor(a)
39
+ get: () => a._getAccessor(s)
39
40
  };
40
41
  }
41
42
  });
@@ -59,163 +60,163 @@ class w {
59
60
  _getAccessor(e) {
60
61
  if (this._accessorCache.has(e))
61
62
  return this._accessorCache.get(e);
62
- const s = this._bdo.getFields()[e], a = (s == null ? void 0 : s.meta) ?? {
63
+ const a = this._bdo.getFields()[e], s = (a == null ? void 0 : a.meta) ?? {
63
64
  _id: e,
64
65
  Name: e,
65
66
  Type: "String"
66
- }, n = (s == null ? void 0 : s.readOnly) ?? !1, u = () => {
67
- if (s) {
68
- const m = s.validate(this._data[e]);
69
- if (!m.valid)
70
- return m;
67
+ }, n = (a == null ? void 0 : a.readOnly) ?? !1, l = () => {
68
+ if (a) {
69
+ const h = a.validate(this._data[e]);
70
+ if (!h.valid)
71
+ return h;
71
72
  }
72
73
  return this._bdo.hasMetadata() ? this._bdo.validateFieldExpression(
73
74
  e,
74
75
  this._data[e],
75
76
  this.toJSON()
76
77
  ) : { valid: !0, errors: [] };
77
- }, h = (m) => {
78
- const y = this._data[e];
79
- return y ?? m;
78
+ }, m = (h) => {
79
+ const f = this._data[e];
80
+ return f ?? h;
80
81
  };
81
- let g;
82
- if (n ? g = {
83
- label: (s == null ? void 0 : s.label) ?? e,
84
- required: (s == null ? void 0 : s.required) ?? !1,
82
+ let y;
83
+ if (n ? y = {
84
+ label: (a == null ? void 0 : a.label) ?? e,
85
+ required: (a == null ? void 0 : a.required) ?? !1,
85
86
  readOnly: !0,
86
- defaultValue: s == null ? void 0 : s.defaultValue,
87
- meta: a,
87
+ defaultValue: a == null ? void 0 : a.defaultValue,
88
+ meta: s,
88
89
  get: () => this._data[e],
89
- getOrDefault: h,
90
- validate: u
91
- } : g = {
92
- label: (s == null ? void 0 : s.label) ?? e,
93
- required: (s == null ? void 0 : s.required) ?? !1,
90
+ getOrDefault: m,
91
+ validate: l
92
+ } : y = {
93
+ label: (a == null ? void 0 : a.label) ?? e,
94
+ required: (a == null ? void 0 : a.required) ?? !1,
94
95
  readOnly: !1,
95
- defaultValue: s == null ? void 0 : s.defaultValue,
96
- meta: a,
96
+ defaultValue: a == null ? void 0 : a.defaultValue,
97
+ meta: s,
97
98
  get: () => this._data[e],
98
- getOrDefault: h,
99
- set: (m) => {
100
- this._data[e] = m;
99
+ getOrDefault: m,
100
+ set: (h) => {
101
+ this._data[e] = h;
101
102
  },
102
- validate: u
103
- }, a.Type === "Image" || a.Type === "File") {
104
- const m = this._bdo.getBoId(), y = g;
105
- a.Type === "Image" ? (y.getDownloadUrl = async (o) => {
106
- const d = this._requireInstanceId(), _ = this._data[e];
103
+ validate: l
104
+ }, s.Type === "Image" || s.Type === "File") {
105
+ const h = this._bdo.getBoId(), f = y;
106
+ s.Type === "Image" ? (f.getDownloadUrl = async (o) => {
107
+ const c = this._requireInstanceId(), _ = this._data[e];
107
108
  if (!(_ != null && _._id))
108
109
  throw new Error(`${e} has no image to download`);
109
- return i(m).getDownloadUrl(
110
- d,
110
+ return i(h).getDownloadUrl(
111
+ c,
111
112
  e,
112
113
  _._id,
113
114
  o
114
115
  );
115
- }, n || (y.upload = async (o) => {
116
- F(o.name, "Image");
117
- const d = this._requireInstanceId(), _ = {
116
+ }, n || (f.upload = async (o) => {
117
+ v(o.name, "Image");
118
+ const c = this._requireInstanceId(), _ = {
118
119
  FileName: o.name,
119
120
  Size: o.size,
120
121
  FileExtension: E(o.name)
121
- }, [l] = await i(m).getUploadUrl(
122
- d,
122
+ }, [u] = await i(h).getUploadUrl(
123
+ c,
123
124
  e,
124
125
  [_]
125
126
  );
126
- await fetch(l.UploadUrl.URL, {
127
+ await fetch(u.UploadUrl.URL, {
127
128
  method: "PUT",
128
- headers: { "Content-Type": l.ContentType },
129
+ headers: { "Content-Type": u.ContentType },
129
130
  body: o
130
131
  });
131
- const v = {
132
- _id: l._id,
133
- _name: l._name,
134
- FileName: l.FileName,
135
- FileExtension: l.FileExtension,
136
- Size: l.Size,
137
- ContentType: l.ContentType
132
+ const p = {
133
+ _id: u._id,
134
+ _name: u._name,
135
+ FileName: u.FileName,
136
+ FileExtension: u.FileExtension,
137
+ Size: u.Size,
138
+ ContentType: u.ContentType
138
139
  };
139
- return this._data[e] = v, v;
140
- }, y.deleteAttachment = async () => {
141
- const o = this._requireInstanceId(), d = this._data[e];
142
- if (!(d != null && d._id))
140
+ return this._data[e] = p, p;
141
+ }, f.deleteAttachment = async () => {
142
+ const o = this._requireInstanceId(), c = this._data[e];
143
+ if (!(c != null && c._id))
143
144
  throw new Error(`${e} has no image to delete`);
144
- await i(m).deleteAttachment(o, e, d._id), this._data[e] = null;
145
- })) : (y.getDownloadUrl = async (o, d) => {
145
+ await i(h).deleteAttachment(o, e, c._id), this._data[e] = null;
146
+ })) : (f.getDownloadUrl = async (o, c) => {
146
147
  const _ = this._requireInstanceId();
147
- return i(m).getDownloadUrl(
148
+ return i(h).getDownloadUrl(
148
149
  _,
149
150
  e,
150
151
  o,
151
- d
152
+ c
152
153
  );
153
- }, y.getDownloadUrls = async (o) => {
154
- const d = this._requireInstanceId();
155
- return i(m).getDownloadUrls(d, e, o);
156
- }, n || (y.upload = async (o) => {
157
- for (const N of o)
158
- F(N.name, "File");
159
- const d = this._requireInstanceId(), _ = o.map((N) => ({
160
- FileName: N.name,
161
- Size: N.size,
162
- FileExtension: E(N.name)
163
- })), l = await i(m).getUploadUrl(
164
- d,
154
+ }, f.getDownloadUrls = async (o) => {
155
+ const c = this._requireInstanceId();
156
+ return i(h).getDownloadUrls(c, e, o);
157
+ }, n || (f.upload = async (o) => {
158
+ for (const b of o)
159
+ v(b.name, "File");
160
+ const c = this._requireInstanceId(), _ = o.map((b) => ({
161
+ FileName: b.name,
162
+ Size: b.size,
163
+ FileExtension: E(b.name)
164
+ })), u = await i(h).getUploadUrl(
165
+ c,
165
166
  e,
166
167
  _
167
- ), v = await Promise.all(
168
- o.map(async (N, p) => (await fetch(l[p].UploadUrl.URL, {
168
+ ), p = await Promise.all(
169
+ o.map(async (b, N) => (await fetch(u[N].UploadUrl.URL, {
169
170
  method: "PUT",
170
- headers: { "Content-Type": l[p].ContentType },
171
- body: N
171
+ headers: { "Content-Type": u[N].ContentType },
172
+ body: b
172
173
  }), {
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
174
+ _id: u[N]._id,
175
+ _name: u[N]._name,
176
+ FileName: u[N].FileName,
177
+ FileExtension: u[N].FileExtension,
178
+ Size: u[N].Size,
179
+ ContentType: u[N].ContentType
179
180
  }))
180
181
  ), A = this._data[e] ?? [];
181
182
  return this._data[e] = [
182
183
  ...A,
183
- ...v
184
- ], v;
185
- }, y.deleteAttachment = async (o) => {
186
- const d = this._requireInstanceId();
187
- await i(m).deleteAttachment(
188
- d,
184
+ ...p
185
+ ], p;
186
+ }, f.deleteAttachment = async (o) => {
187
+ const c = this._requireInstanceId();
188
+ await i(h).deleteAttachment(
189
+ c,
189
190
  e,
190
191
  o
191
192
  );
192
193
  const _ = this._data[e] ?? [];
193
194
  this._data[e] = _.filter(
194
- (l) => l._id !== o
195
+ (u) => u._id !== o
195
196
  );
196
197
  }));
197
198
  }
198
- return this._accessorCache.set(e, g), g;
199
+ return this._accessorCache.set(e, y), y;
199
200
  }
200
201
  /**
201
202
  * Validate all fields and return combined results
202
203
  */
203
204
  validate() {
204
- const e = this._bdo.getFields(), t = [], s = this.toJSON();
205
- for (const [a, n] of Object.entries(e)) {
205
+ const e = this._bdo.getFields(), t = [], a = this.toJSON();
206
+ for (const [s, n] of Object.entries(e)) {
206
207
  if (n.readOnly) continue;
207
- const u = this._data[a], h = n.validate(u);
208
- if (!h.valid) {
209
- t.push(...h.errors);
208
+ const l = this._data[s], m = n.validate(l);
209
+ if (!m.valid) {
210
+ t.push(...m.errors);
210
211
  continue;
211
212
  }
212
213
  if (this._bdo.hasMetadata()) {
213
- const g = this._bdo.validateFieldExpression(
214
- a,
215
- u,
216
- s
214
+ const y = this._bdo.validateFieldExpression(
215
+ s,
216
+ l,
217
+ a
217
218
  );
218
- g.valid || t.push(...g.errors);
219
+ y.valid || t.push(...y.errors);
219
220
  }
220
221
  }
221
222
  return {
@@ -230,82 +231,7 @@ class w {
230
231
  return { ...this._data };
231
232
  }
232
233
  }
233
- class x extends f {
234
- constructor(e) {
235
- super(e);
236
- }
237
- /** String-specific: max length constraint */
238
- get length() {
239
- var e;
240
- return (e = this._meta.Constraint) == null ? void 0 : e.Length;
241
- }
242
- validate(e) {
243
- return e != null && typeof e != "string" ? {
244
- valid: !1,
245
- errors: [`${this.label} must be a string`]
246
- } : { valid: !0, errors: [] };
247
- }
248
- }
249
- class T extends f {
250
- constructor(e) {
251
- super(e);
252
- }
253
- /** DateTime-specific: precision */
254
- get precision() {
255
- var e;
256
- return ((e = this._meta.Constraint) == null ? void 0 : e.Precision) ?? "Second";
257
- }
258
- validate(e) {
259
- if (e == null || e === "")
260
- return { valid: !0, errors: [] };
261
- if (typeof e != "string")
262
- return {
263
- valid: !1,
264
- errors: [`${this.label} must be a valid date string`]
265
- };
266
- const t = new Date(e);
267
- return isNaN(t.getTime()) ? {
268
- valid: !1,
269
- errors: [`${this.label} is not a valid date`]
270
- } : { valid: !0, errors: [] };
271
- }
272
- }
273
- class O extends f {
274
- constructor(e) {
275
- super(e);
276
- }
277
- /** Business entity ID for user lookup */
278
- get businessEntity() {
279
- var e;
280
- return (e = this._meta.View) == null ? void 0 : e.BusinessEntity;
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
- }
293
- validate(e) {
294
- if (e == null)
295
- return { valid: !0, errors: [] };
296
- if (typeof e != "object")
297
- return {
298
- valid: !1,
299
- errors: [`${this.label} must be a valid user object`]
300
- };
301
- const t = e;
302
- return !("_id" in t) || typeof t._id != "string" ? {
303
- valid: !1,
304
- errors: [`${this.label} must have a valid _id`]
305
- } : { valid: !0, errors: [] };
306
- }
307
- }
308
- const S = {
234
+ const R = {
309
235
  // ============================================================
310
236
  // STRING FUNCTIONS (7)
311
237
  // ============================================================
@@ -364,7 +290,7 @@ const S = {
364
290
  */
365
291
  AVG: (...r) => {
366
292
  const e = r.filter((t) => t != null && !isNaN(Number(t)));
367
- return e.length === 0 ? 0 : e.reduce((t, s) => t + Number(s), 0) / e.length;
293
+ return e.length === 0 ? 0 : e.reduce((t, a) => t + Number(a), 0) / e.length;
368
294
  },
369
295
  /**
370
296
  * Get minimum value
@@ -434,10 +360,10 @@ const S = {
434
360
  * @example DATE_DIFF("2024-01-15", "2024-01-10") => 5
435
361
  */
436
362
  DATE_DIFF: (r, e) => {
437
- const t = new Date(r), s = new Date(e);
438
- if (isNaN(t.getTime()) || isNaN(s.getTime())) return 0;
439
- const a = Math.abs(t.getTime() - s.getTime());
440
- return Math.ceil(a / (1e3 * 60 * 60 * 24));
363
+ const t = new Date(r), a = new Date(e);
364
+ if (isNaN(t.getTime()) || isNaN(a.getTime())) return 0;
365
+ const s = Math.abs(t.getTime() - a.getTime());
366
+ return Math.ceil(s / (1e3 * 60 * 60 * 24));
441
367
  },
442
368
  /**
443
369
  * Add days to a date
@@ -475,7 +401,7 @@ const S = {
475
401
  return (r === "x" ? e : e & 3 | 8).toString(16);
476
402
  })
477
403
  };
478
- function D() {
404
+ function C() {
479
405
  const r = /* @__PURE__ */ new Date();
480
406
  return {
481
407
  NOW: r,
@@ -490,7 +416,7 @@ function D() {
490
416
  }
491
417
  };
492
418
  }
493
- function b(r, e) {
419
+ function g(r, e) {
494
420
  var t;
495
421
  switch (r.Type) {
496
422
  case "Literal":
@@ -500,50 +426,50 @@ function b(r, e) {
500
426
  case "SystemIdentifier":
501
427
  return M(r, e);
502
428
  case "BinaryExpression":
503
- return R(r, e);
429
+ return D(r, e);
504
430
  case "LogicalExpression":
505
431
  return I(r, e);
506
432
  case "CallExpression":
507
- return $(r, e);
508
- case "MemberExpression":
509
433
  return B(r, e);
434
+ case "MemberExpression":
435
+ return V(r, e);
510
436
  case "AssignmentExpression":
511
- return ((t = r.Arguments) == null ? void 0 : t.length) === 1 ? b(r.Arguments[0], e) : void 0;
437
+ return ((t = r.Arguments) == null ? void 0 : t.length) === 1 ? g(r.Arguments[0], e) : void 0;
512
438
  default:
513
439
  throw new Error(`Unsupported expression type: ${r.Type}`);
514
440
  }
515
441
  }
516
442
  function M(r, e) {
517
- const t = r.Name, s = e.systemValues[t];
518
- return r.Property ? s && typeof s == "object" ? s[r.Property.Name] : void 0 : s;
443
+ const t = r.Name, a = e.systemValues[t];
444
+ return r.Property ? a && typeof a == "object" ? a[r.Property.Name] : void 0 : a;
519
445
  }
520
- function R(r, e) {
446
+ function D(r, e) {
521
447
  if (!r.Arguments || r.Arguments.length < 2)
522
448
  throw new Error("BinaryExpression requires 2 arguments");
523
- const [t, s] = r.Arguments, a = b(t, e), n = b(s, e);
449
+ const [t, a] = r.Arguments, s = g(t, e), n = g(a, e);
524
450
  switch (r.Operator) {
525
451
  case "==":
526
- return a == n;
452
+ return s == n;
527
453
  case "!=":
528
- return a != n;
454
+ return s != n;
529
455
  case "<":
530
- return Number(a) < Number(n);
456
+ return Number(s) < Number(n);
531
457
  case "<=":
532
- return Number(a) <= Number(n);
458
+ return Number(s) <= Number(n);
533
459
  case ">":
534
- return Number(a) > Number(n);
460
+ return Number(s) > Number(n);
535
461
  case ">=":
536
- return Number(a) >= Number(n);
462
+ return Number(s) >= Number(n);
537
463
  case "+":
538
- return Number(a) + Number(n);
464
+ return Number(s) + Number(n);
539
465
  case "-":
540
- return Number(a) - Number(n);
466
+ return Number(s) - Number(n);
541
467
  case "*":
542
- return Number(a) * Number(n);
468
+ return Number(s) * Number(n);
543
469
  case "/":
544
- return Number(n) !== 0 ? Number(a) / Number(n) : 0;
470
+ return Number(n) !== 0 ? Number(s) / Number(n) : 0;
545
471
  case "%":
546
- return Number(a) % Number(n);
472
+ return Number(s) % Number(n);
547
473
  default:
548
474
  throw new Error(`Unsupported binary operator: ${r.Operator}`);
549
475
  }
@@ -554,41 +480,41 @@ function I(r, e) {
554
480
  const t = r.Arguments;
555
481
  switch (r.Operator) {
556
482
  case "AND":
557
- return t.every((s) => !!b(s, e));
483
+ return t.every((a) => !!g(a, e));
558
484
  case "OR":
559
- return t.some((s) => !!b(s, e));
485
+ return t.some((a) => !!g(a, e));
560
486
  case "!":
561
- return !b(t[0], e);
487
+ return !g(t[0], e);
562
488
  default:
563
489
  throw new Error(`Unsupported logical operator: ${r.Operator}`);
564
490
  }
565
491
  }
566
- function $(r, e) {
492
+ function B(r, e) {
567
493
  if (!r.Callee)
568
494
  throw new Error("CallExpression requires a Callee");
569
- const t = S[r.Callee];
495
+ const t = R[r.Callee];
570
496
  if (!t)
571
497
  throw new Error(`Unknown function: ${r.Callee}`);
572
- const s = (r.Arguments ?? []).map((a) => b(a, e));
573
- return t(...s);
498
+ const a = (r.Arguments ?? []).map((s) => g(s, e));
499
+ return t(...a);
574
500
  }
575
- function B(r, e) {
576
- var a, n;
577
- if (!((a = r.Arguments) != null && a.length))
501
+ function V(r, e) {
502
+ var s, n;
503
+ if (!((s = r.Arguments) != null && s.length))
578
504
  return;
579
- const t = b(r.Arguments[0], e), s = (n = r.Arguments[0].Property) == null ? void 0 : n.Name;
580
- return s && t && typeof t == "object" ? t[s] : t;
505
+ const t = g(r.Arguments[0], e), a = (n = r.Arguments[0].Property) == null ? void 0 : n.Name;
506
+ return a && t && typeof t == "object" ? t[a] : t;
581
507
  }
582
- class V {
508
+ class q {
583
509
  constructor() {
584
510
  /**
585
511
  * Map of field ID to its validation rules
586
512
  */
587
- c(this, "fieldRules", /* @__PURE__ */ new Map());
513
+ d(this, "fieldRules", /* @__PURE__ */ new Map());
588
514
  /**
589
515
  * The loaded BDO metadata
590
516
  */
591
- c(this, "metadata", null);
517
+ d(this, "metadata", null);
592
518
  }
593
519
  /**
594
520
  * Load metadata and extract field validation rules
@@ -601,20 +527,20 @@ class V {
601
527
  * @param metadata - The BDO metadata from the backend
602
528
  */
603
529
  loadMetadata(e) {
604
- var t, s;
530
+ var t, a;
605
531
  this.metadata = e, this.fieldRules.clear();
606
- for (const [a, n] of Object.entries(e.Fields)) {
607
- const u = [];
532
+ for (const [s, n] of Object.entries(e.Fields)) {
533
+ const l = [];
608
534
  if (n.Validation && Array.isArray(n.Validation)) {
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];
614
- g && u.push(g);
535
+ for (const m of n.Validation)
536
+ if (typeof m == "object" && m.ExpressionTree)
537
+ l.push(m);
538
+ else if (typeof m == "string") {
539
+ const y = (a = (t = e.Rules) == null ? void 0 : t.Validation) == null ? void 0 : a[m];
540
+ y && l.push(y);
615
541
  }
616
542
  }
617
- u.length > 0 && this.fieldRules.set(a, u);
543
+ l.length > 0 && this.fieldRules.set(s, l);
618
544
  }
619
545
  }
620
546
  /**
@@ -646,25 +572,25 @@ class V {
646
572
  * @param allValues - All form field values (for cross-field validation)
647
573
  * @returns ValidationResult with valid=true if all rules pass
648
574
  */
649
- validateField(e, t, s) {
650
- const a = this.fieldRules.get(e);
651
- if (!a || a.length === 0)
575
+ validateField(e, t, a) {
576
+ const s = this.fieldRules.get(e);
577
+ if (!s || s.length === 0)
652
578
  return { valid: !0, errors: [] };
653
579
  const n = {
654
- formValues: { ...s, [e]: t },
655
- systemValues: D()
580
+ formValues: { ...a, [e]: t },
581
+ systemValues: C()
656
582
  };
657
- for (const u of a)
583
+ for (const l of s)
658
584
  try {
659
- if (!b(u.ExpressionTree, n))
585
+ if (!g(l.ExpressionTree, n))
660
586
  return {
661
587
  valid: !1,
662
- errors: [u.Message || `Validation failed: ${u.Name || u.Id}`]
588
+ errors: [l.Message || `Validation failed: ${l.Name || l.Id}`]
663
589
  };
664
- } catch (h) {
590
+ } catch (m) {
665
591
  console.warn(
666
- `Expression evaluation failed for rule ${u.Id}:`,
667
- h
592
+ `Expression evaluation failed for rule ${l.Id}:`,
593
+ m
668
594
  );
669
595
  }
670
596
  return { valid: !0, errors: [] };
@@ -680,9 +606,9 @@ class V {
680
606
  */
681
607
  validateAll(e) {
682
608
  const t = [];
683
- for (const s of this.fieldRules.keys()) {
684
- const a = this.validateField(s, e[s], e);
685
- a.valid || t.push(...a.errors);
609
+ for (const a of this.fieldRules.keys()) {
610
+ const s = this.validateField(a, e[a], e);
611
+ s.valid || t.push(...s.errors);
686
612
  }
687
613
  return {
688
614
  valid: t.length === 0,
@@ -690,33 +616,33 @@ class V {
690
616
  };
691
617
  }
692
618
  }
693
- class Y {
619
+ class z {
694
620
  constructor() {
695
621
  // ============================================================
696
622
  // SYSTEM FIELDS (inherited by all BDOs)
697
623
  // ============================================================
698
- c(this, "_id", new x({ _id: "_id", Name: "ID", Type: "String", ReadOnly: !0 }));
699
- c(this, "_created_at", new T({ _id: "_created_at", Name: "Created At", Type: "DateTime", ReadOnly: !0 }));
700
- c(this, "_modified_at", new T({ _id: "_modified_at", Name: "Modified At", Type: "DateTime", ReadOnly: !0 }));
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 }));
703
- c(this, "_version", new x({ _id: "_version", Name: "Version", Type: "String", ReadOnly: !0 }));
704
- c(this, "_m_version", new x({ _id: "_m_version", Name: "Metadata Version", Type: "String", ReadOnly: !0 }));
624
+ d(this, "_id", new F({ _id: "_id", Name: "ID", Type: "String", ReadOnly: !0 }));
625
+ d(this, "_created_at", new T({ _id: "_created_at", Name: "Created At", Type: "DateTime", ReadOnly: !0 }));
626
+ d(this, "_modified_at", new T({ _id: "_modified_at", Name: "Modified At", Type: "DateTime", ReadOnly: !0 }));
627
+ d(this, "_created_by", new U({ _id: "_created_by", Name: "Created By", Type: "User", ReadOnly: !0 }));
628
+ d(this, "_modified_by", new U({ _id: "_modified_by", Name: "Modified By", Type: "User", ReadOnly: !0 }));
629
+ d(this, "_version", new F({ _id: "_version", Name: "Version", Type: "String", ReadOnly: !0 }));
630
+ d(this, "_m_version", new F({ _id: "_m_version", Name: "Metadata Version", Type: "String", ReadOnly: !0 }));
705
631
  /**
706
632
  * Whether fields have been bound to this BDO
707
633
  */
708
- c(this, "_fieldsBound", !1);
634
+ d(this, "_fieldsBound", !1);
709
635
  /**
710
636
  * Cached field map
711
637
  */
712
- c(this, "_fieldsCache", null);
638
+ d(this, "_fieldsCache", null);
713
639
  // ============================================================
714
640
  // EXPRESSION ENGINE (for backend validation rules)
715
641
  // ============================================================
716
642
  /**
717
643
  * Expression engine instance for evaluating backend validation rules
718
644
  */
719
- c(this, "_expressionEngine", new V());
645
+ d(this, "_expressionEngine", new q());
720
646
  }
721
647
  // ============================================================
722
648
  // FIELD DEFINITIONS (auto-discovered)
@@ -737,8 +663,8 @@ class Y {
737
663
  return this._fieldsCache;
738
664
  const e = {};
739
665
  for (const t of Object.keys(this)) {
740
- const s = this[t];
741
- s instanceof f && (e[t] = s);
666
+ const a = this[t];
667
+ a instanceof x && (e[t] = a);
742
668
  }
743
669
  if (!this._fieldsBound) {
744
670
  for (const t of Object.values(e))
@@ -750,7 +676,7 @@ class Y {
750
676
  /**
751
677
  * Load backend metadata for expression-based validation
752
678
  *
753
- * Called by useForm after fetching schema from the backend.
679
+ * Called by useBDOForm after fetching schema from the backend.
754
680
  * This enables expression-based validation rules to be used
755
681
  * in addition to type validation.
756
682
  *
@@ -779,8 +705,8 @@ class Y {
779
705
  * @param allValues - All form field values (for cross-field validation)
780
706
  * @returns ValidationResultType from expression evaluation
781
707
  */
782
- validateFieldExpression(e, t, s) {
783
- return this._expressionEngine.hasMetadata() ? this._expressionEngine.validateField(e, t, s) : { valid: !0, errors: [] };
708
+ validateFieldExpression(e, t, a) {
709
+ return this._expressionEngine.hasMetadata() ? this._expressionEngine.validateField(e, t, a) : { valid: !0, errors: [] };
784
710
  }
785
711
  // ============================================================
786
712
  // READ OPERATIONS
@@ -797,7 +723,7 @@ class Y {
797
723
  */
798
724
  async list(e) {
799
725
  return (await i(this.meta._id).list(e)).Data.map(
800
- (s) => new w(this, s)
726
+ (a) => new w(this, a)
801
727
  );
802
728
  }
803
729
  /**
@@ -839,7 +765,7 @@ class Y {
839
765
  return i(this.meta._id).delete(e);
840
766
  }
841
767
  // ============================================================
842
- // DRAFT OPERATIONS (for useForm integration)
768
+ // DRAFT OPERATIONS (for useBDOForm integration)
843
769
  // ============================================================
844
770
  /**
845
771
  * Create a draft - compute fields without persisting
@@ -894,162 +820,29 @@ class Y {
894
820
  /**
895
821
  * Get signed upload URLs for file/image attachments
896
822
  */
897
- async getUploadUrl(e, t, s) {
898
- return i(this.meta._id).getUploadUrl(e, t, s);
823
+ async getUploadUrl(e, t, a) {
824
+ return i(this.meta._id).getUploadUrl(e, t, a);
899
825
  }
900
826
  /**
901
827
  * Get signed download URL for a single attachment
902
828
  */
903
- async getDownloadUrl(e, t, s, a) {
904
- return i(this.meta._id).getDownloadUrl(e, t, s, a);
829
+ async getDownloadUrl(e, t, a, s) {
830
+ return i(this.meta._id).getDownloadUrl(e, t, a, s);
905
831
  }
906
832
  /**
907
833
  * Get signed download URLs for all attachments on a field
908
834
  */
909
- async getDownloadUrls(e, t, s) {
910
- return i(this.meta._id).getDownloadUrls(e, t, s);
835
+ async getDownloadUrls(e, t, a) {
836
+ return i(this.meta._id).getDownloadUrls(e, t, a);
911
837
  }
912
838
  /**
913
839
  * Delete an attachment
914
840
  */
915
- async deleteAttachment(e, t, s) {
916
- return i(this.meta._id).deleteAttachment(e, t, s);
917
- }
918
- }
919
- class z extends f {
920
- constructor(e) {
921
- super(e);
922
- }
923
- get integerPart() {
924
- var e;
925
- return ((e = this._meta.Constraint) == null ? void 0 : e.IntegerPart) ?? 9;
926
- }
927
- get fractionPart() {
928
- var e;
929
- return (e = this._meta.Constraint) == null ? void 0 : e.FractionPart;
930
- }
931
- validate(e) {
932
- return e == null || e === "" ? { valid: !0, errors: [] } : typeof e != "number" || isNaN(e) ? {
933
- valid: !1,
934
- errors: [`${this.label} must be a valid number`]
935
- } : { valid: !0, errors: [] };
936
- }
937
- }
938
- class J extends f {
939
- constructor(e) {
940
- super(e);
941
- }
942
- validate(e) {
943
- return e != null && typeof e != "boolean" ? {
944
- valid: !1,
945
- errors: [`${this.label} must be a boolean`]
946
- } : { valid: !0, errors: [] };
947
- }
948
- }
949
- class k extends f {
950
- constructor(e) {
951
- super(e);
952
- }
953
- validate(e) {
954
- if (e == null || e === "")
955
- return { valid: !0, errors: [] };
956
- if (typeof e != "string")
957
- return {
958
- valid: !1,
959
- errors: [`${this.label} must be a valid date string`]
960
- };
961
- if (!/^\d{4}-\d{2}-\d{2}$/.test(e))
962
- return {
963
- valid: !1,
964
- errors: [`${this.label} must be in YYYY-MM-DD format`]
965
- };
966
- const t = /* @__PURE__ */ new Date(e + "T00:00:00");
967
- return isNaN(t.getTime()) ? {
968
- valid: !1,
969
- errors: [`${this.label} is not a valid date`]
970
- } : { valid: !0, errors: [] };
971
- }
972
- }
973
- class G extends f {
974
- constructor(e) {
975
- super(e);
976
- }
977
- /** Static options derived from Constraint.Enum */
978
- get options() {
979
- var t;
980
- return (((t = this._meta.Constraint) == null ? void 0 : t.Enum) ?? []).map((s) => ({ value: s, label: s }));
981
- }
982
- validate(e) {
983
- if (e == null || e === "")
984
- return { valid: !0, errors: [] };
985
- if (this.options.length === 0)
986
- return { valid: !0, errors: [] };
987
- const t = this.options.map((s) => s.value);
988
- return t.includes(e) ? { valid: !0, errors: [] } : {
989
- valid: !1,
990
- errors: [`${this.label} must be one of: ${t.join(", ")}`]
991
- };
992
- }
993
- /**
994
- * Fetch dynamic options from the backend, returned as typed SelectOption[]
995
- */
996
- async fetchOptions(e) {
997
- if (!this._parentBoId)
998
- throw new Error(
999
- `Field ${this.id} not bound to a BDO. Cannot fetch options.`
1000
- );
1001
- return (await i(this._parentBoId).fetchField(
1002
- e,
1003
- this.id
1004
- )).map((s) => ({
1005
- value: s.Value,
1006
- label: s.Label
1007
- }));
1008
- }
1009
- }
1010
- class H extends f {
1011
- constructor(e) {
1012
- super(e);
1013
- }
1014
- get referenceBdo() {
1015
- var e, t;
1016
- return ((t = (e = this._meta.View) == null ? void 0 : e.DataObject) == null ? void 0 : t.Id) ?? "";
1017
- }
1018
- get referenceFields() {
1019
- var e;
1020
- return ((e = this._meta.View) == null ? void 0 : e.Fields) ?? ["_id"];
1021
- }
1022
- get searchFields() {
1023
- var e;
1024
- return ((e = this._meta.View) == null ? void 0 : e.Search) ?? [];
1025
- }
1026
- validate(e) {
1027
- if (e == null)
1028
- return { valid: !0, errors: [] };
1029
- if (typeof e != "object")
1030
- return {
1031
- valid: !1,
1032
- errors: [`${this.label} must be a valid reference object`]
1033
- };
1034
- const t = e;
1035
- return !("_id" in t) || typeof t._id != "string" ? {
1036
- valid: !1,
1037
- errors: [`${this.label} must have a valid _id`]
1038
- } : { valid: !0, errors: [] };
1039
- }
1040
- /**
1041
- * Fetch referenced records from the backend via the fetchField API.
1042
- * Requires the field to be bound to a parent BDO.
1043
- */
1044
- async fetchOptions(e) {
1045
- if (!this._parentBoId)
1046
- throw new Error(
1047
- `Field ${this.id} not bound to a BDO. Cannot fetch options.`
1048
- );
1049
- return i(this._parentBoId).fetchField(e, this.id);
841
+ async deleteAttachment(e, t, a) {
842
+ return i(this.meta._id).deleteAttachment(e, t, a);
1050
843
  }
1051
844
  }
1052
- class K extends f {
845
+ class J extends x {
1053
846
  constructor(e) {
1054
847
  super(e);
1055
848
  }
@@ -1064,7 +857,7 @@ class K extends f {
1064
857
  } : { valid: !0, errors: [] };
1065
858
  }
1066
859
  }
1067
- class W extends f {
860
+ class Y extends x {
1068
861
  constructor(e) {
1069
862
  super(e);
1070
863
  }
@@ -1079,44 +872,7 @@ class W extends f {
1079
872
  } : { valid: !0, errors: [] };
1080
873
  }
1081
874
  }
1082
- class X extends f {
1083
- constructor(e) {
1084
- super(e);
1085
- }
1086
- /** Text-specific: format */
1087
- get format() {
1088
- var e;
1089
- return ((e = this._meta.Constraint) == null ? void 0 : e.Format) ?? "Plain";
1090
- }
1091
- validate(e) {
1092
- return e != null && typeof e != "string" ? {
1093
- valid: !1,
1094
- errors: [`${this.label} must be a string`]
1095
- } : { valid: !0, errors: [] };
1096
- }
1097
- }
1098
- class Q extends f {
1099
- constructor(e) {
1100
- super(e);
1101
- }
1102
- validate(e) {
1103
- if (e == null)
1104
- return { valid: !0, errors: [] };
1105
- if (!Array.isArray(e))
1106
- return {
1107
- valid: !1,
1108
- errors: [`${this.label} must be an array of file objects`]
1109
- };
1110
- for (const t of e)
1111
- if (!t || typeof t != "object" || !t._id)
1112
- return {
1113
- valid: !1,
1114
- errors: [`Each file in ${this.label} must have an _id`]
1115
- };
1116
- return { valid: !0, errors: [] };
1117
- }
1118
- }
1119
- class Z extends f {
875
+ class k extends x {
1120
876
  constructor(e) {
1121
877
  super(e);
1122
878
  }
@@ -1131,21 +887,21 @@ class Z extends f {
1131
887
  }
1132
888
  }
1133
889
  export {
1134
- K as ArrayField,
1135
- Y as BaseBdo,
1136
- f as BaseField,
1137
- J as BooleanField,
1138
- k as DateField,
890
+ J as ArrayField,
891
+ z as BaseBdo,
892
+ x as BaseField,
893
+ K as BooleanField,
894
+ W as DateField,
1139
895
  T as DateTimeField,
1140
- Q as FileField,
1141
- Z as ImageField,
1142
- z as NumberField,
1143
- W as ObjectField,
1144
- H as ReferenceField,
1145
- G as SelectField,
1146
- x as StringField,
1147
- re as SystemField,
1148
- X as TextAreaField,
1149
- X as TextField,
1150
- O as UserField
896
+ X as FileField,
897
+ k as ImageField,
898
+ Q as NumberField,
899
+ Y as ObjectField,
900
+ Z as ReferenceField,
901
+ ee as SelectField,
902
+ F as StringField,
903
+ se as SystemField,
904
+ te as TextAreaField,
905
+ re as TextField,
906
+ U as UserField
1151
907
  };