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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/form/form.js +24 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "not-node",
3
- "version": "6.2.3",
3
+ "version": "6.2.4",
4
4
  "description": "node complimentary part for client side notFramework.",
5
5
  "main": "index.js",
6
6
  "scripts": {
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
- if (
369
- req?.notRouteData?.actionData?.fields &&
370
- Array.isArray(req.notRouteData.actionData.fields)
371
- ) {
372
- const fields = req.notRouteData.actionData.fields.flat(2);
373
- fields.forEach((fieldName) => {
374
- if (objHas(exceptions, fieldName)) {
375
- result[fieldName] = exceptions[fieldName];
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