Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Commit

Permalink
(fix) Permit resources for relationships during validation
Browse files Browse the repository at this point in the history
Signed-off-by: Jerome Simeon <[email protected]>
  • Loading branch information
jeromesimeon committed Mar 21, 2019
1 parent 0fb8f7a commit bcf0bce
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/ergo-engine/lib/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ class Engine {
});

// add immutables to the context
vm.freeze(serializer.toJSON(validContract, {convertResourcesToRelationships: true}), 'data');
vm.freeze(serializer.toJSON(validState, {convertResourcesToRelationships: true}), 'state');
vm.freeze(serializer.toJSON(validContract, {permitResourcesForRelationships:true}), 'data');
vm.freeze(serializer.toJSON(validState, {permitResourcesForRelationships:true}), 'state');
vm.freeze(now, 'now');
vm.freeze(serializer.toJSON(validRequest, {convertResourcesToRelationships: true}), 'request');
vm.freeze(serializer.toJSON(validRequest, {permitResourcesForRelationships:true}), 'request');

// execute the logic
vm.run(script);
Expand Down Expand Up @@ -201,7 +201,7 @@ class Engine {
const validParam = serializer.fromJSON(params[key], {validate: false, acceptResourcesForRelationships: true});
validParam.$validator = new ResourceValidator({permitResourcesForRelationships: true});
validParam.validate();
validParams[key] = serializer.toJSON(validParam, {convertResourcesToRelationships: true});
validParams[key] = serializer.toJSON(validParam, {permitResourcesForRelationships:true});
} else {
validParams[key] = params[key];
}
Expand Down Expand Up @@ -235,8 +235,8 @@ class Engine {
});

// add immutables to the context
vm.freeze(serializer.toJSON(validContract, {convertResourcesToRelationships: true}), 'data');
vm.freeze(serializer.toJSON(validState, {convertResourcesToRelationships: true}), 'state');
vm.freeze(serializer.toJSON(validContract, {permitResourcesForRelationships:true}), 'data');
vm.freeze(serializer.toJSON(validState, {permitResourcesForRelationships:true}), 'state');
vm.freeze(now, 'now');
vm.freeze(validParams, 'params');

Expand Down Expand Up @@ -324,7 +324,7 @@ class Engine {
});

// add immutables to the context
vm.freeze(serializer.toJSON(validContract, {convertResourcesToRelationships: true}), 'data');
vm.freeze(serializer.toJSON(validContract, {permitResourcesForRelationships:true}), 'data');
vm.freeze(now, 'now');

// execute the logic
Expand Down

0 comments on commit bcf0bce

Please sign in to comment.