Skip to content

Commit

Permalink
[Reputation Oracle] fix: json-stable-stringify usage (#3097)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnechay authored Feb 14, 2025
1 parent 9bf2fc8 commit 9dc20ff
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 18 deletions.
3 changes: 1 addition & 2 deletions packages/apps/job-launcher/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"decimal.js": "^10.4.3",
"helmet": "^7.1.0",
"joi": "^17.13.3",
"json-stable-stringify": "^1.1.1",
"json-stable-stringify": "^1.2.1",
"nestjs-minio-client": "^2.2.0",
"passport": "^0.7.0",
"passport-jwt": "^4.0.1",
Expand All @@ -73,7 +73,6 @@
"@types/bcrypt": "^5.0.2",
"@types/express": "^4.17.13",
"@types/jest": "29.5.12",
"@types/json-stable-stringify": "^1.0.36",
"@types/node": "22.10.5",
"@types/supertest": "^6.0.2",
"@types/xml2js": "0.4.14",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ describe('StorageService', () => {
.fn()
.mockResolvedValueOnce(true);

const fileContents = stringify(MOCK_MANIFEST) ?? '';
const fileContents = stringify(MOCK_MANIFEST) as string;
const hash = hashString(fileContents);

const fileData = await storageService.uploadJsonLikeData(MOCK_MANIFEST);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class StorageService {
contentType = ContentType.TEXT_PLAIN;
extension = '';
} else {
fileContents = stringify(data) || '';
fileContents = stringify(data) as string;
contentType = ContentType.APPLICATION_JSON;
extension = Extension.JSON;
}
Expand Down
4 changes: 1 addition & 3 deletions packages/apps/reputation-oracle/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"@nestjs/terminus": "^11.0.0",
"@nestjs/typeorm": "^10.0.1",
"@sendgrid/mail": "^8.1.3",
"@types/json-stable-stringify": "^1.0.36",
"@types/passport-jwt": "^4.0.1",
"bcrypt": "^5.1.1",
"body-parser": "^1.20.3",
Expand All @@ -54,7 +53,7 @@
"ethers": "^6.13.5",
"helmet": "^7.1.0",
"joi": "^17.13.3",
"json-stable-stringify": "^1.1.1",
"json-stable-stringify": "^1.2.1",
"lodash": "^4.17.21",
"minio": "7.1.3",
"passport": "^0.7.0",
Expand All @@ -76,7 +75,6 @@
"@types/bcrypt": "^5.0.2",
"@types/express": "^4.17.13",
"@types/jest": "29.5.12",
"@types/json-stable-stringify": "^1.0.36",
"@types/lodash": "^4.17.14",
"@types/node": "22.10.5",
"@types/supertest": "^6.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ export class EscrowCompletionService {

const batchHash = crypto
.createHash('sha1')
.update(stringify(formattedPayouts))
.update(stringify(formattedPayouts) as string)
.digest('hex');

const escrowPayoutsBatchEntity = new EscrowPayoutsBatchEntity();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ describe('WebhookOutgoingService', () => {

const hash = crypto
.createHash('sha1')
.update(stringify({ payload, url }))
.update(stringify({ payload, url }) as string)
.digest('hex');

const webhookEntity: Partial<WebhookOutgoingEntity> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class WebhookOutgoingService {
): Promise<void> {
const hash = crypto
.createHash('sha1')
.update(stringify({ payload, url }))
.update(stringify({ payload, url }) as string)
.digest('hex');

let webhookEntity = new WebhookOutgoingEntity();
Expand Down
9 changes: 1 addition & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6320,13 +6320,6 @@
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841"
integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==

"@types/json-stable-stringify@^1.0.36":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@types/json-stable-stringify/-/json-stable-stringify-1.2.0.tgz#fda9291c45a8ec79ed195883fb2bb09f0aa95854"
integrity sha512-PEHY3ohqolHqAzDyB1+31tFaAMnoLN7x/JgdcGmNZ2uvtEJ6rlFCUYNQc0Xe754xxCYLNGZbLUGydSE6tS4S9A==
dependencies:
json-stable-stringify "*"

"@types/json5@^0.0.29":
version "0.0.29"
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
Expand Down Expand Up @@ -14565,7 +14558,7 @@ json-stable-stringify-without-jsonify@^1.0.1:
resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651"
integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==

json-stable-stringify@*, json-stable-stringify@^1.1.1:
json-stable-stringify@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.2.1.tgz#addb683c2b78014d0b78d704c2fcbdf0695a60e2"
integrity sha512-Lp6HbbBgosLmJbjx0pBLbgvx68FaFU1sdkmBuckmhhJ88kL13OA51CDtR2yJB50eCNMH9wRqtQNNiAqQH4YXnA==
Expand Down

0 comments on commit 9dc20ff

Please sign in to comment.