@vef-framework-react/approval-form-bridge 2.9.0 → 2.10.0
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 +9 -4
- package/dist/cjs/project.cjs +1 -1
- package/dist/es/index.js +1 -1
- package/dist/es/issues.js +1 -1
- package/dist/es/project.js +66 -48
- package/dist/es/registry.js +1 -1
- package/dist/es/validate.js +1 -1
- package/dist/types/contract.d.ts +6 -12
- package/dist/types/index.d.ts +1 -1
- package/dist/types/project.d.ts +18 -10
- package/dist/types/project.parity.test.d.ts +1 -0
- package/package.json +3 -3
package/README
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
# @vef-framework-react/approval-form-bridge
|
|
2
2
|
|
|
3
3
|
Projection bridge from `@vef-framework-react/form-editor` schemas to the approval form contract
|
|
4
|
-
(`approval/
|
|
4
|
+
(`approval/form_field.go` in the Go backend — a bare `ApprovalFormField[]`, no wrapper object), plus the
|
|
5
|
+
approval capability profile for the designer. Deploy sends the rich schema verbatim
|
|
6
|
+
(`DeployFlowCmd.FormSchema`); the backend derives the flat field list itself via its
|
|
7
|
+
`internal/approval/formeditor` parser — the enforcement-side twin of `projectFormSchema`, kept in
|
|
8
|
+
lockstep through the golden fixtures under `src/__fixtures__/formeditor-parity/`.
|
|
5
9
|
|
|
6
10
|
## Installation
|
|
7
11
|
|
|
@@ -23,9 +27,10 @@ import {
|
|
|
23
27
|
const [registries] = useState(createApprovalRegistries);
|
|
24
28
|
<FormEditor registries={registries} onSchemaChange={setSchema} />;
|
|
25
29
|
|
|
26
|
-
// 2. One projection feeds every consumer
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
// 2. One projection feeds every designer-side consumer (deploy itself sends
|
|
31
|
+
// the rich schema raw — the backend re-derives `fields` at deploy).
|
|
32
|
+
const { fields, formFields, issues, valid } = projectFormSchema(schema);
|
|
33
|
+
// fields → live field inventory (preview of what the Go parser derives)
|
|
29
34
|
// formFields → ApprovalFlowEditor plugins.formFields (condition / permission editors)
|
|
30
35
|
// valid → gate persistence on it; errors are contract-breaking
|
|
31
36
|
|
package/dist/cjs/project.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./issues.cjs");let t=require("@vef-framework-react/form-editor");var n={textfield:`input`,"code-editor":`textarea`,textarea:`textarea`,number:`number`,select:`select`,radio:`select`,"checkbox-group":`select`,date:`date`,datetime:`date`},r=new Set([`switch`,`daterange`]);function i(n){let r=[],i=[],
|
|
1
|
+
const e=require("./issues.cjs");let t=require("@vef-framework-react/form-editor");var n={textfield:`input`,"code-editor":`textarea`,textarea:`textarea`,number:`number`,select:`select`,radio:`select`,"checkbox-group":`select`,date:`date`,datetime:`date`},r=new Set([`switch`,`daterange`]);function i(n){let r=[],i=[],u=[],d=new Map((n.dataSources??[]).map(e=>[e.id,e])),f=new Map;for(let p of[n.presentations.pc,n.presentations.mobile])p!==void 0&&(0,t.walkNodes)(p,(n,m)=>{if(m.length>0||!(0,t.isKeyedNode)(n))return;let g=f.get(n.key),_=a(n);if(_!==void 0){g!==null&&(r.push(_),f.set(n.key,null));return}if(g!==void 0){if(g!==null){let t=o(n);t!==null&&t!==g.kind?r.push(e.issueCrossDeviceKindMismatch(n.key,g.kind,t)):t===`table`&&g.tableSignature!==void 0&&s(n)!==g.tableSignature&&r.push(e.issueCrossDeviceTableMismatch(n.key))}return}let v=n.type===`subform`,y=v?l(n,d,r):c(n,n.key,d,r);f.set(n.key,y===void 0?null:{kind:y.approval.kind,...v&&{tableSignature:s(n)}}),y!==void 0&&(i.push({...y.approval,sortOrder:i.length}),u.push(h(p,n)?{...y.flow,hasConditionalVisibility:!0}:y.flow))});return{fields:i,formFields:u,issues:r,valid:r.every(e=>e.severity!==`error`)}}function a(t){if(!(t.type===`subform`||n[t.type]!==void 0))return r.has(t.type)?e.issueUnmappableFieldType(t.key,t.type):e.issueUnknownFieldType(t.key,t.type)}function o(e){return e.type===`subform`?`table`:n[e.type]??null}function s(e){let r=[],i=new Set;return(0,t.walkNodes)({children:e.template},(e,a)=>{a.length>0||!(0,t.isKeyedNode)(e)||i.has(e.key)||(i.add(e.key),r.push(`${e.key}:${e.type===`subform`?`table`:n[e.type]??`?`}`))}),r.join(`,`)}function c(t,i,a,o){let s=n[t.type];if(s===void 0){o.push(r.has(t.type)?e.issueUnmappableFieldType(i,t.type):e.issueUnknownFieldType(i,t.type));return}m(t,i,o);let c=t.label??t.key,l=u(t,i,a,o),{isRequired:h,rule:g}=p(t),_=d(t),{precision:v}=t,{placeholder:y}=t,b=v!==void 0&&v>0;return g?.pattern!==void 0&&f(g.pattern)&&o.push(e.issuePatternUnsupported(i)),_===`decimal`&&!b&&o.push(e.issueDecimalScaleMissing(i)),{approval:{key:t.key,kind:s,label:c,...y!==void 0&&{placeholder:y},...h&&{isRequired:h},...l!==void 0&&{options:l},...g!==void 0&&{validation:g},..._!==void 0&&{columnType:_},..._===`decimal`&&b&&{scale:v}},flow:{key:t.key,kind:s,label:c,...l!==void 0&&{options:l}}}}function l(n,r,i){let a=[],o=[],s=new Set,l=!1;if((0,t.walkNodes)({children:n.template},(u,d)=>{if(d.length>0||!(0,t.isKeyedNode)(u)||s.has(u.key))return;if(s.add(u.key),u.type===`subform`){l=!0,i.push(e.issueNestedSubform(`${n.key}.${u.key}`));return}let f=c(u,`${n.key}.${u.key}`,r,i);f!==void 0&&(a.push({...f.approval,sortOrder:a.length}),o.push(f.flow))}),a.length===0){l||i.push(e.issueTableColumnsEmpty(n.key));return}m(n,n.key,i);let u=n.label??n.key,d=(n.minRows??0)>=1,f={...n.minRows!==void 0&&n.minRows>0&&{minLength:n.minRows},...n.maxRows!==void 0&&{maxLength:n.maxRows}},p=f.minLength!==void 0||f.maxLength!==void 0;return{approval:{key:n.key,kind:`table`,label:u,...d&&{isRequired:d},...p&&{validation:f},columns:a},flow:{key:n.key,kind:`table`,label:u,columns:o}}}function u(t,n,r,i){let a=t.dataSource;if(a!==void 0){if(a.kind===`static`)return a.options;if(a.kind===`ref`){let e=r.get(a.dataSourceId);if(e?.kind===`static`)return e.options}i.push(e.issueOptionsNotStatic(n))}}function d(e){if(e.columnType!==void 0)return e.columnType;let n=(0,t.inferColumnType)(e);return e.type===`number`&&n===`integer`?void 0:n}function f(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];if(r===`\\`){let r=e[n+1];if(!t&&r!==void 0&&r>=`1`&&r<=`9`)return!0;n++;continue}if(r===`[`){t=!0;continue}if(r===`]`){t=!1;continue}if(!t&&r===`(`&&e[n+1]===`?`){let t=e.slice(n+2);if(t.startsWith(`=`)||t.startsWith(`!`)||t.startsWith(`<=`)||t.startsWith(`<!`))return!0}}return!1}function p(e){let{required:t,...n}=e.validate??{},r=Object.entries(n).filter(([,e])=>e!==void 0);return{isRequired:t===!0,...r.length>0&&{rule:Object.fromEntries(r)}}}function m(t,n,r){let{linkage:i}=t;i!==void 0&&(i.defaults!==void 0||(i.rules?.length??0)>0)&&r.push(e.issueLinkageNotProjected(n))}function h(e,n){if(g(n.linkage))return!0;for(let r=(0,t.findParentContainer)(e,n.id);r!==void 0;r=(0,t.findParentContainer)(e,r.id))if(g(r.linkage))return!0;return!1}function g(e){return e===void 0?!1:e.defaults?.hidden===!0?!0:(e.rules??[]).some(e=>e.actions.some(e=>e.type===`hide`||e.type===`show`||e.type===`script`))}exports.projectFormSchema=i;
|
package/dist/es/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/approval-form-bridge v2.
|
|
1
|
+
/*! @vef-framework-react/approval-form-bridge v2.10.0 made by Venus | 2026-07-13T07:28:58.867Z */
|
|
2
2
|
import { projectFormSchema as e } from "./project.js";
|
|
3
3
|
import { APPROVAL_EXCLUDED_FIELD_TYPES as t, createApprovalRegistries as n } from "./registry.js";
|
|
4
4
|
import { validateApprovalSchema as r } from "./validate.js";
|
package/dist/es/issues.js
CHANGED
package/dist/es/project.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @vef-framework-react/approval-form-bridge v2.
|
|
1
|
+
/*! @vef-framework-react/approval-form-bridge v2.10.0 made by Venus | 2026-07-13T07:28:58.867Z */
|
|
2
2
|
import { issueCrossDeviceKindMismatch as e, issueCrossDeviceTableMismatch as t, issueDecimalScaleMissing as n, issueLinkageNotProjected as r, issueNestedSubform as i, issueOptionsNotStatic as a, issuePatternUnsupported as o, issueTableColumnsEmpty as s, issueUnknownFieldType as c, issueUnmappableFieldType as l } from "./issues.js";
|
|
3
|
-
import {
|
|
3
|
+
import { findParentContainer as u, inferColumnType as d, isKeyedNode as f, walkNodes as p } from "@vef-framework-react/form-editor";
|
|
4
4
|
//#region src/project.ts
|
|
5
|
-
var
|
|
5
|
+
var m = {
|
|
6
6
|
textfield: "input",
|
|
7
7
|
"code-editor": "textarea",
|
|
8
8
|
textarea: "textarea",
|
|
@@ -12,53 +12,63 @@ var p = {
|
|
|
12
12
|
"checkbox-group": "select",
|
|
13
13
|
date: "date",
|
|
14
14
|
datetime: "date"
|
|
15
|
-
},
|
|
16
|
-
function
|
|
15
|
+
}, h = /* @__PURE__ */ new Set(["switch", "daterange"]);
|
|
16
|
+
function g(n) {
|
|
17
17
|
let r = [], i = [], a = [], o = new Map((n.dataSources ?? []).map((e) => [e.id, e])), s = /* @__PURE__ */ new Map();
|
|
18
|
-
for (let c of [n.presentations.pc, n.presentations.mobile]) c !== void 0 &&
|
|
19
|
-
if (
|
|
20
|
-
let
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
for (let c of [n.presentations.pc, n.presentations.mobile]) c !== void 0 && p(c, (n, l) => {
|
|
19
|
+
if (l.length > 0 || !f(n)) return;
|
|
20
|
+
let u = s.get(n.key), d = _(n);
|
|
21
|
+
if (d !== void 0) {
|
|
22
|
+
u !== null && (r.push(d), s.set(n.key, null));
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (u !== void 0) {
|
|
26
|
+
if (u !== null) {
|
|
27
|
+
let i = v(n);
|
|
28
|
+
i !== null && i !== u.kind ? r.push(e(n.key, u.kind, i)) : i === "table" && u.tableSignature !== void 0 && y(n) !== u.tableSignature && r.push(t(n.key));
|
|
25
29
|
}
|
|
26
30
|
return;
|
|
27
31
|
}
|
|
28
|
-
let
|
|
29
|
-
s.set(n.key,
|
|
30
|
-
kind:
|
|
31
|
-
...
|
|
32
|
-
}),
|
|
33
|
-
...
|
|
32
|
+
let p = n.type === "subform", m = p ? x(n, o, r) : b(n, n.key, o, r);
|
|
33
|
+
s.set(n.key, m === void 0 ? null : {
|
|
34
|
+
kind: m.approval.kind,
|
|
35
|
+
...p && { tableSignature: y(n) }
|
|
36
|
+
}), m !== void 0 && (i.push({
|
|
37
|
+
...m.approval,
|
|
34
38
|
sortOrder: i.length
|
|
35
|
-
}), a.push(
|
|
39
|
+
}), a.push(D(c, n) ? {
|
|
40
|
+
...m.flow,
|
|
41
|
+
hasConditionalVisibility: !0
|
|
42
|
+
} : m.flow));
|
|
36
43
|
});
|
|
37
44
|
return {
|
|
38
|
-
|
|
45
|
+
fields: i,
|
|
39
46
|
formFields: a,
|
|
40
47
|
issues: r,
|
|
41
48
|
valid: r.every((e) => e.severity !== "error")
|
|
42
49
|
};
|
|
43
50
|
}
|
|
44
|
-
function g(e) {
|
|
45
|
-
return e.type === "subform" ? "table" : p[e.type] ?? null;
|
|
46
|
-
}
|
|
47
51
|
function _(e) {
|
|
52
|
+
if (!(e.type === "subform" || m[e.type] !== void 0)) return h.has(e.type) ? l(e.key, e.type) : c(e.key, e.type);
|
|
53
|
+
}
|
|
54
|
+
function v(e) {
|
|
55
|
+
return e.type === "subform" ? "table" : m[e.type] ?? null;
|
|
56
|
+
}
|
|
57
|
+
function y(e) {
|
|
48
58
|
let t = [], n = /* @__PURE__ */ new Set();
|
|
49
|
-
return
|
|
50
|
-
r.length > 0 || !
|
|
59
|
+
return p({ children: e.template }, (e, r) => {
|
|
60
|
+
r.length > 0 || !f(e) || n.has(e.key) || (n.add(e.key), t.push(`${e.key}:${e.type === "subform" ? "table" : m[e.type] ?? "?"}`));
|
|
51
61
|
}), t.join(",");
|
|
52
62
|
}
|
|
53
|
-
function
|
|
54
|
-
let a =
|
|
63
|
+
function b(e, t, r, i) {
|
|
64
|
+
let a = m[e.type];
|
|
55
65
|
if (a === void 0) {
|
|
56
|
-
i.push(
|
|
66
|
+
i.push(h.has(e.type) ? l(t, e.type) : c(t, e.type));
|
|
57
67
|
return;
|
|
58
68
|
}
|
|
59
|
-
|
|
60
|
-
let s = e.label ?? e.key, u =
|
|
61
|
-
return f?.pattern !== void 0 &&
|
|
69
|
+
E(e, t, i);
|
|
70
|
+
let s = e.label ?? e.key, u = S(e, t, r, i), { isRequired: d, rule: f } = T(e), p = C(e), { precision: g } = e, { placeholder: _ } = e, v = g !== void 0 && g > 0;
|
|
71
|
+
return f?.pattern !== void 0 && w(f.pattern) && i.push(o(t)), p === "decimal" && !v && i.push(n(t)), {
|
|
62
72
|
approval: {
|
|
63
73
|
key: e.key,
|
|
64
74
|
kind: a,
|
|
@@ -67,8 +77,8 @@ function v(e, t, r, i) {
|
|
|
67
77
|
...d && { isRequired: d },
|
|
68
78
|
...u !== void 0 && { options: u },
|
|
69
79
|
...f !== void 0 && { validation: f },
|
|
70
|
-
...
|
|
71
|
-
...
|
|
80
|
+
...p !== void 0 && { columnType: p },
|
|
81
|
+
...p === "decimal" && v && { scale: g }
|
|
72
82
|
},
|
|
73
83
|
flow: {
|
|
74
84
|
key: e.key,
|
|
@@ -78,15 +88,15 @@ function v(e, t, r, i) {
|
|
|
78
88
|
}
|
|
79
89
|
};
|
|
80
90
|
}
|
|
81
|
-
function
|
|
91
|
+
function x(e, t, n) {
|
|
82
92
|
let r = [], a = [], o = /* @__PURE__ */ new Set(), c = !1;
|
|
83
|
-
if (
|
|
84
|
-
if (l.length > 0 || !
|
|
93
|
+
if (p({ children: e.template }, (s, l) => {
|
|
94
|
+
if (l.length > 0 || !f(s) || o.has(s.key)) return;
|
|
85
95
|
if (o.add(s.key), s.type === "subform") {
|
|
86
96
|
c = !0, n.push(i(`${e.key}.${s.key}`));
|
|
87
97
|
return;
|
|
88
98
|
}
|
|
89
|
-
let u =
|
|
99
|
+
let u = b(s, `${e.key}.${s.key}`, t, n);
|
|
90
100
|
u !== void 0 && (r.push({
|
|
91
101
|
...u.approval,
|
|
92
102
|
sortOrder: r.length
|
|
@@ -95,18 +105,18 @@ function y(e, t, n) {
|
|
|
95
105
|
c || n.push(s(e.key));
|
|
96
106
|
return;
|
|
97
107
|
}
|
|
98
|
-
|
|
99
|
-
let l = e.label ?? e.key, u = (e.minRows ?? 0) >= 1,
|
|
108
|
+
E(e, e.key, n);
|
|
109
|
+
let l = e.label ?? e.key, u = (e.minRows ?? 0) >= 1, d = {
|
|
100
110
|
...e.minRows !== void 0 && e.minRows > 0 && { minLength: e.minRows },
|
|
101
111
|
...e.maxRows !== void 0 && { maxLength: e.maxRows }
|
|
102
|
-
}, m =
|
|
112
|
+
}, m = d.minLength !== void 0 || d.maxLength !== void 0;
|
|
103
113
|
return {
|
|
104
114
|
approval: {
|
|
105
115
|
key: e.key,
|
|
106
116
|
kind: "table",
|
|
107
117
|
label: l,
|
|
108
118
|
...u && { isRequired: u },
|
|
109
|
-
...m && { validation:
|
|
119
|
+
...m && { validation: d },
|
|
110
120
|
columns: r
|
|
111
121
|
},
|
|
112
122
|
flow: {
|
|
@@ -117,7 +127,7 @@ function y(e, t, n) {
|
|
|
117
127
|
}
|
|
118
128
|
};
|
|
119
129
|
}
|
|
120
|
-
function
|
|
130
|
+
function S(e, t, n, r) {
|
|
121
131
|
let i = e.dataSource;
|
|
122
132
|
if (i !== void 0) {
|
|
123
133
|
if (i.kind === "static") return i.options;
|
|
@@ -128,12 +138,12 @@ function b(e, t, n, r) {
|
|
|
128
138
|
r.push(a(t));
|
|
129
139
|
}
|
|
130
140
|
}
|
|
131
|
-
function
|
|
141
|
+
function C(e) {
|
|
132
142
|
if (e.columnType !== void 0) return e.columnType;
|
|
133
|
-
let t =
|
|
143
|
+
let t = d(e);
|
|
134
144
|
return e.type === "number" && t === "integer" ? void 0 : t;
|
|
135
145
|
}
|
|
136
|
-
function
|
|
146
|
+
function w(e) {
|
|
137
147
|
let t = !1;
|
|
138
148
|
for (let n = 0; n < e.length; n++) {
|
|
139
149
|
let r = e[n];
|
|
@@ -158,16 +168,24 @@ function S(e) {
|
|
|
158
168
|
}
|
|
159
169
|
return !1;
|
|
160
170
|
}
|
|
161
|
-
function
|
|
171
|
+
function T(e) {
|
|
162
172
|
let { required: t, ...n } = e.validate ?? {}, r = Object.entries(n).filter(([, e]) => e !== void 0);
|
|
163
173
|
return {
|
|
164
174
|
isRequired: t === !0,
|
|
165
175
|
...r.length > 0 && { rule: Object.fromEntries(r) }
|
|
166
176
|
};
|
|
167
177
|
}
|
|
168
|
-
function
|
|
178
|
+
function E(e, t, n) {
|
|
169
179
|
let { linkage: i } = e;
|
|
170
180
|
i !== void 0 && (i.defaults !== void 0 || (i.rules?.length ?? 0) > 0) && n.push(r(t));
|
|
171
181
|
}
|
|
182
|
+
function D(e, t) {
|
|
183
|
+
if (O(t.linkage)) return !0;
|
|
184
|
+
for (let n = u(e, t.id); n !== void 0; n = u(e, n.id)) if (O(n.linkage)) return !0;
|
|
185
|
+
return !1;
|
|
186
|
+
}
|
|
187
|
+
function O(e) {
|
|
188
|
+
return e === void 0 ? !1 : e.defaults?.hidden === !0 ? !0 : (e.rules ?? []).some((e) => e.actions.some((e) => e.type === "hide" || e.type === "show" || e.type === "script"));
|
|
189
|
+
}
|
|
172
190
|
//#endregion
|
|
173
|
-
export {
|
|
191
|
+
export { g as projectFormSchema };
|
package/dist/es/registry.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/approval-form-bridge v2.
|
|
1
|
+
/*! @vef-framework-react/approval-form-bridge v2.10.0 made by Venus | 2026-07-13T07:28:58.867Z */
|
|
2
2
|
import { createDefaultMobileRegistry as e, createDefaultRegistry as t } from "@vef-framework-react/form-editor";
|
|
3
3
|
//#region src/registry.ts
|
|
4
4
|
var n = [
|
package/dist/es/validate.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/approval-form-bridge v2.
|
|
1
|
+
/*! @vef-framework-react/approval-form-bridge v2.10.0 made by Venus | 2026-07-13T07:28:58.867Z */
|
|
2
2
|
import { projectFormSchema as e } from "./project.js";
|
|
3
3
|
import { validateSchema as t } from "@vef-framework-react/form-editor";
|
|
4
4
|
//#region src/validate.ts
|
package/dist/types/contract.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ColumnDataType } from '@vef-framework-react/form-editor';
|
|
2
2
|
/**
|
|
3
|
-
* Field kind stored by the approval backend (`approval/
|
|
3
|
+
* Field kind stored by the approval backend (`approval/form_field.go`
|
|
4
4
|
* `FieldKind` / `approval/enums.go`). The Go enum is the source of truth;
|
|
5
5
|
* this union mirrors it literal-for-literal so drift fails the type-check at
|
|
6
6
|
* every assignment site.
|
|
@@ -29,10 +29,11 @@ export interface ApprovalValidationRule {
|
|
|
29
29
|
message?: string;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
* A single form field flattened to the Go backend's `FormFieldDefinition
|
|
33
|
-
* The
|
|
34
|
-
*
|
|
35
|
-
*
|
|
32
|
+
* A single form field flattened to the Go backend's `FormFieldDefinition`
|
|
33
|
+
* (`approval/form_field.go`). The contract's top-level artifact is a bare
|
|
34
|
+
* `ApprovalFormField[]` — there is no wrapper object. The field list IS the
|
|
35
|
+
* data model: under `table` storage each entry becomes a column (each `table`
|
|
36
|
+
* field its own child table), under `json` storage a JSONB key.
|
|
36
37
|
*
|
|
37
38
|
* `defaultValue` and `props` exist on the wire contract but are never emitted
|
|
38
39
|
* by the projector today — the designer has no static default-value source,
|
|
@@ -67,10 +68,3 @@ export interface ApprovalFormField {
|
|
|
67
68
|
*/
|
|
68
69
|
columns?: ApprovalFormField[];
|
|
69
70
|
}
|
|
70
|
-
/**
|
|
71
|
-
* The flat form definition the approval backend deploys
|
|
72
|
-
* (`DeployFlowCmd.FormDefinition`).
|
|
73
|
-
*/
|
|
74
|
-
export interface ApprovalFormDefinition {
|
|
75
|
-
fields: ApprovalFormField[];
|
|
76
|
-
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { type ApprovalFieldKind, type ApprovalFieldOption, type
|
|
1
|
+
export { type ApprovalFieldKind, type ApprovalFieldOption, type ApprovalFormField, type ApprovalValidationRule } from './contract';
|
|
2
2
|
export { type ProjectionIssue, type ProjectionIssueCode } from './issues';
|
|
3
3
|
export { projectFormSchema, type ProjectionResult } from './project';
|
|
4
4
|
export { APPROVAL_EXCLUDED_FIELD_TYPES, createApprovalRegistries } from './registry';
|
package/dist/types/project.d.ts
CHANGED
|
@@ -1,29 +1,37 @@
|
|
|
1
1
|
import { FormFieldDefinition as FlowFormFieldDefinition } from '@vef-framework-react/approval-flow-editor';
|
|
2
2
|
import { FormSchema } from '@vef-framework-react/form-editor';
|
|
3
|
-
import {
|
|
3
|
+
import { ApprovalFormField } from './contract';
|
|
4
4
|
import { ProjectionIssue } from './issues';
|
|
5
5
|
/**
|
|
6
6
|
* Result of projecting a designed {@link FormSchema} onto the approval form
|
|
7
7
|
* contract. One walk feeds both consumers so they cannot disagree:
|
|
8
|
-
* `
|
|
9
|
-
* `formFields` is
|
|
10
|
-
* consumes through `EditorPlugins.formFields`
|
|
11
|
-
* with their columns, so the condition
|
|
8
|
+
* `fields` is the flat field inventory — the same list the Go parser derives
|
|
9
|
+
* from the deployed schema — and `formFields` is that inventory in the shape
|
|
10
|
+
* the approval flow editor consumes through `EditorPlugins.formFields`
|
|
11
|
+
* (detail-table fields included, with their columns, so the condition
|
|
12
|
+
* editor's aggregate UI works).
|
|
12
13
|
*/
|
|
13
14
|
export interface ProjectionResult {
|
|
14
|
-
|
|
15
|
+
fields: ApprovalFormField[];
|
|
15
16
|
formFields: FlowFormFieldDefinition[];
|
|
16
17
|
issues: ProjectionIssue[];
|
|
17
18
|
/**
|
|
18
19
|
* `true` when no error-severity issue was raised. The backend's form data
|
|
19
|
-
* is a closed contract — deploying
|
|
20
|
-
* deploy validation or poisons every submit — so hosts
|
|
21
|
-
* persistence on this flag.
|
|
20
|
+
* is a closed contract — deploying a schema whose projection is invalid
|
|
21
|
+
* either fails the deploy validation or poisons every submit — so hosts
|
|
22
|
+
* must gate persistence on this flag.
|
|
22
23
|
*/
|
|
23
24
|
valid: boolean;
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
|
-
* Project a designed form schema onto the approval form contract
|
|
27
|
+
* Project a designed form schema onto the approval form contract — a
|
|
28
|
+
* designer-side UX aid: the live field inventory behind the flow editor's
|
|
29
|
+
* permission / condition matrix, plus pre-deploy validation feedback that
|
|
30
|
+
* mirrors the Go parser. Deploy does not consume this projection: the backend
|
|
31
|
+
* receives the rich schema verbatim (`DeployFlowCmd.FormSchema`) and derives
|
|
32
|
+
* the flat field list itself via `internal/approval/formeditor` — the
|
|
33
|
+
* enforcement-side twin of this function, kept in lockstep through the shared
|
|
34
|
+
* golden fixtures under `__fixtures__/formeditor-parity/`.
|
|
27
35
|
*
|
|
28
36
|
* Both device presentations are walked (pc first) and deduped by key — the
|
|
29
37
|
* submitted data contract is shared across devices, and the backend's form
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vef-framework-react/approval-form-bridge",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Projection bridge from form-editor schemas to the approval form contract",
|
|
6
6
|
"keywords": [
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"dist"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@vef-framework-react/
|
|
44
|
-
"@vef-framework-react/
|
|
43
|
+
"@vef-framework-react/form-editor": "2.10.0",
|
|
44
|
+
"@vef-framework-react/approval-flow-editor": "2.10.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"react": "^19.2.7"
|