Skip to content

Commit

Permalink
Remove unnecessary use of fs-extras
Browse files Browse the repository at this point in the history
Current Node versions provide all the required capability in the standard fs package.

Signed-off-by: Mark S. Lewis <[email protected]>
  • Loading branch information
bestbeforetoday committed Mar 4, 2024
1 parent 6126c09 commit 131b8b2
Show file tree
Hide file tree
Showing 19 changed files with 1,806 additions and 1,200 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ yarn.lock
.nyc_output
**/typescript/*.js
**/typescript/*.js.map
install-fabric.sh

fabric*.tgz

Expand All @@ -28,6 +29,7 @@ common/temp/**
**/.rush/temp/**
**/*.build.error.log
**/*.build.log
**/*.test_fv.log

package-deps.json
test-results.xml
Expand Down
6 changes: 3 additions & 3 deletions apis/fabric-contract-api/lib/jsontransactionserializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

const Logger = require('./logger');
const logger = Logger.getLogger('./lib/jsontransactionserializer.js');
const {classToPlain, plainToClass} = require('class-transformer');
const {instanceToPlain, plainToInstance} = require('class-transformer');

/**
* Uses the standard JSON serialization methods for converting to and from JSON strings
Expand Down Expand Up @@ -43,7 +43,7 @@ module.exports = class JSONSerializer {
return Buffer.from(result.toString());
} else {
logger.debug(`${loggerPrefix} toBuffer has no schema/lacks sufficient schema to validate against`, schema);
const payload = JSON.stringify(classToPlain(result));
const payload = JSON.stringify(instanceToPlain(result));
return Buffer.from(payload);
}
} else {
Expand Down Expand Up @@ -134,7 +134,7 @@ module.exports = class JSONSerializer {
if (cnstr) {
logger.debug(`${loggerPrefix} fromBuffer handling data as object`);
jsonForValidation = JSON.parse(stringData);
value = plainToClass(cnstr, jsonForValidation);
value = plainToInstance(cnstr, jsonForValidation);
return {value, jsonForValidation};
}
logger.debug(`${loggerPrefix} no known constructor`);
Expand Down
2 changes: 1 addition & 1 deletion apis/fabric-contract-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@
"nyc": "15.1.0",
"rewire": "6.0.0",
"sinon": "13.0.1",
"typescript": "4.4.4"
"typescript": "5.2.2"
}
}
Loading

0 comments on commit 131b8b2

Please sign in to comment.