diff --git a/packages/bolt-connection/test/bolt/__snapshots__/bolt-protocol-v1.test.js.snap b/packages/bolt-connection/test/bolt/__snapshots__/bolt-protocol-v1.test.js.snap index 5f5c946e2..905cc191a 100644 --- a/packages/bolt-connection/test/bolt/__snapshots__/bolt-protocol-v1.test.js.snap +++ b/packages/bolt-connection/test/bolt/__snapshots__/bolt-protocol-v1.test.js.snap @@ -33,14 +33,8 @@ exports[`#unit BoltProtocolV1 .packable() should pack types introduced afterward { "days": 1, "months": 1, - "nanoseconds": Integer { - "high": 0, - "low": 1, - }, - "seconds": Integer { - "high": 0, - "low": 1, - }, + "nanoseconds": 1, + "seconds": 1, } `; diff --git a/packages/core/src/integer.ts b/packages/core/src/integer.ts index 36c6a82b2..58e8cf2d9 100644 --- a/packages/core/src/integer.ts +++ b/packages/core/src/integer.ts @@ -1100,6 +1100,13 @@ const inSafeRange = Integer.inSafeRange */ const toNumber = Integer.toNumber +/** + * Converts a variable to a BigInt + * @access public + * @param {Mixed} value - The variable to convert + * @return {BigInt} - the variable as a BigInt + */ +const toBigInt = Integer.valueOf /** * Converts the integer to a string representation * @access public @@ -1109,6 +1116,6 @@ const toNumber = Integer.toNumber */ const toString = Integer.toString -export { int, isInt, inSafeRange, toNumber, toString } +export { int, isInt, inSafeRange, toNumber, toBigInt, toString } export default Integer diff --git a/packages/core/src/result.ts b/packages/core/src/result.ts index a83a116c7..3d970b59a 100644 --- a/packages/core/src/result.ts +++ b/packages/core/src/result.ts @@ -240,7 +240,7 @@ class Result implements Promise, ResultSummary>} The async iterator for the Results diff --git a/packages/core/src/temporal-types.ts b/packages/core/src/temporal-types.ts index 7ea533506..b28c3e9c4 100644 --- a/packages/core/src/temporal-types.ts +++ b/packages/core/src/temporal-types.ts @@ -23,7 +23,7 @@ import { assertValidDate } from './internal/util' import { newError } from './error' -import Integer, { int, toNumber } from './integer' +import Integer, { int, toNumber, isInt } from './integer' const IDENTIFIER_PROPERTY_ATTRIBUTES = { value: true, @@ -79,6 +79,14 @@ export class Duration { * @type {NumberOrInteger} */ this.nanoseconds = util.normalizeNanosecondsForDuration(nanoseconds) as T + if (typeof this.months === 'number' && isInt(this.nanoseconds) && isInt(this.seconds)) { + this.seconds = this.seconds.toNumber() as T + this.nanoseconds = this.nanoseconds.toNumber() as T + } + if (typeof this.months === 'bigint' && isInt(this.nanoseconds) && isInt(this.seconds)) { + this.seconds = this.seconds.toBigInt() as T + this.nanoseconds = this.nanoseconds.toBigInt() as T + } Object.freeze(this) } diff --git a/packages/core/test/__snapshots__/json.test.ts.snap b/packages/core/test/__snapshots__/json.test.ts.snap index 195fb37ba..d5add173b 100644 --- a/packages/core/test/__snapshots__/json.test.ts.snap +++ b/packages/core/test/__snapshots__/json.test.ts.snap @@ -12,11 +12,11 @@ exports[`json .stringify should handle DateTime in list 1`] = `"[{"year":2024,"m exports[`json .stringify should handle DateTime in object 1`] = `"{"key":{"year":2024,"month":6,"day":13,"hour":10,"minute":0,"second":30,"nanosecond":134,"timeZoneOffsetSeconds":-3600,"timeZoneId":"Europe/Berlin"}}"`; -exports[`json .stringify should handle Duration 1`] = `"{"months":10,"days":2,"seconds":{"low":35,"high":0},"nanoseconds":{"low":100,"high":0}}"`; +exports[`json .stringify should handle Duration 1`] = `"{"months":10,"days":2,"seconds":35,"nanoseconds":100}"`; -exports[`json .stringify should handle Duration in list 1`] = `"[{"months":10,"days":2,"seconds":{"low":35,"high":0},"nanoseconds":{"low":100,"high":0}}]"`; +exports[`json .stringify should handle Duration in list 1`] = `"[{"months":10,"days":2,"seconds":35,"nanoseconds":100}]"`; -exports[`json .stringify should handle Duration in object 1`] = `"{"key":{"months":10,"days":2,"seconds":{"low":35,"high":0},"nanoseconds":{"low":100,"high":0}}}"`; +exports[`json .stringify should handle Duration in object 1`] = `"{"key":{"months":10,"days":2,"seconds":35,"nanoseconds":100}}"`; exports[`json .stringify should handle Integer 1`] = `"{"low":5,"high":0}"`; diff --git a/packages/neo4j-driver-deno/lib/core/integer.ts b/packages/neo4j-driver-deno/lib/core/integer.ts index 471564e3b..489893368 100644 --- a/packages/neo4j-driver-deno/lib/core/integer.ts +++ b/packages/neo4j-driver-deno/lib/core/integer.ts @@ -1100,6 +1100,13 @@ const inSafeRange = Integer.inSafeRange */ const toNumber = Integer.toNumber +/** + * Converts a variable to a BigInt + * @access public + * @param {Mixed} value - The variable to convert + * @return {BigInt} - the variable as a BigInt + */ +const toBigInt = Integer.valueOf /** * Converts the integer to a string representation * @access public @@ -1109,6 +1116,6 @@ const toNumber = Integer.toNumber */ const toString = Integer.toString -export { int, isInt, inSafeRange, toNumber, toString } +export { int, isInt, inSafeRange, toNumber, toBigInt, toString } export default Integer diff --git a/packages/neo4j-driver-deno/lib/core/result.ts b/packages/neo4j-driver-deno/lib/core/result.ts index 901d70e2c..87e6e6209 100644 --- a/packages/neo4j-driver-deno/lib/core/result.ts +++ b/packages/neo4j-driver-deno/lib/core/result.ts @@ -240,7 +240,7 @@ class Result implements Promise, ResultSummary>} The async iterator for the Results diff --git a/packages/neo4j-driver-deno/lib/core/temporal-types.ts b/packages/neo4j-driver-deno/lib/core/temporal-types.ts index fbc48dd35..66093f9b4 100644 --- a/packages/neo4j-driver-deno/lib/core/temporal-types.ts +++ b/packages/neo4j-driver-deno/lib/core/temporal-types.ts @@ -23,7 +23,7 @@ import { assertValidDate } from './internal/util.ts' import { newError } from './error.ts' -import Integer, { int, toNumber } from './integer.ts' +import Integer, { int, toNumber, isInt } from './integer.ts' const IDENTIFIER_PROPERTY_ATTRIBUTES = { value: true, @@ -79,6 +79,14 @@ export class Duration { * @type {NumberOrInteger} */ this.nanoseconds = util.normalizeNanosecondsForDuration(nanoseconds) as T + if (typeof this.months === 'number' && isInt(this.nanoseconds) && isInt(this.seconds)) { + this.seconds = this.seconds.toNumber() as T + this.nanoseconds = this.nanoseconds.toNumber() as T + } + if (typeof this.months === 'bigint' && isInt(this.nanoseconds) && isInt(this.seconds)) { + this.seconds = this.seconds.toBigInt() as T + this.nanoseconds = this.nanoseconds.toBigInt() as T + } Object.freeze(this) } diff --git a/packages/neo4j-driver/test/examples.test.js b/packages/neo4j-driver/test/examples.test.js index f1647a7c4..cfec25faf 100644 --- a/packages/neo4j-driver/test/examples.test.js +++ b/packages/neo4j-driver/test/examples.test.js @@ -1101,8 +1101,8 @@ describe('#integration examples', () => { expect(neo4j.isDuration(durationField)).toEqual(true) expect(durationField.months.toInt()).toEqual(duration.months) expect(durationField.days.toInt()).toEqual(duration.days) - expect(durationField.seconds).toEqual(duration.seconds) - expect(durationField.nanoseconds).toEqual(duration.nanoseconds) + expect(durationField.seconds.toInt()).toEqual(duration.seconds) + expect(durationField.nanoseconds.toInt()).toEqual(duration.nanoseconds) } finally { await session.close() } diff --git a/packages/testkit-backend/src/skipped-tests/rx.js b/packages/testkit-backend/src/skipped-tests/rx.js index 558e17f4e..077a5c374 100644 --- a/packages/testkit-backend/src/skipped-tests/rx.js +++ b/packages/testkit-backend/src/skipped-tests/rx.js @@ -1,9 +1,19 @@ -import { skip, ifEquals } from './skip.js' +import { skip, ifEquals, ifStartsWith } from './skip.js' const skippedTests = [ skip( 'Throws after run insted of the first next because of the backend implementation', ifEquals('stub.disconnects.test_disconnects.TestDisconnects.test_disconnect_on_tx_begin') + ), + skip( + 'Reactive driver does not send DISCARD on consume if records stream has been subscribed to', + ifStartsWith('stub.summary.test_summary.TestSummaryPlanDiscard'), + ifStartsWith('stub.summary.test_summary.TestSummaryCountersDiscard'), + ifStartsWith('stub.summary.test_summary.TestSummaryBasicInfoDiscard'), + ifStartsWith('stub.summary.test_summary.TestSummaryGqlStatusObjects4x4Discard'), + ifStartsWith('stub.summary.test_summary.TestSummaryGqlStatusObjects5x6Discard'), + ifStartsWith('stub.summary.test_summary.TestSummaryNotifications4x4Discard'), + ifStartsWith('stub.summary.test_summary.TestSummaryNotifications5x6Discard') ) ]