not-node 6.2.3 → 6.2.4
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 +1 -1
- package/src/form/form.js +24 -13
package/package.json
CHANGED
package/src/form/form.js
CHANGED
|
@@ -359,25 +359,36 @@ class Form {
|
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
361
|
|
|
362
|
+
extractActionFieldsFromRequest(req) {
|
|
363
|
+
if (
|
|
364
|
+
req?.notRouteData?.actionData?.fields &&
|
|
365
|
+
Array.isArray(req.notRouteData.actionData.fields)
|
|
366
|
+
) {
|
|
367
|
+
return req.notRouteData.actionData.fields.flat(2);
|
|
368
|
+
}
|
|
369
|
+
if (
|
|
370
|
+
req?.notRouteData?.rule?.fields &&
|
|
371
|
+
Array.isArray(req.notRouteData.rule.fields)
|
|
372
|
+
) {
|
|
373
|
+
return req.notRouteData.rule.fields;
|
|
374
|
+
}
|
|
375
|
+
return [];
|
|
376
|
+
}
|
|
377
|
+
|
|
362
378
|
createInstructionFromRouteActionFields(
|
|
363
379
|
req,
|
|
364
380
|
mainInstruction = "fromBody",
|
|
365
381
|
exceptions = {}
|
|
366
382
|
) {
|
|
367
383
|
const result = {};
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
} else {
|
|
377
|
-
result[fieldName] = mainInstruction;
|
|
378
|
-
}
|
|
379
|
-
});
|
|
380
|
-
}
|
|
384
|
+
const fields = this.extractActionFieldsFromRequest(req);
|
|
385
|
+
fields.forEach((fieldName) => {
|
|
386
|
+
if (objHas(exceptions, fieldName)) {
|
|
387
|
+
result[fieldName] = exceptions[fieldName];
|
|
388
|
+
} else {
|
|
389
|
+
result[fieldName] = mainInstruction;
|
|
390
|
+
}
|
|
391
|
+
});
|
|
381
392
|
return result;
|
|
382
393
|
}
|
|
383
394
|
|