api_binding_ui 3.3.0 → 3.3.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/dist/vite.js CHANGED
@@ -744,10 +744,6 @@ function compileSteps(steps, cx, at, ops, imports) {
744
744
  cx.use.add("finish");
745
745
  for (const st of steps) {
746
746
  const op = ops.get(st.operation);
747
- if (!op) {
748
- cx.issue("catalog.operation-missing", `${st.operation} is not in the API docs.`, at);
749
- continue;
750
- }
751
747
  const scope = { item: true, steps: done };
752
748
  const call = compileCall(op, st.request, cx, scope, at);
753
749
  imports.add(call.fn);
@@ -818,6 +814,12 @@ function generate(file, catalog) {
818
814
  issue: (code, message, at) => issues.push({ severity: "error", screen: screen.id, code, message, ...at }),
819
815
  warn: (code, message, at) => issues.push({ severity: "warning", screen: screen.id, code, message, ...at })
820
816
  };
817
+ const gone = (operations, at) => {
818
+ const missing = operations.filter((o) => !ops.has(o));
819
+ for (const o of missing)
820
+ cx.warn("catalog.operation-missing", `${o} is no longer in the API docs; generated unbound until it is rebound.`, at);
821
+ return missing.length > 0;
822
+ };
821
823
  const bindings = new Map;
822
824
  for (const b of index[screen.id] ?? []) {
823
825
  if (!keys.has(b.component)) {
@@ -855,7 +857,7 @@ function generate(file, catalog) {
855
857
  if (s.role === "trigger") {
856
858
  types.add("Action");
857
859
  outT.push(`${prop(s.id)}: Action`);
858
- if (b?.type !== "steps") {
860
+ if (b?.type !== "steps" || gone(b.steps.map((st) => st.operation), at)) {
859
861
  unbound(s.id, "UNBOUND_ACTION");
860
862
  continue;
861
863
  }
@@ -881,13 +883,11 @@ function generate(file, catalog) {
881
883
  out.push(`${prop(s.id)}: { bound: true, data: ${compileExpr(b.value, cx, { item: false }, at)}, loading: false, error: undefined }`);
882
884
  continue;
883
885
  }
884
- const op = b?.type === "operation" ? ops.get(b.operation) : undefined;
885
- if (b?.type === "operation" && !op)
886
- cx.issue("catalog.operation-missing", `${b.operation} is not in the API docs.`, at);
887
- if (b?.type !== "operation" || !op) {
886
+ if (b?.type !== "operation" || gone([b.operation], at)) {
888
887
  unbound(s.id, "UNBOUND_DATA");
889
888
  continue;
890
889
  }
890
+ const op = ops.get(b.operation);
891
891
  const call = compileCall(op, b.request, cx, { item: false }, at);
892
892
  imports.add(call.fn);
893
893
  ["useData", "ok"].forEach((h) => cx.use.add(h));
@@ -1045,8 +1045,7 @@ async function regenerate(file, log = console.log) {
1045
1045
  try {
1046
1046
  const r = await writeScreens(file);
1047
1047
  for (const i of r.issues)
1048
- if (i.severity === "error")
1049
- log(`[api-binding] ${describeIssue(i)}`);
1048
+ log(`[api-binding] ${describeIssue(i)}`);
1050
1049
  if (r.issues.some((i) => i.severity === "error"))
1051
1050
  log("[api-binding] Screen hooks not regenerated: fix the errors above.");
1052
1051
  else if (r.changed.length || r.stale.length)
@@ -1065,7 +1064,7 @@ async function generateClient(root, log = console.log) {
1065
1064
  await generate(config, root);
1066
1065
  log("[api-binding] API client generated.");
1067
1066
  } catch (e) {
1068
- log(`[api-binding] API client not generated: ${e.message}`);
1067
+ log(`[api-binding] API client not generated, so it may lack APIs the hooks call: ${e.message}`);
1069
1068
  }
1070
1069
  }
1071
1070
  function bindingStudio(options = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "api_binding_ui",
3
- "version": "3.3.0",
3
+ "version": "3.3.2",
4
4
  "description": "Design-time API binding: register screen components, bind them to documented APIs in a studio, and generate plain React Query hooks over an Orval client. Nothing ships in the app.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",