Skip to content

Commit

Permalink
Fix errors which caused build failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
linlin-s committed Nov 22, 2023
1 parent 306a8fd commit c215e5c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 22 deletions.
18 changes: 8 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,17 @@
},
"homepage": "https://github.com/amazon-ion/ion-hash-js#readme",
"devDependencies": {
"grunt": "^1.0.1",
"grunt": "^1.4.1",
"grunt-contrib-clean": "^1.0.0",
"grunt-ts": "^6.0.0-beta.19",
"grunt-typedoc": "^0.2.4",
"intern": "^4.4.3",
"grunt-ts": "^4.0.1",
"grunt-typedoc": "^0.2.3",
"intern": "^4.2.4",
"ion-js": "^5.2.0",
"jsbi": "^4.3.0",
"typedoc": "^0.23.0",
"typedoc-plugin-no-inherit": "^1.1.10",
"typescript": "^4.6.0"
"typedoc": "^0.23.28",
"typedoc-plugin-no-inherit": "^1.4.0",
"typescript": "^4.9.5"
},
"peerDependencies": {
"ion-js": "^5.2.0",
"jsbi": "^4.3.0"
"ion-js": "^5.2.0"
}
}
11 changes: 5 additions & 6 deletions src/internal/IonHashImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {Decimal, IntSize, IonType, IonTypes, makeBinaryWriter,
import {createHash, Hash} from 'crypto';

import {Hasher, HasherProvider, HashReader, HashWriter} from "../IonHash";
import JSBI from "jsbi";

export class _CryptoHasher implements Hasher {
private _hash: Hash;
Expand Down Expand Up @@ -57,9 +56,9 @@ export class _HashReaderImpl implements HashReader, _IonValue {

// implements Reader
annotations() : string[] { return this._reader.annotations() }
bigIntValue() : JSBI | null { return this._reader.bigIntValue() }
bigIntValue() : bigint | null { return this._reader.bigIntValue() }
booleanValue() : boolean | null { return this._reader.booleanValue() }
byteValue() : Uint8Array | null { return this._reader.byteValue() }
byteValue() : Uint8Array | null { return this._reader.uInt8ArrayValue() }
decimalValue() : Decimal | null { return this._reader.decimalValue() }
depth() : number { return this._reader.depth() }
fieldName() : string | null { return this._reader.fieldName() }
Expand Down Expand Up @@ -184,7 +183,7 @@ export class _HashWriterImpl implements HashWriter, _IonValue {
this._hashScalar(IonTypes.FLOAT, value);
this._writer.writeFloat64(value);
}
writeInt(value: number | JSBI | null): void {
writeInt(value: number | bigint | null): void {
this._hashScalar(IonTypes.INT, value);
this._writer.writeInt(value);
}
Expand Down Expand Up @@ -255,8 +254,8 @@ export class _HashWriterImpl implements HashWriter, _IonValue {
case IonTypes.TIMESTAMP: this.writeTimestamp(reader.timestampValue()); break;
case IonTypes.SYMBOL: this.writeSymbol(reader.stringValue()); break;
case IonTypes.STRING: this.writeString(reader.stringValue()); break;
case IonTypes.CLOB: this.writeClob(reader.byteValue()); break;
case IonTypes.BLOB: this.writeBlob(reader.byteValue()); break;
case IonTypes.CLOB: this.writeClob(reader.uInt8ArrayValue()); break;
case IonTypes.BLOB: this.writeBlob(reader.uInt8ArrayValue()); break;
case IonTypes.LIST: this.stepIn(IonTypes.LIST); break;
case IonTypes.SEXP: this.stepIn(IonTypes.SEXP); break;
case IonTypes.STRUCT: this.stepIn(IonTypes.STRUCT); break;
Expand Down
11 changes: 5 additions & 6 deletions tests/HashReaderTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* permissions and limitations under the License.
*/

import JSBI from "jsbi";
import intern from 'intern';

const {registerSuite} = intern.getPlugin('interface.object');
Expand All @@ -40,7 +39,7 @@ class ReaderComparer implements Reader {
assert.deepEqual(this.readerA.annotations(), this.readerB.annotations());
return this.readerA.annotations();
}
bigIntValue(): JSBI | null {
bigIntValue(): bigint | null {
assert.deepEqual(this.readerA.bigIntValue(), this.readerB.bigIntValue());
return this.readerA.bigIntValue();
}
Expand All @@ -49,8 +48,8 @@ class ReaderComparer implements Reader {
return this.readerA.booleanValue();
}
byteValue(): Uint8Array | null {
assert.deepEqual(this.readerA.byteValue(), this.readerB.byteValue());
return this.readerA.byteValue()
assert.deepEqual(this.readerA.uInt8ArrayValue(), this.readerB.uInt8ArrayValue());
return this.readerA.uInt8ArrayValue()
}
decimalValue(): Decimal | null {
assert.deepEqual(this.readerA.decimalValue(), this.readerB.decimalValue());
Expand Down Expand Up @@ -132,8 +131,8 @@ function traverse(reader: Reader) {
case IonTypes.TIMESTAMP: { reader.timestampValue(); break }
case IonTypes.SYMBOL: { reader.stringValue(); break }
case IonTypes.STRING: { reader.stringValue(); break }
case IonTypes.CLOB: { reader.byteValue(); break }
case IonTypes.BLOB: { reader.byteValue(); break }
case IonTypes.CLOB: { reader.uInt8ArrayValue(); break }
case IonTypes.BLOB: { reader.uInt8ArrayValue(); break }
}
reader.isNull();
if (!type.isContainer) {
Expand Down

0 comments on commit c215e5c

Please sign in to comment.