not-node 6.2.1 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "not-node",
3
- "version": "6.2.1",
3
+ "version": "6.2.4",
4
4
  "description": "node complimentary part for client side notFramework.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -194,9 +194,9 @@ function mutateFieldSide(field, mutation, side) {
194
194
  module.exports.mutateFieldSide = mutateFieldSide;
195
195
 
196
196
  function mutateField(sourceField, sourceMutation) {
197
- const sides = ["ui", " model"];
198
- let field = structuredClone(sourceField);
199
- let mutation = structuredClone(sourceMutation);
197
+ const sides = ["ui", "model"];
198
+ let field = clone(sourceField);
199
+ let mutation = clone(sourceMutation);
200
200
  if (mutation) {
201
201
  sides.forEach((side) => mutateFieldSide(field, mutation, side));
202
202
  }
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