@nanobpm/urban 0.32.0 → 0.32.1

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.
@@ -686,12 +686,21 @@ function renderActionForm(node) {
686
686
  msg.textContent = "Field '" + p.action.correlationKeyField + "' is required";
687
687
  return;
688
688
  }
689
+ // Send the trimmed key back as the variable too, so the value a worker
690
+ // reads matches the key the message was correlated on (no leading/trailing
691
+ // whitespace divergence between correlationKey and variables[field]).
692
+ variables[p.action.correlationKeyField] = correlationKey;
689
693
  await getJSON("/app/actions/message", { method: "POST",
690
694
  headers: { "content-type": "application/json" },
691
695
  body: JSON.stringify({ name: p.action.message, correlationKey, variables }) });
692
696
  msg.className = "pc-msg ok";
693
697
  msg.textContent = "Message published";
694
698
  } else {
699
+ if (!p.action || !p.action.process) {
700
+ msg.className = "pc-msg err";
701
+ msg.textContent = "This form has no action configured";
702
+ return;
703
+ }
695
704
  const res = await getJSON("/app/actions/start/" + encodeURIComponent(p.action.process),
696
705
  { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ variables }) });
697
706
  msg.className = "pc-msg ok";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nanobpm/urban",
3
- "version": "0.32.0",
3
+ "version": "0.32.1",
4
4
  "description": "Urban: build and run code-first apps on Nano — runtime, derivation toolkit, and CLI in one. Author durable processes with @nanobpm/workflow (defineFlow), a typed datasource, forms, triggers and surfaces from a nano.app.json manifest, on Node or Deno.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -146,8 +146,14 @@ test("renderActionForm supports a publishMessage action (message-started process
146
146
  assert.match(js, /p\.action\.kind === "publishMessage"/);
147
147
  assert.match(js, /variables\[p\.action\.correlationKeyField\]/);
148
148
  assert.match(js, /"\/app\/actions\/message"/);
149
+ // The trimmed correlation key is written back as the variable, so the value a
150
+ // worker reads matches the key the message was correlated on.
151
+ assert.match(js, /variables\[p\.action\.correlationKeyField\] = correlationKey/);
149
152
  // startProcess remains the default/back-compat branch.
150
153
  assert.match(js, /"\/app\/actions\/start\/" \+ encodeURIComponent\(p\.action\.process\)/);
154
+ // A missing action is reported clearly instead of throwing on p.action.process.
155
+ assert.match(js, /if \(!p\.action \|\| !p\.action\.process\)/);
156
+ assert.match(js, /no action configured/);
151
157
  });
152
158
 
153
159
  test("the renderer bridges the console theme over postMessage", async () => {
@@ -733,12 +733,21 @@ function renderActionForm(node) {
733
733
  msg.textContent = "Field '" + p.action.correlationKeyField + "' is required";
734
734
  return;
735
735
  }
736
+ // Send the trimmed key back as the variable too, so the value a worker
737
+ // reads matches the key the message was correlated on (no leading/trailing
738
+ // whitespace divergence between correlationKey and variables[field]).
739
+ variables[p.action.correlationKeyField] = correlationKey;
736
740
  await getJSON("/app/actions/message", { method: "POST",
737
741
  headers: { "content-type": "application/json" },
738
742
  body: JSON.stringify({ name: p.action.message, correlationKey, variables }) });
739
743
  msg.className = "pc-msg ok";
740
744
  msg.textContent = "Message published";
741
745
  } else {
746
+ if (!p.action || !p.action.process) {
747
+ msg.className = "pc-msg err";
748
+ msg.textContent = "This form has no action configured";
749
+ return;
750
+ }
742
751
  const res = await getJSON("/app/actions/start/" + encodeURIComponent(p.action.process),
743
752
  { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ variables }) });
744
753
  msg.className = "pc-msg ok";