@flowrunner/cli 0.1.18-dev.3 → 0.1.19-dev.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowrunner/cli",
3
- "version": "0.1.18-dev.3",
3
+ "version": "0.1.19-dev.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/runtime/index.js CHANGED
@@ -13334,6 +13334,8 @@ function resolveTarget(plan, segments, fieldValue) {
13334
13334
  let label = plan.label;
13335
13335
  let found = true;
13336
13336
  for (const segment of segments) {
13337
+ const branch = schema && inspect(schema).branches?.find((candidate) => isIndex(segment) ? inspect(candidate).coreType === "array" : shapeEntries(inspect(candidate).core).some(([name]) => name === segment));
13338
+ schema = branch ?? schema;
13337
13339
  const core = schema ? inspect(schema).core : void 0;
13338
13340
  const coreType = core ? inspect(schema).coreType : void 0;
13339
13341
  value = value == null ? void 0 : value[segment];
@@ -13372,7 +13374,7 @@ function toFieldIssue(plan, issue, fieldValue) {
13372
13374
  if (isAuthored(issue)) {
13373
13375
  return { path: path2, code, message: issue.message };
13374
13376
  }
13375
- if (code !== "invalid_union" && target.schema && inspect(target.schema).branches) {
13377
+ if (code === "invalid_format" && target.schema && inspect(target.schema).branches) {
13376
13378
  const combined = unionPhrases(target.schema, target.value);
13377
13379
  if (combined.length > 1) {
13378
13380
  return { path: path2, code: "invalid_union", message: `\xAB${target.label}\xBB must be ${combined.join(", or ")}` };
@@ -13402,6 +13404,9 @@ function toFieldIssue(plan, issue, fieldValue) {
13402
13404
  return described ? { path: path2, code, message: `\xAB${target.label}\xBB is invalid \u2014 ${described.replace(/^Expects /, "expects ")}` } : { path: path2, code, message: `\xAB${target.label}\xBB has an invalid format` };
13403
13405
  }
13404
13406
  if (code === "invalid_union") {
13407
+ if (segments.length && target.found && target.value == null) {
13408
+ return { path: path2, code, message: requiredMessage(named) };
13409
+ }
13405
13410
  const combined = unionIssue(plan, issue, target.schema, target.value, fieldValue);
13406
13411
  if (combined) {
13407
13412
  return combined.path ? combined : { path: path2, code, message: `\xAB${target.label}\xBB ${combined.message}` };