@ram_28/kf-ai-sdk 2.0.25 → 2.0.26

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/form.mjs CHANGED
@@ -1,14 +1,14 @@
1
- import { F as he, I as _e, V as Ve } from "./constants-Cyi942Yr.js";
2
- import { useMemo as U, useEffect as k, useRef as j, useCallback as K } from "react";
3
- import { v as Z, c as p, a as ee, u as te, b as ae, d as ne, e as se, f as $ } from "./shared-5a7UkED1.js";
4
- import { useQuery as J } from "@tanstack/react-query";
5
- import { a as y } from "./client-_ayziI1d.js";
6
- import { v as G, e as Q } from "./attachment-constants-C2UHWxmp.js";
7
- import { g as ie } from "./metadata-Cc1mBcLS.js";
8
- function re(v, n) {
9
- const f = v.getFields(), T = /* @__PURE__ */ new Map(), b = v.getBoId(), c = () => n.getValues("_id") || "draft";
1
+ import { F as Ve, I as Fe, V as Se } from "./constants-Cyi942Yr.js";
2
+ import { useMemo as x, useEffect as $, useRef as k, useCallback as G } from "react";
3
+ import { v as te, c as ae, a as ne, u as se, b as ie, d as re, e as le, f as H } from "./shared-5a7UkED1.js";
4
+ import { useQuery as Q } from "@tanstack/react-query";
5
+ import { a as f } from "./client-DxWWVa0D.js";
6
+ import { v as W, e as X } from "./attachment-constants-C2UHWxmp.js";
7
+ import { g as oe } from "./metadata-D-6r1Eul.js";
8
+ function ce(U, n, r, L) {
9
+ const N = U.getFields(), F = /* @__PURE__ */ new Map(), J = U.getBoId(), h = () => L === "create" ? "draft" : n.getValues("_id") || "draft";
10
10
  return new Proxy({}, {
11
- get(C, e) {
11
+ get(B, e) {
12
12
  if (typeof e == "symbol")
13
13
  return;
14
14
  if (e === "_id")
@@ -17,163 +17,170 @@ function re(v, n) {
17
17
  return () => n.getValues();
18
18
  if (e === "validate")
19
19
  return () => n.trigger();
20
- if (T.has(e))
21
- return T.get(e);
22
- const i = f[e], o = (i == null ? void 0 : i.meta) ?? {
20
+ if (F.has(e))
21
+ return F.get(e);
22
+ const i = N[e], y = (i == null ? void 0 : i.meta) ?? {
23
23
  _id: e,
24
24
  Name: e,
25
25
  Type: "String"
26
- }, z = (i == null ? void 0 : i.readOnly) ?? !1, w = () => {
26
+ }, j = (i == null ? void 0 : i.readOnly) ?? !1, E = () => {
27
27
  if (!i) return { valid: !0, errors: [] };
28
- let s = n.getValues(e);
29
- if ("integerPart" in i && typeof s == "string" && s !== "") {
30
- const a = Number(s);
31
- isNaN(a) || (s = a, n.setValue(e, a, { shouldDirty: !1 }));
28
+ let c = n.getValues(e);
29
+ if ("integerPart" in i && typeof c == "string" && c !== "") {
30
+ const a = Number(c);
31
+ isNaN(a) || (c = a, n.setValue(e, a, { shouldDirty: !1 }));
32
32
  }
33
- if (!i.required && (s == null || s === "" || Array.isArray(s) && s.length === 0))
33
+ if (!i.required && (c == null || c === "" || Array.isArray(c) && c.length === 0))
34
34
  return { valid: !0, errors: [] };
35
- const l = i.validate(s);
36
- if (!l.valid) return l;
37
- const r = Z(i, s);
38
- if (!r.valid) return r;
39
- if (v.hasMetadata()) {
40
- const a = v.validateFieldExpression(
35
+ const s = i.validate(c);
36
+ if (!s.valid) return s;
37
+ const t = te(i, c);
38
+ if (!t.valid) return t;
39
+ if (U.hasMetadata()) {
40
+ const a = U.validateFieldExpression(
41
41
  e,
42
- s,
42
+ c,
43
43
  n.getValues()
44
44
  );
45
45
  if (!a.valid) return a;
46
46
  }
47
47
  return { valid: !0, errors: [] };
48
- }, x = (s) => {
49
- const l = n.getValues(e);
50
- return l ?? s;
48
+ }, M = (c) => {
49
+ const s = n.getValues(e);
50
+ return s ?? c;
51
51
  };
52
- if (!z) {
53
- const s = () => {
54
- const r = n.getValues(e);
55
- return o.Type === "File" ? r ?? [] : r;
56
- }, l = {
52
+ if (!j) {
53
+ const c = () => {
54
+ const t = n.getValues(e);
55
+ return y.Type === "File" ? t ?? [] : t;
56
+ }, s = {
57
57
  label: (i == null ? void 0 : i.label) ?? e,
58
58
  required: (i == null ? void 0 : i.required) ?? !1,
59
59
  readOnly: !1,
60
60
  defaultValue: i == null ? void 0 : i.defaultValue,
61
- meta: o,
62
- get: s,
63
- getOrDefault: x,
64
- set: (r) => {
65
- n.setValue(e, r, {
61
+ meta: y,
62
+ get: c,
63
+ getOrDefault: M,
64
+ set: (t) => {
65
+ var a, u, l;
66
+ n.setValue(e, t, {
66
67
  shouldDirty: !0,
67
68
  shouldTouch: !0,
68
69
  shouldValidate: !1
69
70
  // Let mode control validation timing
70
- });
71
+ }), (l = (u = (a = r == null ? void 0 : r.syncFieldRef) == null ? void 0 : a.current) == null ? void 0 : u.call(a, e)) == null || l.catch(console.warn);
71
72
  },
72
- validate: w
73
+ validate: E
73
74
  };
74
- if (o.Type === "Image" || o.Type === "File") {
75
- const r = b;
76
- o.Type === "Image" ? (l.upload = async (a) => {
77
- G(a.name, "Image");
78
- const t = c(), [d] = await y(r).getUploadUrl(t, e, [
79
- { FileName: a.name, Size: a.size, FileExtension: Q(a.name) }
75
+ if (y.Type === "Image" || y.Type === "File") {
76
+ const t = J;
77
+ y.Type === "Image" ? (s.upload = async (a) => {
78
+ var o, O, S;
79
+ W(a.name, "Image");
80
+ const u = h(), [l] = await f(t).getUploadUrl(u, e, [
81
+ { FileName: a.name, Size: a.size, FileExtension: X(a.name) }
80
82
  ]);
81
- await fetch(d.UploadUrl.URL, {
83
+ await fetch(l.UploadUrl.URL, {
82
84
  method: "PUT",
83
- headers: { "Content-Type": d.ContentType },
85
+ headers: { "Content-Type": l.ContentType },
84
86
  body: a
85
87
  });
86
- const u = {
87
- _id: d._id,
88
- _name: d._name,
89
- FileName: d.FileName,
90
- FileExtension: d.FileExtension,
91
- Size: d.Size,
92
- ContentType: d.ContentType
88
+ const d = {
89
+ _id: l._id,
90
+ _name: l._name,
91
+ FileName: l.FileName,
92
+ FileExtension: l.FileExtension,
93
+ Size: l.Size,
94
+ ContentType: l.ContentType
93
95
  };
94
- return n.setValue(e, u, { shouldDirty: !0 }), u;
95
- }, l.deleteAttachment = async () => {
96
- const a = n.getValues(e), t = c();
96
+ return n.setValue(e, d, { shouldDirty: !0 }), (S = (O = (o = r == null ? void 0 : r.persistRef) == null ? void 0 : o.current) == null ? void 0 : O.call(o, e, d)) == null || S.catch(console.warn), d;
97
+ }, s.deleteAttachment = async () => {
98
+ var l, d, o;
99
+ const a = n.getValues(e), u = h();
97
100
  if (!(a != null && a._id)) throw new Error(`${e} has no image to delete`);
98
- await y(r).deleteAttachment(t, e, a._id), n.setValue(e, null, { shouldDirty: !0 });
99
- }, l.getDownloadUrl = async (a) => {
100
- const t = n.getValues(e), d = c();
101
- if (!(t != null && t._id)) throw new Error(`${e} has no image`);
102
- return y(r).getDownloadUrl(d, e, t._id, a);
103
- }) : (l.upload = async (a) => {
104
- for (const h of a) G(h.name, "File");
105
- const t = c(), d = a.map((h) => ({
106
- FileName: h.name,
107
- Size: h.size,
108
- FileExtension: Q(h.name)
109
- })), u = await y(r).getUploadUrl(t, e, d), g = await Promise.all(
110
- a.map(async (h, m) => (await fetch(u[m].UploadUrl.URL, {
101
+ await f(t).deleteAttachment(u, e, a._id), n.setValue(e, null, { shouldDirty: !0 }), (o = (d = (l = r == null ? void 0 : r.persistRef) == null ? void 0 : l.current) == null ? void 0 : d.call(l, e, null)) == null || o.catch(console.warn);
102
+ }, s.getDownloadUrl = async (a) => {
103
+ const u = n.getValues(e), l = h();
104
+ if (!(u != null && u._id)) throw new Error(`${e} has no image`);
105
+ return f(t).getDownloadUrl(l, e, u._id, a);
106
+ }) : (s.upload = async (a) => {
107
+ var v, T, z;
108
+ for (const V of a) W(V.name, "File");
109
+ const u = h(), l = a.map((V) => ({
110
+ FileName: V.name,
111
+ Size: V.size,
112
+ FileExtension: X(V.name)
113
+ })), d = await f(t).getUploadUrl(u, e, l), o = await Promise.all(
114
+ a.map(async (V, _) => (await fetch(d[_].UploadUrl.URL, {
111
115
  method: "PUT",
112
- headers: { "Content-Type": u[m].ContentType },
113
- body: h
116
+ headers: { "Content-Type": d[_].ContentType },
117
+ body: V
114
118
  }), {
115
- _id: u[m]._id,
116
- _name: u[m]._name,
117
- FileName: u[m].FileName,
118
- FileExtension: u[m].FileExtension,
119
- Size: u[m].Size,
120
- ContentType: u[m].ContentType
119
+ _id: d[_]._id,
120
+ _name: d[_]._name,
121
+ FileName: d[_].FileName,
122
+ FileExtension: d[_].FileExtension,
123
+ Size: d[_].Size,
124
+ ContentType: d[_].ContentType
121
125
  }))
122
- ), P = n.getValues(e) ?? [];
123
- return n.setValue(e, [...P, ...g], { shouldDirty: !0 }), g;
124
- }, l.deleteAttachment = async (a) => {
125
- const t = n.getValues(e) ?? [], d = c();
126
- await y(r).deleteAttachment(d, e, a), n.setValue(
126
+ ), S = [...n.getValues(e) ?? [], ...o];
127
+ return n.setValue(e, S, { shouldDirty: !0 }), (z = (T = (v = r == null ? void 0 : r.persistRef) == null ? void 0 : v.current) == null ? void 0 : T.call(v, e, S)) == null || z.catch(console.warn), o;
128
+ }, s.deleteAttachment = async (a) => {
129
+ var o, O, S;
130
+ const u = n.getValues(e) ?? [], l = h();
131
+ await f(t).deleteAttachment(l, e, a);
132
+ const d = u.filter((v) => v._id !== a);
133
+ n.setValue(
127
134
  e,
128
- t.filter((u) => u._id !== a),
135
+ d,
129
136
  { shouldDirty: !0 }
130
- );
131
- }, l.getDownloadUrl = async (a, t) => {
132
- const d = c();
133
- return y(r).getDownloadUrl(d, e, a, t);
134
- }, l.getDownloadUrls = async (a) => {
135
- const t = c();
136
- return y(r).getDownloadUrls(t, e, a);
137
+ ), (S = (O = (o = r == null ? void 0 : r.persistRef) == null ? void 0 : o.current) == null ? void 0 : O.call(o, e, d)) == null || S.catch(console.warn);
138
+ }, s.getDownloadUrl = async (a, u) => {
139
+ const l = h();
140
+ return f(t).getDownloadUrl(l, e, a, u);
141
+ }, s.getDownloadUrls = async (a) => {
142
+ const u = h();
143
+ return f(t).getDownloadUrls(u, e, a);
137
144
  });
138
145
  }
139
- return T.set(e, l), l;
146
+ return F.set(e, s), s;
140
147
  }
141
- const A = () => {
142
- const s = n.getValues(e);
143
- return o.Type === "File" ? s ?? [] : s;
148
+ const m = () => {
149
+ const c = n.getValues(e);
150
+ return y.Type === "File" ? c ?? [] : c;
144
151
  }, I = {
145
152
  label: (i == null ? void 0 : i.label) ?? e,
146
153
  required: (i == null ? void 0 : i.required) ?? !1,
147
154
  readOnly: !0,
148
155
  defaultValue: i == null ? void 0 : i.defaultValue,
149
- meta: o,
150
- get: A,
151
- getOrDefault: x,
152
- validate: w
156
+ meta: y,
157
+ get: m,
158
+ getOrDefault: M,
159
+ validate: E
153
160
  };
154
- if (o.Type === "Image" || o.Type === "File") {
155
- const s = b;
156
- o.Type === "Image" ? I.getDownloadUrl = async (l) => {
157
- const r = n.getValues(e), a = c();
158
- if (!(r != null && r._id)) throw new Error(`${e} has no image to download`);
159
- return y(s).getDownloadUrl(a, e, r._id, l);
160
- } : (I.getDownloadUrl = async (l, r) => {
161
- const a = c();
162
- return y(s).getDownloadUrl(a, e, l, r);
163
- }, I.getDownloadUrls = async (l) => {
164
- const r = c();
165
- return y(s).getDownloadUrls(r, e, l);
161
+ if (y.Type === "Image" || y.Type === "File") {
162
+ const c = J;
163
+ y.Type === "Image" ? I.getDownloadUrl = async (s) => {
164
+ const t = n.getValues(e), a = h();
165
+ if (!(t != null && t._id)) throw new Error(`${e} has no image to download`);
166
+ return f(c).getDownloadUrl(a, e, t._id, s);
167
+ } : (I.getDownloadUrl = async (s, t) => {
168
+ const a = h();
169
+ return f(c).getDownloadUrl(a, e, s, t);
170
+ }, I.getDownloadUrls = async (s) => {
171
+ const t = h();
172
+ return f(c).getDownloadUrls(t, e, s);
166
173
  });
167
174
  }
168
- return T.set(e, I), I;
175
+ return F.set(e, I), I;
169
176
  },
170
- has(C, e) {
171
- return typeof e == "symbol" ? !1 : e === "_id" || e === "toJSON" || e === "validate" ? !0 : e in f;
177
+ has(B, e) {
178
+ return typeof e == "symbol" ? !1 : e === "_id" || e === "toJSON" || e === "validate" ? !0 : e in N;
172
179
  },
173
- ownKeys(C) {
174
- return [...Object.keys(f), "_id", "toJSON", "validate"];
180
+ ownKeys(B) {
181
+ return [...Object.keys(N), "_id", "toJSON", "validate"];
175
182
  },
176
- getOwnPropertyDescriptor(C, e) {
183
+ getOwnPropertyDescriptor(B, e) {
177
184
  if (typeof e != "symbol")
178
185
  return {
179
186
  configurable: !0,
@@ -182,155 +189,175 @@ function re(v, n) {
182
189
  }
183
190
  });
184
191
  }
185
- function fe(v) {
192
+ function he(U) {
186
193
  const {
187
194
  bdo: n,
188
- recordId: f,
189
- operation: T,
190
- defaultValues: b,
191
- mode: c = "onBlur",
192
- enableDraft: C = !1,
193
- enableConstraintValidation: e,
194
- enableExpressionValidation: i
195
- } = v, o = T ?? (f ? "update" : "create"), z = U(
196
- () => p(n, { enableConstraintValidation: e }),
197
- [n, e]
195
+ recordId: r,
196
+ operation: L,
197
+ defaultValues: N,
198
+ mode: F = "onBlur",
199
+ enableDraft: J = !1,
200
+ enableConstraintValidation: h,
201
+ enableExpressionValidation: B
202
+ } = U, e = L ?? (r ? "update" : "create"), i = x(
203
+ () => ae(n, { enableConstraintValidation: h }),
204
+ [n, h]
198
205
  ), {
199
- data: w,
200
- isLoading: x,
201
- isFetching: A,
202
- error: I
203
- } = J({
204
- queryKey: ["form-record", n.meta._id, f],
206
+ data: y,
207
+ isLoading: j,
208
+ isFetching: E,
209
+ error: M
210
+ } = Q({
211
+ queryKey: ["form-record", n.meta._id, r],
205
212
  queryFn: async () => {
206
- const _ = await n.get(f);
207
- return ee(n.getFields(), _.toJSON());
213
+ const g = await n.get(r);
214
+ return ne(n.getFields(), g.toJSON());
208
215
  },
209
- enabled: o === "update" && !!f,
216
+ enabled: e === "update" && !!r,
210
217
  staleTime: 0
211
218
  }), {
212
- data: s,
213
- isLoading: l,
214
- error: r
215
- } = J({
219
+ data: m,
220
+ isLoading: I,
221
+ error: c
222
+ } = Q({
216
223
  queryKey: ["form-draft", n.meta._id],
217
- queryFn: async () => y(n.meta._id).draftInteraction({}),
218
- enabled: o === "create",
224
+ queryFn: async () => f(n.meta._id).draftInteraction({}),
225
+ enabled: e === "create",
219
226
  staleTime: 1 / 0,
220
227
  gcTime: 0,
221
228
  retry: 1
222
- }), { data: a } = J({
229
+ }), { data: s } = Q({
223
230
  queryKey: ["form-schema", n.meta._id],
224
- queryFn: () => ie(n.meta._id),
231
+ queryFn: () => oe(n.meta._id),
225
232
  staleTime: 30 * 60 * 1e3,
226
233
  gcTime: 60 * 60 * 1e3,
227
- enabled: i !== !1
234
+ enabled: B !== !1
228
235
  });
229
- k(() => {
230
- a != null && a.BDOBlob ? n.loadMetadata(a.BDOBlob) : a != null && a.MetaBlob && n.loadMetadata(a.MetaBlob);
231
- }, [a, n]);
232
- const t = te({
233
- mode: c,
234
- resolver: z,
235
- defaultValues: b
236
+ $(() => {
237
+ s != null && s.BDOBlob ? n.loadMetadata(s.BDOBlob) : s != null && s.MetaBlob && n.loadMetadata(s.MetaBlob);
238
+ }, [s, n]);
239
+ const t = se({
240
+ mode: F,
241
+ resolver: i,
242
+ defaultValues: N
236
243
  // NOTE: Don't use `values` prop — it continuously syncs and overrides
237
244
  // setValue() calls for unregistered fields (Image/File attachments).
238
245
  // Instead, we reset once when record arrives (see useEffect below).
239
- }), d = j(null);
240
- k(() => {
241
- o === "update" && w && w !== d.current && (t.reset(w), d.current = w);
242
- }, [w, o, t]), k(() => {
243
- s != null && s._id && t.setValue("_id", s._id);
244
- }, [s, t]);
245
- const u = U(
246
- () => re(n, t),
247
- [n, t]
248
- ), g = n.getFields(), P = j(!1), h = U(
249
- () => Object.keys(g).filter((_) => g[_].readOnly),
250
- [g]
251
- ), m = K(
252
- async (_, V) => {
253
- if (o === "create" && (s != null && s._id))
254
- return y(n.meta._id).draftInteraction({
255
- _id: s._id,
256
- [_]: V
246
+ }), a = k(null);
247
+ $(() => {
248
+ var g;
249
+ if (e === "update" && y && y !== a.current) {
250
+ const w = a.current !== null && (y == null ? void 0 : y._id) === ((g = a.current) == null ? void 0 : g._id);
251
+ t.reset(y, w ? { keepDirtyValues: !0 } : void 0), a.current = y;
252
+ }
253
+ }, [y, e, t]), $(() => {
254
+ m != null && m._id && t.setValue("_id", m._id);
255
+ }, [m, t]);
256
+ const u = k(null), l = k(null), d = x(
257
+ () => ce(n, t, {
258
+ syncFieldRef: u,
259
+ persistRef: l
260
+ }, e),
261
+ [n, t, e]
262
+ ), o = n.getFields(), O = k(!1), S = x(
263
+ () => Object.keys(o).filter((g) => o[g].readOnly),
264
+ [o]
265
+ ), v = G(
266
+ async (g, w) => {
267
+ if (e === "create" && (m != null && m._id))
268
+ return f(n.meta._id).draftInteraction({
269
+ _id: m._id,
270
+ [g]: w
257
271
  });
258
- if (o === "update" && f)
259
- return y(n.meta._id).update(f, {
260
- [_]: V
272
+ if (e === "update" && r)
273
+ return f(n.meta._id).update(r, {
274
+ [g]: w
261
275
  });
262
276
  },
263
- [o, s, f, n]
264
- ), R = U(
265
- () => ae({
266
- apiFn: m,
267
- allFields: g,
268
- readonlyFieldNames: h,
277
+ [e, m, r, n]
278
+ ), T = x(
279
+ () => ie({
280
+ apiFn: v,
281
+ allFields: o,
282
+ readonlyFieldNames: S,
269
283
  rhf: t,
270
- isComputingRef: P
284
+ isComputingRef: O
271
285
  }),
272
- [m, g, h, t]
273
- ), N = c === "onChange" || c === "all", q = c === "onBlur" || c === "onTouched" || c === "all", H = U(
274
- () => ne({
286
+ [v, o, S, t]
287
+ );
288
+ u.current = T;
289
+ const z = G(
290
+ async (g, w) => {
291
+ try {
292
+ await v(g, w);
293
+ } catch (b) {
294
+ console.error("[useBDOForm] persistValue failed:", b);
295
+ }
296
+ },
297
+ [v, e, r]
298
+ );
299
+ l.current = z;
300
+ const V = F === "onChange" || F === "all", _ = F === "onBlur" || F === "onTouched" || F === "all", Y = x(
301
+ () => re({
275
302
  rhf: t,
276
- allFields: g,
277
- syncField: R,
278
- syncOnBlur: q,
279
- syncOnChange: N
303
+ allFields: o,
304
+ syncField: T,
305
+ syncOnBlur: _,
306
+ syncOnChange: V
280
307
  }),
281
- [t, g, R, q, N]
282
- ), W = U(
283
- () => se({
308
+ [t, o, T, _, V]
309
+ ), Z = x(
310
+ () => le({
284
311
  control: t.control,
285
- syncField: R,
286
- syncOnBlur: q,
287
- syncOnChange: N
312
+ syncField: T,
313
+ syncOnBlur: _,
314
+ syncOnChange: V
288
315
  }),
289
- [t.control, R, q, N]
290
- ), X = K(
291
- (_, V) => t.handleSubmit(
292
- async (B, E) => {
316
+ [t.control, T, _, V]
317
+ ), p = G(
318
+ (g, w) => t.handleSubmit(
319
+ async (b, A) => {
293
320
  try {
294
- const S = {}, M = t.getValues();
295
- if (o === "create")
296
- for (const [O, F] of Object.entries(g)) {
297
- if (F.readOnly) continue;
298
- const D = M[O] !== void 0 ? M[O] : B[O];
299
- D !== void 0 && (S[O] = $(F, D));
321
+ const R = {}, P = t.getValues();
322
+ if (e === "create")
323
+ for (const [C, D] of Object.entries(o)) {
324
+ if (D.readOnly) continue;
325
+ const q = P[C] !== void 0 ? P[C] : b[C];
326
+ q !== void 0 && (R[C] = H(D, q));
300
327
  }
301
328
  else {
302
- const O = t.formState.dirtyFields;
303
- for (const [F, D] of Object.entries(g)) {
304
- if (D.readOnly || !O[F]) continue;
305
- const Y = M[F] !== void 0 ? M[F] : B[F];
306
- S[F] = $(D, Y);
329
+ const C = t.formState.dirtyFields;
330
+ for (const [D, q] of Object.entries(o)) {
331
+ if (q.readOnly || !C[D]) continue;
332
+ const ee = P[D] !== void 0 ? P[D] : b[D];
333
+ R[D] = H(q, ee);
307
334
  }
308
335
  }
309
- let L;
310
- o === "create" ? (S._id = s == null ? void 0 : s._id, L = await y(n.meta._id).draft(S)) : L = await y(n.meta._id).update(f, S), _ == null || _(L, E);
311
- } catch (S) {
312
- V == null || V(S, E);
336
+ let K;
337
+ e === "create" ? (R._id = m == null ? void 0 : m._id, K = await f(n.meta._id).draft(R)) : K = await f(n.meta._id).update(r, R), g == null || g(K, A);
338
+ } catch (R) {
339
+ w == null || w(R, A);
313
340
  }
314
341
  },
315
- (B, E) => {
316
- V == null || V(B, E);
342
+ (b, A) => {
343
+ w == null || w(b, A);
317
344
  }
318
345
  ),
319
- [t, n, o, f, g, s]
346
+ [t, n, e, r, o, m]
320
347
  );
321
348
  return {
322
- item: u,
349
+ item: d,
323
350
  bdo: n,
324
- operation: o,
325
- recordId: f,
326
- register: H,
327
- handleSubmit: X,
351
+ operation: e,
352
+ recordId: r,
353
+ register: Y,
354
+ handleSubmit: p,
328
355
  watch: t.watch,
329
356
  setValue: t.setValue,
330
357
  getValues: t.getValues,
331
358
  reset: t.reset,
332
359
  trigger: t.trigger,
333
- control: W,
360
+ control: Z,
334
361
  formState: t.formState,
335
362
  errors: t.formState.errors,
336
363
  isDirty: t.formState.isDirty,
@@ -338,16 +365,16 @@ function fe(v) {
338
365
  isSubmitting: t.formState.isSubmitting,
339
366
  isSubmitSuccessful: t.formState.isSubmitSuccessful,
340
367
  dirtyFields: t.formState.dirtyFields,
341
- isLoading: x || l,
342
- isFetching: A,
343
- loadError: I ?? r,
344
- draftId: s == null ? void 0 : s._id,
345
- isCreatingDraft: l
368
+ isLoading: j || I,
369
+ isFetching: E,
370
+ loadError: M ?? c,
371
+ draftId: m == null ? void 0 : m._id,
372
+ isCreatingDraft: I
346
373
  };
347
374
  }
348
375
  export {
349
- he as FormOperation,
350
- _e as InteractionMode,
351
- Ve as ValidationMode,
352
- fe as useBDOForm
376
+ Ve as FormOperation,
377
+ Fe as InteractionMode,
378
+ Se as ValidationMode,
379
+ he as useBDOForm
353
380
  };
@@ -1 +1 @@
1
- "use strict";const o=require("./client-D5k4SYuw.cjs");async function c(e){try{const r=o.getApiBaseUrl(),s=o.getDefaultHeaders(),a=await fetch(`${r}/api/app/meta/bdo/${e}`,{method:"GET",headers:s});if(!a.ok)throw new Error(`Failed to fetch schema for ${e}: ${a.statusText}`);const t=await a.json();if(!t||typeof t!="object")throw new Error(`Invalid BDO schema response for ${e}`);return t}catch(r){throw console.error(`Schema fetch error for ${e}:`,r),new Error(`Failed to load BDO schema: ${r instanceof Error?r.message:"Unknown error"}`)}}async function n(e){try{const r=o.getApiBaseUrl(),s=o.getDefaultHeaders(),a=e!=null&&e.Filter||e!=null&&e.Sort?"POST":"GET",t=await fetch(`${r}/api/app/metadata/list`,{method:a,headers:s,...a==="POST"&&e&&{body:JSON.stringify(e)}});if(!t.ok)throw new Error(`Failed to list metadata: ${t.statusText}`);return await t.json()}catch(r){throw console.error("Metadata list error:",r),new Error(`Failed to list metadata: ${r instanceof Error?r.message:"Unknown error"}`)}}exports.getBdoSchema=c;exports.listMetadata=n;
1
+ "use strict";const o=require("./client-B4tX3hPi.cjs");async function c(e){try{const r=o.getApiBaseUrl(),s=o.getDefaultHeaders(),a=await fetch(`${r}/api/app/meta/bdo/${e}`,{method:"GET",headers:s});if(!a.ok)throw new Error(`Failed to fetch schema for ${e}: ${a.statusText}`);const t=await a.json();if(!t||typeof t!="object")throw new Error(`Invalid BDO schema response for ${e}`);return t}catch(r){throw console.error(`Schema fetch error for ${e}:`,r),new Error(`Failed to load BDO schema: ${r instanceof Error?r.message:"Unknown error"}`)}}async function n(e){try{const r=o.getApiBaseUrl(),s=o.getDefaultHeaders(),a=e!=null&&e.Filter||e!=null&&e.Sort?"POST":"GET",t=await fetch(`${r}/api/app/metadata/list`,{method:a,headers:s,...a==="POST"&&e&&{body:JSON.stringify(e)}});if(!t.ok)throw new Error(`Failed to list metadata: ${t.statusText}`);return await t.json()}catch(r){throw console.error("Metadata list error:",r),new Error(`Failed to list metadata: ${r instanceof Error?r.message:"Unknown error"}`)}}exports.getBdoSchema=c;exports.listMetadata=n;
@@ -1,4 +1,4 @@
1
- import { c as s, g as c } from "./client-_ayziI1d.js";
1
+ import { c as s, g as c } from "./client-DxWWVa0D.js";
2
2
  async function l(r) {
3
3
  try {
4
4
  const e = s(), o = c(), a = await fetch(`${e}/api/app/meta/bdo/${r}`, {