Skip to content

Commit

Permalink
feat: add more fields to Measurements object (#302)
Browse files Browse the repository at this point in the history
The following fields are present in raw measurements stored in
web3.storage, let's add them to our Measurements object:

-  timeout
-  car_checksum
-  car_too_large

Signed-off-by: Miroslav Bajtoš <oss@bajtos.net>
  • Loading branch information
bajtos authored Aug 2, 2024
1 parent dc66d24 commit b4bc0a1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/preprocess.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ export class Measurement {
this.first_byte_at = parseDateTime(m.first_byte_at)
this.end_at = parseDateTime(m.end_at)
this.status_code = m.status_code
this.timeout = m.timeout
this.indexerResult = pointerize(m.indexer_result)
this.stationId = pointerize(m.station_id)
this.carChecksum = pointerize(m.car_checksum)
this.carTooLarge = m.car_too_large
}
}

Expand Down
1 change: 1 addition & 0 deletions lib/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export interface RawMeasurement {
timeout: boolean;
byte_length: number;
car_too_large: boolean;
car_checksum: string;
indexer_result: string | undefined | null;
}

Expand Down
3 changes: 3 additions & 0 deletions test/helpers/test-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ export const VALID_MEASUREMENT = {
first_byte_at: new Date('2023-11-01T09:00:01.000Z').getTime(),
end_at: new Date('2023-11-01T09:00:02.000Z').getTime(),
finished_at: new Date('2023-11-01T09:00:10.000Z').getTime(),
timeout: false,
byte_length: 1024,
carChecksum: 'some-car-checksum',
carTooLarge: false,
retrievalResult: 'OK',
indexerResult: 'OK',
fraudAssessment: null
Expand Down

0 comments on commit b4bc0a1

Please sign in to comment.