From f770e5d34b9cc4e12c7c21e0a2013ed5bb5d2056 Mon Sep 17 00:00:00 2001 From: ci <61233757+MaxAake@users.noreply.github.com> Date: Tue, 2 Sep 2025 14:21:11 +0200 Subject: [PATCH 01/13] introduce unknown type --- .../bolt/bolt-protocol-v6x0.transformer.js | 20 ++++++++++++-- .../bolt-connection/src/bolt/transformer.js | 2 +- packages/core/src/index.ts | 5 +++- packages/core/src/unknown-type.ts | 27 +++++++++++++++++++ .../src/cypher-native-binders.js | 7 +++++ .../testkit-backend/src/feature/common.js | 1 + testkit/testkit.json | 2 +- 7 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 packages/core/src/unknown-type.ts diff --git a/packages/bolt-connection/src/bolt/bolt-protocol-v6x0.transformer.js b/packages/bolt-connection/src/bolt/bolt-protocol-v6x0.transformer.js index c9ccd8578..2fcd1a260 100644 --- a/packages/bolt-connection/src/bolt/bolt-protocol-v6x0.transformer.js +++ b/packages/bolt-connection/src/bolt/bolt-protocol-v6x0.transformer.js @@ -18,7 +18,7 @@ import v5x8 from './bolt-protocol-v5x8.transformer' import { TypeTransformer } from './transformer' import { structure } from '../packstream' -import { Vector, newError } from 'neo4j-driver-core' +import { Vector, UnknownType, newError } from 'neo4j-driver-core' const VECTOR = 0x56 const FLOAT_32 = 0xc6 const FLOAT_64 = 0xc1 @@ -26,6 +26,7 @@ const INT_8 = 0xc8 const INT_16 = 0xc9 const INT_32 = 0xca const INT_64 = 0xcb +const UNKNOWN = 0x3F const typeToTypeMarker = { INT8: INT_8, @@ -132,7 +133,22 @@ function checkLittleEndian () { return typeArray[0] === 1000 } +function createUnknownTypeTransformer () { + return new TypeTransformer({ + signature: UNKNOWN, + isTypeInstance: object => object instanceof UnknownType, + toStructure: _ => { + throw newError('Unknown Type object can not be transmitted') + }, + fromStructure: structure => { + console.log(JSON.stringify(structure.fields)) + return new UnknownType(structure.fields[0], structure.fields[1], structure.fields[2].message) + } + }) +} + export default { ...v5x8, - createVectorTransformer + createVectorTransformer, + createUnknownTypeTransformer } diff --git a/packages/bolt-connection/src/bolt/transformer.js b/packages/bolt-connection/src/bolt/transformer.js index ab273bec8..341d4a6d2 100644 --- a/packages/bolt-connection/src/bolt/transformer.js +++ b/packages/bolt-connection/src/bolt/transformer.js @@ -114,7 +114,7 @@ export class TypeTransformer { * @param {isTypeInstanceFunction} [param.isTypeInstance] The function which checks if object is * instance of the type described by the TypeTransformer * @param {toStructureFunction} [param.toStructure] The function which gets the object and converts to structure - * @param {fromStructureFunction} pparam.fromStructure] The function which get the structure and covnverts to object + * @param {fromStructureFunction} [param.fromStructure] The function which get the structure and covnverts to object * @returns {TypeTransformer} A new type transform extends with new methods */ extendsWith ({ signature, fromStructure, toStructure, isTypeInstance }) { diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 83fc1400b..96094c4b6 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -103,6 +103,7 @@ import resultTransformers, { ResultTransformer } from './result-transformers' import ClientCertificate, { clientCertificateProviders, ClientCertificateProvider, ClientCertificateProviders, RotatingClientCertificateProvider, resolveCertificateProvider } from './client-certificate' import * as internal from './internal' // todo: removed afterwards import Vector, { VectorType, vector } from './vector' +import UnknownType from './unknown-type' /** * Object containing string constants representing predefined {@link Neo4jError} codes. @@ -189,7 +190,8 @@ const forExport = { notificationFilterDisabledClassification, notificationFilterMinimumSeverityLevel, clientCertificateProviders, - resolveCertificateProvider + resolveCertificateProvider, + UnknownType } export { @@ -269,6 +271,7 @@ export { clientCertificateProviders, resolveCertificateProvider, Vector, + UnknownType, vector } diff --git a/packages/core/src/unknown-type.ts b/packages/core/src/unknown-type.ts new file mode 100644 index 000000000..e414e720b --- /dev/null +++ b/packages/core/src/unknown-type.ts @@ -0,0 +1,27 @@ +/** + * Copyright (c) "Neo4j" + * Neo4j Sweden AB [https://neo4j.com] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default class UnknownType { + name: string + minBolt: string + message: string | undefined + constructor (name: string, minBolt: string, message: string | undefined) { + this.name = name + this.minBolt = minBolt + this.message = message + } +} diff --git a/packages/testkit-backend/src/cypher-native-binders.js b/packages/testkit-backend/src/cypher-native-binders.js index 22272007b..7281c59c9 100644 --- a/packages/testkit-backend/src/cypher-native-binders.js +++ b/packages/testkit-backend/src/cypher-native-binders.js @@ -183,6 +183,13 @@ export default function CypherNativeBinders (neo4j) { return structResponse('CypherVector', { dtype, data }) } + if (x.minBolt != null) { + const name = x.name + const minBolt = x.minBolt + const message = x.message + return structResponse('CypherUnknownType', { name, min_bolt: minBolt, message }) + } + // If all failed, interpret as a map const map = {} for (const [key, value] of Object.entries(x)) { diff --git a/packages/testkit-backend/src/feature/common.js b/packages/testkit-backend/src/feature/common.js index a619d6531..984af3f21 100644 --- a/packages/testkit-backend/src/feature/common.js +++ b/packages/testkit-backend/src/feature/common.js @@ -44,6 +44,7 @@ const features = [ 'Feature:API:Summary:GqlStatusObjects', 'Feature:API:Liveness.Check', 'Feature:API:Type.Vector', + 'Feature:API:Type.UnknownType', 'Optimization:AuthPipelining', 'Optimization:EagerTransactionBegin', 'Optimization:ExecuteQueryPipelining', diff --git a/testkit/testkit.json b/testkit/testkit.json index 0b9944108..fdc8cf1d9 100644 --- a/testkit/testkit.json +++ b/testkit/testkit.json @@ -1,6 +1,6 @@ { "testkit": { "uri": "https://github.com/neo4j-drivers/testkit.git", - "ref": "6.x" + "ref": "unknown-type-stub-tests" } } From cf09ac6ebeeb1a02d4f9d7a5dafb954b97633e73 Mon Sep 17 00:00:00 2001 From: ci <61233757+MaxAake@users.noreply.github.com> Date: Tue, 2 Sep 2025 14:21:43 +0200 Subject: [PATCH 02/13] deno sync --- .../bolt/bolt-protocol-v6x0.transformer.js | 20 ++++++++++++-- .../lib/bolt-connection/bolt/transformer.js | 2 +- packages/neo4j-driver-deno/lib/core/index.ts | 5 +++- .../lib/core/unknown-type.ts | 27 +++++++++++++++++++ 4 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 packages/neo4j-driver-deno/lib/core/unknown-type.ts diff --git a/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js b/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js index c0e0d16b2..f90cebd0f 100644 --- a/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js +++ b/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js @@ -18,7 +18,7 @@ import v5x8 from './bolt-protocol-v5x8.transformer.js' import { TypeTransformer } from './transformer.js' import { structure } from '../packstream/index.js' -import { Vector, newError } from '../../core/index.ts' +import { Vector, UnknownType, newError } from '../../core/index.ts' const VECTOR = 0x56 const FLOAT_32 = 0xc6 const FLOAT_64 = 0xc1 @@ -26,6 +26,7 @@ const INT_8 = 0xc8 const INT_16 = 0xc9 const INT_32 = 0xca const INT_64 = 0xcb +const UNKNOWN = 0x3F const typeToTypeMarker = { INT8: INT_8, @@ -132,7 +133,22 @@ function checkLittleEndian () { return typeArray[0] === 1000 } +function createUnknownTypeTransformer () { + return new TypeTransformer({ + signature: UNKNOWN, + isTypeInstance: object => object instanceof UnknownType, + toStructure: _ => { + throw newError('Unknown Type object can not be transmitted') + }, + fromStructure: structure => { + console.log(JSON.stringify(structure.fields)) + return new UnknownType(structure.fields[0], structure.fields[1], structure.fields[2].message) + } + }) +} + export default { ...v5x8, - createVectorTransformer + createVectorTransformer, + createUnknownTypeTransformer } diff --git a/packages/neo4j-driver-deno/lib/bolt-connection/bolt/transformer.js b/packages/neo4j-driver-deno/lib/bolt-connection/bolt/transformer.js index 63013e612..8ea27491f 100644 --- a/packages/neo4j-driver-deno/lib/bolt-connection/bolt/transformer.js +++ b/packages/neo4j-driver-deno/lib/bolt-connection/bolt/transformer.js @@ -114,7 +114,7 @@ export class TypeTransformer { * @param {isTypeInstanceFunction} [param.isTypeInstance] The function which checks if object is * instance of the type described by the TypeTransformer * @param {toStructureFunction} [param.toStructure] The function which gets the object and converts to structure - * @param {fromStructureFunction} pparam.fromStructure] The function which get the structure and covnverts to object + * @param {fromStructureFunction} [param.fromStructure] The function which get the structure and covnverts to object * @returns {TypeTransformer} A new type transform extends with new methods */ extendsWith ({ signature, fromStructure, toStructure, isTypeInstance }) { diff --git a/packages/neo4j-driver-deno/lib/core/index.ts b/packages/neo4j-driver-deno/lib/core/index.ts index b22a6600b..a7c78aa37 100644 --- a/packages/neo4j-driver-deno/lib/core/index.ts +++ b/packages/neo4j-driver-deno/lib/core/index.ts @@ -103,6 +103,7 @@ import resultTransformers, { ResultTransformer } from './result-transformers.ts' import ClientCertificate, { clientCertificateProviders, ClientCertificateProvider, ClientCertificateProviders, RotatingClientCertificateProvider, resolveCertificateProvider } from './client-certificate.ts' import * as internal from './internal/index.ts' import Vector, { VectorType, vector } from './vector.ts' +import UnknownType from './unknown-type.ts' /** * Object containing string constants representing predefined {@link Neo4jError} codes. @@ -189,7 +190,8 @@ const forExport = { notificationFilterDisabledClassification, notificationFilterMinimumSeverityLevel, clientCertificateProviders, - resolveCertificateProvider + resolveCertificateProvider, + UnknownType } export { @@ -269,6 +271,7 @@ export { clientCertificateProviders, resolveCertificateProvider, Vector, + UnknownType, vector } diff --git a/packages/neo4j-driver-deno/lib/core/unknown-type.ts b/packages/neo4j-driver-deno/lib/core/unknown-type.ts new file mode 100644 index 000000000..e414e720b --- /dev/null +++ b/packages/neo4j-driver-deno/lib/core/unknown-type.ts @@ -0,0 +1,27 @@ +/** + * Copyright (c) "Neo4j" + * Neo4j Sweden AB [https://neo4j.com] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default class UnknownType { + name: string + minBolt: string + message: string | undefined + constructor (name: string, minBolt: string, message: string | undefined) { + this.name = name + this.minBolt = minBolt + this.message = message + } +} From a14bd5160e82cffc8a41f70b9bfac466666db241 Mon Sep 17 00:00:00 2001 From: ci <61233757+MaxAake@users.noreply.github.com> Date: Mon, 8 Sep 2025 14:53:11 +0200 Subject: [PATCH 03/13] split minBolt into separate integers --- .../src/bolt/bolt-protocol-v6x0.transformer.js | 3 +-- packages/core/src/unknown-type.ts | 8 +++++--- .../bolt/bolt-protocol-v6x0.transformer.js | 2 +- packages/neo4j-driver-deno/lib/core/unknown-type.ts | 8 +++++--- packages/testkit-backend/src/cypher-native-binders.js | 7 ++++--- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/packages/bolt-connection/src/bolt/bolt-protocol-v6x0.transformer.js b/packages/bolt-connection/src/bolt/bolt-protocol-v6x0.transformer.js index 2fcd1a260..573a14114 100644 --- a/packages/bolt-connection/src/bolt/bolt-protocol-v6x0.transformer.js +++ b/packages/bolt-connection/src/bolt/bolt-protocol-v6x0.transformer.js @@ -141,8 +141,7 @@ function createUnknownTypeTransformer () { throw newError('Unknown Type object can not be transmitted') }, fromStructure: structure => { - console.log(JSON.stringify(structure.fields)) - return new UnknownType(structure.fields[0], structure.fields[1], structure.fields[2].message) + return new UnknownType(structure.fields[0], structure.fields[1], structure.fields[2], structure.fields[3].message) } }) } diff --git a/packages/core/src/unknown-type.ts b/packages/core/src/unknown-type.ts index e414e720b..bab834044 100644 --- a/packages/core/src/unknown-type.ts +++ b/packages/core/src/unknown-type.ts @@ -17,11 +17,13 @@ export default class UnknownType { name: string - minBolt: string + minimumBoltMajor: Number + minimumBoltMinor: Number message: string | undefined - constructor (name: string, minBolt: string, message: string | undefined) { + constructor (name: string, minimumBoltMajor: Number, minimumBoltMinor: Number, message: string | undefined) { this.name = name - this.minBolt = minBolt + this.minimumBoltMajor = minimumBoltMajor + this.minimumBoltMinor = minimumBoltMinor this.message = message } } diff --git a/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js b/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js index f90cebd0f..c6884d0df 100644 --- a/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js +++ b/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js @@ -142,7 +142,7 @@ function createUnknownTypeTransformer () { }, fromStructure: structure => { console.log(JSON.stringify(structure.fields)) - return new UnknownType(structure.fields[0], structure.fields[1], structure.fields[2].message) + return new UnknownType(structure.fields[0], structure.fields[1], structure.fields[2], structure.fields[3].message) } }) } diff --git a/packages/neo4j-driver-deno/lib/core/unknown-type.ts b/packages/neo4j-driver-deno/lib/core/unknown-type.ts index e414e720b..b9ba64ce0 100644 --- a/packages/neo4j-driver-deno/lib/core/unknown-type.ts +++ b/packages/neo4j-driver-deno/lib/core/unknown-type.ts @@ -17,11 +17,13 @@ export default class UnknownType { name: string - minBolt: string + minimumBoltMajor: Number + minimumBoltMinor: Number message: string | undefined - constructor (name: string, minBolt: string, message: string | undefined) { + constructor (name: string, minimumBoltMajor: Number, minimumBoltMinor: Number, message: string | undefined) { this.name = name - this.minBolt = minBolt + this.minimumBoltMajor = minimumBoltMajor + this.minimumBoltMinor = minimumBoltMinor this.message = message } } diff --git a/packages/testkit-backend/src/cypher-native-binders.js b/packages/testkit-backend/src/cypher-native-binders.js index 7281c59c9..2431112f7 100644 --- a/packages/testkit-backend/src/cypher-native-binders.js +++ b/packages/testkit-backend/src/cypher-native-binders.js @@ -183,11 +183,12 @@ export default function CypherNativeBinders (neo4j) { return structResponse('CypherVector', { dtype, data }) } - if (x.minBolt != null) { + if (x.minimumBoltMajor != null) { const name = x.name - const minBolt = x.minBolt + const minimumProtocolMajor = x.minimumBoltMajor + const minimumProtocolMinor = x.minimumBoltMinor const message = x.message - return structResponse('CypherUnknownType', { name, min_bolt: minBolt, message }) + return structResponse('CypherUnknownType', { name, minimumProtocolMajor, minimumProtocolMinor, message }) } // If all failed, interpret as a map From d016b3450f311230943510b17a991eac38e34328 Mon Sep 17 00:00:00 2001 From: ci <61233757+MaxAake@users.noreply.github.com> Date: Mon, 8 Sep 2025 15:39:21 +0200 Subject: [PATCH 04/13] deno sync --- .../lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js | 1 - packages/neo4j-driver-deno/lib/core/unknown-type.ts | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js b/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js index c6884d0df..3564ddb0c 100644 --- a/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js +++ b/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js @@ -141,7 +141,6 @@ function createUnknownTypeTransformer () { throw newError('Unknown Type object can not be transmitted') }, fromStructure: structure => { - console.log(JSON.stringify(structure.fields)) return new UnknownType(structure.fields[0], structure.fields[1], structure.fields[2], structure.fields[3].message) } }) diff --git a/packages/neo4j-driver-deno/lib/core/unknown-type.ts b/packages/neo4j-driver-deno/lib/core/unknown-type.ts index b9ba64ce0..bab834044 100644 --- a/packages/neo4j-driver-deno/lib/core/unknown-type.ts +++ b/packages/neo4j-driver-deno/lib/core/unknown-type.ts @@ -20,7 +20,7 @@ export default class UnknownType { minimumBoltMajor: Number minimumBoltMinor: Number message: string | undefined - constructor (name: string, minimumBoltMajor: Number, minimumBoltMinor: Number, message: string | undefined) { + constructor (name: string, minimumBoltMajor: Number, minimumBoltMinor: Number, message: string | undefined) { this.name = name this.minimumBoltMajor = minimumBoltMajor this.minimumBoltMinor = minimumBoltMinor From d3feac185c978e3b80034f70e875cce962e5c88f Mon Sep 17 00:00:00 2001 From: ci <61233757+MaxAake@users.noreply.github.com> Date: Thu, 11 Sep 2025 15:47:02 +0200 Subject: [PATCH 05/13] document UnknownType --- packages/core/src/unknown-type.ts | 48 +++++++++++++++++-- .../src/cypher-native-binders.js | 6 +-- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/packages/core/src/unknown-type.ts b/packages/core/src/unknown-type.ts index bab834044..cc6ca0d09 100644 --- a/packages/core/src/unknown-type.ts +++ b/packages/core/src/unknown-type.ts @@ -15,15 +15,53 @@ * limitations under the License. */ +/** + * A representation of a value that could not be transmitted over the wire due to an outdated protocol version. + * @access public + * @exports UnknownType + */ export default class UnknownType { name: string - minimumBoltMajor: Number - minimumBoltMinor: Number + _minimumProtocolMajor: number + _minimumProtocolMinor: number message: string | undefined - constructor (name: string, minimumBoltMajor: Number, minimumBoltMinor: Number, message: string | undefined) { + constructor (name: string, minimumProtocolMajor: number, minimumProtocolMinor: number, message: string | undefined) { + /** + * The name of the type that could not be transmitted. + * + * @type {string} + */ this.name = name - this.minimumBoltMajor = minimumBoltMajor - this.minimumBoltMinor = minimumBoltMinor + /** + * The major version of the protocol needed to transmit the value. + * + * @type {number} + * @access private + */ + this._minimumProtocolMajor = minimumProtocolMajor + /** + * The minor version of the protocol needed to transmit the value. + * + * @type {number} + * @access private + */ + this._minimumProtocolMinor = minimumProtocolMinor + /** + * An optional message, including additional information regarding the untransmittable value. + * + * @type {string | undefined} + */ this.message = message } + + /** + * @returns {string} The minimum version of the protocol needed to transmit this value. + */ + minimumProtocolVersion (): string { + return `${this._minimumProtocolMajor}.${this._minimumProtocolMinor}` + } + + toString (): string { + return `UnknownType<${this.name}>` + } } diff --git a/packages/testkit-backend/src/cypher-native-binders.js b/packages/testkit-backend/src/cypher-native-binders.js index 2431112f7..ad302edd9 100644 --- a/packages/testkit-backend/src/cypher-native-binders.js +++ b/packages/testkit-backend/src/cypher-native-binders.js @@ -183,10 +183,10 @@ export default function CypherNativeBinders (neo4j) { return structResponse('CypherVector', { dtype, data }) } - if (x.minimumBoltMajor != null) { + if (x._minimumProtocolMajor != null) { const name = x.name - const minimumProtocolMajor = x.minimumBoltMajor - const minimumProtocolMinor = x.minimumBoltMinor + const minimumProtocolMajor = x._minimumProtocolMajor + const minimumProtocolMinor = x._minimumProtocolMinor const message = x.message return structResponse('CypherUnknownType', { name, minimumProtocolMajor, minimumProtocolMinor, message }) } From c20959143816d72ee2d9d8550931a60fee240d54 Mon Sep 17 00:00:00 2001 From: ci <61233757+MaxAake@users.noreply.github.com> Date: Fri, 12 Sep 2025 12:14:51 +0200 Subject: [PATCH 06/13] deno sync --- .../lib/core/unknown-type.ts | 48 +++++++++++++++++-- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/packages/neo4j-driver-deno/lib/core/unknown-type.ts b/packages/neo4j-driver-deno/lib/core/unknown-type.ts index bab834044..cc6ca0d09 100644 --- a/packages/neo4j-driver-deno/lib/core/unknown-type.ts +++ b/packages/neo4j-driver-deno/lib/core/unknown-type.ts @@ -15,15 +15,53 @@ * limitations under the License. */ +/** + * A representation of a value that could not be transmitted over the wire due to an outdated protocol version. + * @access public + * @exports UnknownType + */ export default class UnknownType { name: string - minimumBoltMajor: Number - minimumBoltMinor: Number + _minimumProtocolMajor: number + _minimumProtocolMinor: number message: string | undefined - constructor (name: string, minimumBoltMajor: Number, minimumBoltMinor: Number, message: string | undefined) { + constructor (name: string, minimumProtocolMajor: number, minimumProtocolMinor: number, message: string | undefined) { + /** + * The name of the type that could not be transmitted. + * + * @type {string} + */ this.name = name - this.minimumBoltMajor = minimumBoltMajor - this.minimumBoltMinor = minimumBoltMinor + /** + * The major version of the protocol needed to transmit the value. + * + * @type {number} + * @access private + */ + this._minimumProtocolMajor = minimumProtocolMajor + /** + * The minor version of the protocol needed to transmit the value. + * + * @type {number} + * @access private + */ + this._minimumProtocolMinor = minimumProtocolMinor + /** + * An optional message, including additional information regarding the untransmittable value. + * + * @type {string | undefined} + */ this.message = message } + + /** + * @returns {string} The minimum version of the protocol needed to transmit this value. + */ + minimumProtocolVersion (): string { + return `${this._minimumProtocolMajor}.${this._minimumProtocolMinor}` + } + + toString (): string { + return `UnknownType<${this.name}>` + } } From 943dfee27cb2bfa482e1da49d56a55fd87063bb5 Mon Sep 17 00:00:00 2001 From: ci <61233757+MaxAake@users.noreply.github.com> Date: Fri, 12 Sep 2025 12:57:29 +0200 Subject: [PATCH 07/13] Unknown Type Creation tests --- packages/core/test/unknown-type.test.ts | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 packages/core/test/unknown-type.test.ts diff --git a/packages/core/test/unknown-type.test.ts b/packages/core/test/unknown-type.test.ts new file mode 100644 index 000000000..36f3598c3 --- /dev/null +++ b/packages/core/test/unknown-type.test.ts @@ -0,0 +1,30 @@ +/** + * Copyright (c) "Neo4j" + * Neo4j Sweden AB [https://neo4j.com] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { UnknownType } from '../src' + +describe('UnknownTppe', () => { + it.each([ + ['with message', ['QuantumInteger', 76, 87, 'Quantum computing is from the future.'], '76.87', 'UnknownType'], + ['without message', ['CuniformInteger', 1, 1], '1.1', 'UnknownType'] + ])('should create UnknownType (%s)', (_, parameters: [string, number, number, string], protocolString, representation) => { + const unknownType = new UnknownType(...parameters) + expect(unknownType.minimumProtocolVersion()).toBe(protocolString) + expect(unknownType.toString()).toBe(representation) + expect(unknownType.message).toBe(parameters[3]) + }) +}) From c9d311b708672deb2a8d8ec3159a9290d09c63db Mon Sep 17 00:00:00 2001 From: ci <61233757+MaxAake@users.noreply.github.com> Date: Mon, 15 Sep 2025 09:59:38 +0200 Subject: [PATCH 08/13] isUnknownType function --- .../bolt/bolt-protocol-v6x0.transformer.js | 4 ++-- packages/core/src/index.ts | 6 ++++-- packages/core/src/unknown-type.ts | 19 +++++++++++++++++++ .../bolt/bolt-protocol-v6x0.transformer.js | 4 ++-- packages/neo4j-driver-deno/lib/core/index.ts | 6 ++++-- .../lib/core/unknown-type.ts | 19 +++++++++++++++++++ packages/neo4j-driver/src/index.js | 2 ++ packages/neo4j-driver/types/index.d.ts | 3 +++ .../src/cypher-native-binders.js | 2 +- 9 files changed, 56 insertions(+), 9 deletions(-) diff --git a/packages/bolt-connection/src/bolt/bolt-protocol-v6x0.transformer.js b/packages/bolt-connection/src/bolt/bolt-protocol-v6x0.transformer.js index 573a14114..bc7920fc1 100644 --- a/packages/bolt-connection/src/bolt/bolt-protocol-v6x0.transformer.js +++ b/packages/bolt-connection/src/bolt/bolt-protocol-v6x0.transformer.js @@ -18,7 +18,7 @@ import v5x8 from './bolt-protocol-v5x8.transformer' import { TypeTransformer } from './transformer' import { structure } from '../packstream' -import { Vector, UnknownType, newError } from 'neo4j-driver-core' +import { Vector, UnknownType, newError, isUnknownType } from 'neo4j-driver-core' const VECTOR = 0x56 const FLOAT_32 = 0xc6 const FLOAT_64 = 0xc1 @@ -40,7 +40,7 @@ const typeToTypeMarker = { function createVectorTransformer () { return new TypeTransformer({ signature: VECTOR, - isTypeInstance: object => object instanceof Vector, + isTypeInstance: object => isUnknownType(object), toStructure: vector => { const typeMarker = typeToTypeMarker[vector.getType()] if (typeMarker === undefined) { diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 96094c4b6..dbcb5ac34 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -103,7 +103,7 @@ import resultTransformers, { ResultTransformer } from './result-transformers' import ClientCertificate, { clientCertificateProviders, ClientCertificateProvider, ClientCertificateProviders, RotatingClientCertificateProvider, resolveCertificateProvider } from './client-certificate' import * as internal from './internal' // todo: removed afterwards import Vector, { VectorType, vector } from './vector' -import UnknownType from './unknown-type' +import UnknownType, { isUnknownType } from './unknown-type' /** * Object containing string constants representing predefined {@link Neo4jError} codes. @@ -191,7 +191,8 @@ const forExport = { notificationFilterMinimumSeverityLevel, clientCertificateProviders, resolveCertificateProvider, - UnknownType + UnknownType, + isUnknownType } export { @@ -272,6 +273,7 @@ export { resolveCertificateProvider, Vector, UnknownType, + isUnknownType, vector } diff --git a/packages/core/src/unknown-type.ts b/packages/core/src/unknown-type.ts index cc6ca0d09..dc8a63bab 100644 --- a/packages/core/src/unknown-type.ts +++ b/packages/core/src/unknown-type.ts @@ -15,6 +15,8 @@ * limitations under the License. */ +const UNKNOWN_TYPE_IDENTIFIER_PROPERTY = '__isType__' + /** * A representation of a value that could not be transmitted over the wire due to an outdated protocol version. * @access public @@ -65,3 +67,20 @@ export default class UnknownType { return `UnknownType<${this.name}>` } } + +Object.defineProperty(UnknownType.prototype, UNKNOWN_TYPE_IDENTIFIER_PROPERTY, { + value: true, + enumerable: false, + configurable: false, + writable: false +}) + +/** + * Test if given object is an instance of {@link Point} class. + * @param {Object} obj the object to test. + * @return {boolean} `true` if given object is a {@link Point}, `false` otherwise. + */ +export function isUnknownType (obj: unknown): obj is UnknownType { + const anyObj: any | null | undefined = obj + return obj != null && anyObj[UNKNOWN_TYPE_IDENTIFIER_PROPERTY] === true +} diff --git a/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js b/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js index 3564ddb0c..3500b6fc5 100644 --- a/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js +++ b/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js @@ -18,7 +18,7 @@ import v5x8 from './bolt-protocol-v5x8.transformer.js' import { TypeTransformer } from './transformer.js' import { structure } from '../packstream/index.js' -import { Vector, UnknownType, newError } from '../../core/index.ts' +import { Vector, UnknownType, newError, isUnknownType } from '../../core/index.ts' const VECTOR = 0x56 const FLOAT_32 = 0xc6 const FLOAT_64 = 0xc1 @@ -40,7 +40,7 @@ const typeToTypeMarker = { function createVectorTransformer () { return new TypeTransformer({ signature: VECTOR, - isTypeInstance: object => object instanceof Vector, + isTypeInstance: object => isUnknownType(object), toStructure: vector => { const typeMarker = typeToTypeMarker[vector.getType()] if (typeMarker === undefined) { diff --git a/packages/neo4j-driver-deno/lib/core/index.ts b/packages/neo4j-driver-deno/lib/core/index.ts index a7c78aa37..beb18d14e 100644 --- a/packages/neo4j-driver-deno/lib/core/index.ts +++ b/packages/neo4j-driver-deno/lib/core/index.ts @@ -103,7 +103,7 @@ import resultTransformers, { ResultTransformer } from './result-transformers.ts' import ClientCertificate, { clientCertificateProviders, ClientCertificateProvider, ClientCertificateProviders, RotatingClientCertificateProvider, resolveCertificateProvider } from './client-certificate.ts' import * as internal from './internal/index.ts' import Vector, { VectorType, vector } from './vector.ts' -import UnknownType from './unknown-type.ts' +import UnknownType, {isUnknownType} from './unknown-type.ts' /** * Object containing string constants representing predefined {@link Neo4jError} codes. @@ -191,7 +191,8 @@ const forExport = { notificationFilterMinimumSeverityLevel, clientCertificateProviders, resolveCertificateProvider, - UnknownType + UnknownType, + isUnknownType } export { @@ -272,6 +273,7 @@ export { resolveCertificateProvider, Vector, UnknownType, + isUnknownType, vector } diff --git a/packages/neo4j-driver-deno/lib/core/unknown-type.ts b/packages/neo4j-driver-deno/lib/core/unknown-type.ts index cc6ca0d09..41718652c 100644 --- a/packages/neo4j-driver-deno/lib/core/unknown-type.ts +++ b/packages/neo4j-driver-deno/lib/core/unknown-type.ts @@ -15,6 +15,8 @@ * limitations under the License. */ +const UNKNOWN_TYPE_IDENTIFIER_PROPERTY = '__isType__' + /** * A representation of a value that could not be transmitted over the wire due to an outdated protocol version. * @access public @@ -65,3 +67,20 @@ export default class UnknownType { return `UnknownType<${this.name}>` } } + +Object.defineProperty(UnknownType.prototype, UNKNOWN_TYPE_IDENTIFIER_PROPERTY, { + value: true, + enumerable: false, + configurable: false, + writable: false +}) + +/** + * Test if given object is an instance of {@link Point} class. + * @param {Object} obj the object to test. + * @return {boolean} `true` if given object is a {@link Point}, `false` otherwise. + */ +export function isUnknownType(obj: unknown): obj is UnknownType { + const anyObj: any | null | undefined = obj + return obj != null && anyObj[UNKNOWN_TYPE_IDENTIFIER_PROPERTY] === true +} diff --git a/packages/neo4j-driver/src/index.js b/packages/neo4j-driver/src/index.js index bd767a000..11bf7ce60 100644 --- a/packages/neo4j-driver/src/index.js +++ b/packages/neo4j-driver/src/index.js @@ -46,6 +46,7 @@ import { isRelationship, isTime, isUnboundRelationship, + isUnknownType, LocalDateTime, LocalTime, Time, @@ -431,6 +432,7 @@ export { isPathSegment, isRelationship, isUnboundRelationship, + isUnknownType, integer, Neo4jError, isRetriableError, diff --git a/packages/neo4j-driver/types/index.d.ts b/packages/neo4j-driver/types/index.d.ts index d41bf5783..d8f2bb20e 100644 --- a/packages/neo4j-driver/types/index.d.ts +++ b/packages/neo4j-driver/types/index.d.ts @@ -44,6 +44,7 @@ import { isPathSegment, isRelationship, isUnboundRelationship, + isUnknownType, LocalDateTime, LocalTime, Time, @@ -289,6 +290,7 @@ declare const forExport: { isPathSegment: typeof isPathSegment isRelationship: typeof isRelationship isUnboundRelationship: typeof isUnboundRelationship + isUnknownType: typeof isUnknownType bookmarkManager: typeof bookmarkManager resultTransformers: typeof resultTransformers notificationCategory: typeof notificationCategory @@ -370,6 +372,7 @@ export { isPathSegment, isRelationship, isUnboundRelationship, + isUnknownType, bookmarkManager, resultTransformers, notificationCategory, diff --git a/packages/testkit-backend/src/cypher-native-binders.js b/packages/testkit-backend/src/cypher-native-binders.js index ad302edd9..aad9f1f39 100644 --- a/packages/testkit-backend/src/cypher-native-binders.js +++ b/packages/testkit-backend/src/cypher-native-binders.js @@ -183,7 +183,7 @@ export default function CypherNativeBinders (neo4j) { return structResponse('CypherVector', { dtype, data }) } - if (x._minimumProtocolMajor != null) { + if (neo4j.isUnknownType(x) != null) { const name = x.name const minimumProtocolMajor = x._minimumProtocolMajor const minimumProtocolMinor = x._minimumProtocolMinor From 4907cc7971ea34ebc479ad2fed9a9c12aeed2ad8 Mon Sep 17 00:00:00 2001 From: ci <61233757+MaxAake@users.noreply.github.com> Date: Mon, 15 Sep 2025 10:30:25 +0200 Subject: [PATCH 09/13] fix error --- .../src/bolt/bolt-protocol-v6x0.transformer.js | 6 +++--- .../bolt-connection/bolt/bolt-protocol-v6x0.transformer.js | 6 +++--- packages/neo4j-driver-deno/lib/core/index.ts | 2 +- packages/neo4j-driver-deno/lib/core/unknown-type.ts | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/bolt-connection/src/bolt/bolt-protocol-v6x0.transformer.js b/packages/bolt-connection/src/bolt/bolt-protocol-v6x0.transformer.js index bc7920fc1..03615d5cc 100644 --- a/packages/bolt-connection/src/bolt/bolt-protocol-v6x0.transformer.js +++ b/packages/bolt-connection/src/bolt/bolt-protocol-v6x0.transformer.js @@ -18,7 +18,7 @@ import v5x8 from './bolt-protocol-v5x8.transformer' import { TypeTransformer } from './transformer' import { structure } from '../packstream' -import { Vector, UnknownType, newError, isUnknownType } from 'neo4j-driver-core' +import { Vector, UnknownType, isUnknownType, newError } from 'neo4j-driver-core' const VECTOR = 0x56 const FLOAT_32 = 0xc6 const FLOAT_64 = 0xc1 @@ -40,7 +40,7 @@ const typeToTypeMarker = { function createVectorTransformer () { return new TypeTransformer({ signature: VECTOR, - isTypeInstance: object => isUnknownType(object), + isTypeInstance: object => object instanceof Vector, toStructure: vector => { const typeMarker = typeToTypeMarker[vector.getType()] if (typeMarker === undefined) { @@ -136,7 +136,7 @@ function checkLittleEndian () { function createUnknownTypeTransformer () { return new TypeTransformer({ signature: UNKNOWN, - isTypeInstance: object => object instanceof UnknownType, + isTypeInstance: object => isUnknownType(object), toStructure: _ => { throw newError('Unknown Type object can not be transmitted') }, diff --git a/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js b/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js index 3500b6fc5..350df5c18 100644 --- a/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js +++ b/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js @@ -18,7 +18,7 @@ import v5x8 from './bolt-protocol-v5x8.transformer.js' import { TypeTransformer } from './transformer.js' import { structure } from '../packstream/index.js' -import { Vector, UnknownType, newError, isUnknownType } from '../../core/index.ts' +import { Vector, UnknownType, isUnknownType, newError } from '../../core/index.ts' const VECTOR = 0x56 const FLOAT_32 = 0xc6 const FLOAT_64 = 0xc1 @@ -40,7 +40,7 @@ const typeToTypeMarker = { function createVectorTransformer () { return new TypeTransformer({ signature: VECTOR, - isTypeInstance: object => isUnknownType(object), + isTypeInstance: object => object instanceof Vector, toStructure: vector => { const typeMarker = typeToTypeMarker[vector.getType()] if (typeMarker === undefined) { @@ -136,7 +136,7 @@ function checkLittleEndian () { function createUnknownTypeTransformer () { return new TypeTransformer({ signature: UNKNOWN, - isTypeInstance: object => object instanceof UnknownType, + isTypeInstance: object => isUnknownType(object), toStructure: _ => { throw newError('Unknown Type object can not be transmitted') }, diff --git a/packages/neo4j-driver-deno/lib/core/index.ts b/packages/neo4j-driver-deno/lib/core/index.ts index beb18d14e..1c95f7e51 100644 --- a/packages/neo4j-driver-deno/lib/core/index.ts +++ b/packages/neo4j-driver-deno/lib/core/index.ts @@ -103,7 +103,7 @@ import resultTransformers, { ResultTransformer } from './result-transformers.ts' import ClientCertificate, { clientCertificateProviders, ClientCertificateProvider, ClientCertificateProviders, RotatingClientCertificateProvider, resolveCertificateProvider } from './client-certificate.ts' import * as internal from './internal/index.ts' import Vector, { VectorType, vector } from './vector.ts' -import UnknownType, {isUnknownType} from './unknown-type.ts' +import UnknownType, { isUnknownType } from './unknown-type.ts' /** * Object containing string constants representing predefined {@link Neo4jError} codes. diff --git a/packages/neo4j-driver-deno/lib/core/unknown-type.ts b/packages/neo4j-driver-deno/lib/core/unknown-type.ts index 41718652c..dc8a63bab 100644 --- a/packages/neo4j-driver-deno/lib/core/unknown-type.ts +++ b/packages/neo4j-driver-deno/lib/core/unknown-type.ts @@ -80,7 +80,7 @@ Object.defineProperty(UnknownType.prototype, UNKNOWN_TYPE_IDENTIFIER_PROPERTY, { * @param {Object} obj the object to test. * @return {boolean} `true` if given object is a {@link Point}, `false` otherwise. */ -export function isUnknownType(obj: unknown): obj is UnknownType { +export function isUnknownType (obj: unknown): obj is UnknownType { const anyObj: any | null | undefined = obj return obj != null && anyObj[UNKNOWN_TYPE_IDENTIFIER_PROPERTY] === true } From 8763510ef1ff3134a3c6df5a9cbb6b4f51d51012 Mon Sep 17 00:00:00 2001 From: ci <61233757+MaxAake@users.noreply.github.com> Date: Mon, 15 Sep 2025 10:38:37 +0200 Subject: [PATCH 10/13] fix testkit backend --- packages/testkit-backend/src/cypher-native-binders.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/testkit-backend/src/cypher-native-binders.js b/packages/testkit-backend/src/cypher-native-binders.js index aad9f1f39..8917f5057 100644 --- a/packages/testkit-backend/src/cypher-native-binders.js +++ b/packages/testkit-backend/src/cypher-native-binders.js @@ -183,7 +183,7 @@ export default function CypherNativeBinders (neo4j) { return structResponse('CypherVector', { dtype, data }) } - if (neo4j.isUnknownType(x) != null) { + if (neo4j.isUnknownType(x)) { const name = x.name const minimumProtocolMajor = x._minimumProtocolMajor const minimumProtocolMinor = x._minimumProtocolMinor From 3650568023032fce5edc904f4bfa8510bf65ec80 Mon Sep 17 00:00:00 2001 From: ci <61233757+MaxAake@users.noreply.github.com> Date: Mon, 15 Sep 2025 10:58:34 +0200 Subject: [PATCH 11/13] fix exports --- packages/neo4j-driver-deno/lib/mod.ts | 3 +++ packages/neo4j-driver-lite/src/index.ts | 3 +++ packages/neo4j-driver/src/index.js | 1 + 3 files changed, 7 insertions(+) diff --git a/packages/neo4j-driver-deno/lib/mod.ts b/packages/neo4j-driver-deno/lib/mod.ts index 0ef597e35..66e9a2b22 100644 --- a/packages/neo4j-driver-deno/lib/mod.ts +++ b/packages/neo4j-driver-deno/lib/mod.ts @@ -52,6 +52,7 @@ import { isRetryableError, isTime, isUnboundRelationship, + isUnknownType, LocalDateTime, LocalTime, ManagedTransaction, @@ -396,6 +397,7 @@ const forExport = { isPathSegment, isRelationship, isUnboundRelationship, + isUnknownType, integer, Neo4jError, isRetriableError, @@ -470,6 +472,7 @@ export { isPathSegment, isRelationship, isUnboundRelationship, + isUnknownType, integer, Neo4jError, isRetriableError, diff --git a/packages/neo4j-driver-lite/src/index.ts b/packages/neo4j-driver-lite/src/index.ts index cc78c3140..de1ede81d 100644 --- a/packages/neo4j-driver-lite/src/index.ts +++ b/packages/neo4j-driver-lite/src/index.ts @@ -52,6 +52,7 @@ import { isRetryableError, isTime, isUnboundRelationship, + isUnknownType, LocalDateTime, LocalTime, ManagedTransaction, @@ -395,6 +396,7 @@ const forExport = { isPathSegment, isRelationship, isUnboundRelationship, + isUnknownType, integer, Neo4jError, isRetriableError, @@ -469,6 +471,7 @@ export { isPathSegment, isRelationship, isUnboundRelationship, + isUnknownType, integer, Neo4jError, isRetriableError, diff --git a/packages/neo4j-driver/src/index.js b/packages/neo4j-driver/src/index.js index 11bf7ce60..d7dcc0ef7 100644 --- a/packages/neo4j-driver/src/index.js +++ b/packages/neo4j-driver/src/index.js @@ -360,6 +360,7 @@ const forExport = { isPathSegment, isRelationship, isUnboundRelationship, + isUnknownType, integer, Neo4jError, isRetriableError, From 09f04c7739baaf5df494c99e96d515648a9d1f03 Mon Sep 17 00:00:00 2001 From: ci <61233757+MaxAake@users.noreply.github.com> Date: Thu, 18 Sep 2025 14:08:53 +0200 Subject: [PATCH 12/13] unknown -> unsupported --- .../bolt/bolt-protocol-v6x0.transformer.js | 16 ++-- packages/core/src/index.ts | 10 +- .../{unknown-type.ts => unsupported-type.ts} | 14 +-- ...-type.test.ts => unsupported-type.test.ts} | 18 ++-- packages/neo4j-driver-deno/deno.lock | 92 +++++++++++++++++++ .../bolt/bolt-protocol-v6x0.transformer.js | 16 ++-- packages/neo4j-driver-deno/lib/core/index.ts | 10 +- .../{unknown-type.ts => unsupported-type.ts} | 14 +-- packages/neo4j-driver-deno/lib/mod.ts | 6 +- packages/neo4j-driver-lite/src/index.ts | 6 +- packages/neo4j-driver/src/index.js | 6 +- packages/neo4j-driver/types/index.d.ts | 6 +- .../src/cypher-native-binders.js | 4 +- .../testkit-backend/src/feature/common.js | 2 +- 14 files changed, 156 insertions(+), 64 deletions(-) rename packages/core/src/{unknown-type.ts => unsupported-type.ts} (84%) rename packages/core/test/{unknown-type.test.ts => unsupported-type.test.ts} (53%) create mode 100644 packages/neo4j-driver-deno/deno.lock rename packages/neo4j-driver-deno/lib/core/{unknown-type.ts => unsupported-type.ts} (84%) diff --git a/packages/bolt-connection/src/bolt/bolt-protocol-v6x0.transformer.js b/packages/bolt-connection/src/bolt/bolt-protocol-v6x0.transformer.js index 03615d5cc..7f2c7a588 100644 --- a/packages/bolt-connection/src/bolt/bolt-protocol-v6x0.transformer.js +++ b/packages/bolt-connection/src/bolt/bolt-protocol-v6x0.transformer.js @@ -18,7 +18,7 @@ import v5x8 from './bolt-protocol-v5x8.transformer' import { TypeTransformer } from './transformer' import { structure } from '../packstream' -import { Vector, UnknownType, isUnknownType, newError } from 'neo4j-driver-core' +import { Vector, UnsupportedType, isUnsupportedType, newError } from 'neo4j-driver-core' const VECTOR = 0x56 const FLOAT_32 = 0xc6 const FLOAT_64 = 0xc1 @@ -26,7 +26,7 @@ const INT_8 = 0xc8 const INT_16 = 0xc9 const INT_32 = 0xca const INT_64 = 0xcb -const UNKNOWN = 0x3F +const UNSUPPORTED = 0x3F const typeToTypeMarker = { INT8: INT_8, @@ -133,15 +133,15 @@ function checkLittleEndian () { return typeArray[0] === 1000 } -function createUnknownTypeTransformer () { +function createUnsupportedTypeTransformer () { return new TypeTransformer({ - signature: UNKNOWN, - isTypeInstance: object => isUnknownType(object), + signature: UNSUPPORTED, + isTypeInstance: object => isUnsupportedType(object), toStructure: _ => { - throw newError('Unknown Type object can not be transmitted') + throw newError('Unsupported Type object can not be transmitted') }, fromStructure: structure => { - return new UnknownType(structure.fields[0], structure.fields[1], structure.fields[2], structure.fields[3].message) + return new UnsupportedType(structure.fields[0], structure.fields[1], structure.fields[2], structure.fields[3].message) } }) } @@ -149,5 +149,5 @@ function createUnknownTypeTransformer () { export default { ...v5x8, createVectorTransformer, - createUnknownTypeTransformer + createUnsupportedTypeTransformer } diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index dbcb5ac34..357b946c2 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -103,7 +103,7 @@ import resultTransformers, { ResultTransformer } from './result-transformers' import ClientCertificate, { clientCertificateProviders, ClientCertificateProvider, ClientCertificateProviders, RotatingClientCertificateProvider, resolveCertificateProvider } from './client-certificate' import * as internal from './internal' // todo: removed afterwards import Vector, { VectorType, vector } from './vector' -import UnknownType, { isUnknownType } from './unknown-type' +import UnsupportedType, { isUnsupportedType } from './unsupported-type' /** * Object containing string constants representing predefined {@link Neo4jError} codes. @@ -191,8 +191,8 @@ const forExport = { notificationFilterMinimumSeverityLevel, clientCertificateProviders, resolveCertificateProvider, - UnknownType, - isUnknownType + UnsupportedType, + isUnsupportedType } export { @@ -272,8 +272,8 @@ export { clientCertificateProviders, resolveCertificateProvider, Vector, - UnknownType, - isUnknownType, + UnsupportedType, + isUnsupportedType, vector } diff --git a/packages/core/src/unknown-type.ts b/packages/core/src/unsupported-type.ts similarity index 84% rename from packages/core/src/unknown-type.ts rename to packages/core/src/unsupported-type.ts index dc8a63bab..9cb077ffd 100644 --- a/packages/core/src/unknown-type.ts +++ b/packages/core/src/unsupported-type.ts @@ -15,14 +15,14 @@ * limitations under the License. */ -const UNKNOWN_TYPE_IDENTIFIER_PROPERTY = '__isType__' +const UNSUPPORTED_TYPE_IDENTIFIER_PROPERTY = '__isType__' /** * A representation of a value that could not be transmitted over the wire due to an outdated protocol version. * @access public - * @exports UnknownType + * @exports UnsupportedType */ -export default class UnknownType { +export default class UnsupportedType { name: string _minimumProtocolMajor: number _minimumProtocolMinor: number @@ -64,11 +64,11 @@ export default class UnknownType { } toString (): string { - return `UnknownType<${this.name}>` + return `UnsupportedType<${this.name}>` } } -Object.defineProperty(UnknownType.prototype, UNKNOWN_TYPE_IDENTIFIER_PROPERTY, { +Object.defineProperty(UnsupportedType.prototype, UNSUPPORTED_TYPE_IDENTIFIER_PROPERTY, { value: true, enumerable: false, configurable: false, @@ -80,7 +80,7 @@ Object.defineProperty(UnknownType.prototype, UNKNOWN_TYPE_IDENTIFIER_PROPERTY, { * @param {Object} obj the object to test. * @return {boolean} `true` if given object is a {@link Point}, `false` otherwise. */ -export function isUnknownType (obj: unknown): obj is UnknownType { +export function isUnsupportedType (obj: unknown): obj is UnsupportedType { const anyObj: any | null | undefined = obj - return obj != null && anyObj[UNKNOWN_TYPE_IDENTIFIER_PROPERTY] === true + return obj != null && anyObj[UNSUPPORTED_TYPE_IDENTIFIER_PROPERTY] === true } diff --git a/packages/core/test/unknown-type.test.ts b/packages/core/test/unsupported-type.test.ts similarity index 53% rename from packages/core/test/unknown-type.test.ts rename to packages/core/test/unsupported-type.test.ts index 36f3598c3..354cb4072 100644 --- a/packages/core/test/unknown-type.test.ts +++ b/packages/core/test/unsupported-type.test.ts @@ -15,16 +15,16 @@ * limitations under the License. */ -import { UnknownType } from '../src' +import { UnsupportedType } from '../src' -describe('UnknownTppe', () => { +describe('UnsupportedType', () => { it.each([ - ['with message', ['QuantumInteger', 76, 87, 'Quantum computing is from the future.'], '76.87', 'UnknownType'], - ['without message', ['CuniformInteger', 1, 1], '1.1', 'UnknownType'] - ])('should create UnknownType (%s)', (_, parameters: [string, number, number, string], protocolString, representation) => { - const unknownType = new UnknownType(...parameters) - expect(unknownType.minimumProtocolVersion()).toBe(protocolString) - expect(unknownType.toString()).toBe(representation) - expect(unknownType.message).toBe(parameters[3]) + ['with message', ['QuantumInteger', 76, 87, 'Quantum computing is from the future.'], '76.87', 'UnsupportedType'], + ['without message', ['CuniformInteger', 1, 1], '1.1', 'UnsupportedType'] + ])('should create UnsupportedType (%s)', (_, parameters: [string, number, number, string], protocolString, representation) => { + const unsupportedType = new UnsupportedType(...parameters) + expect(unsupportedType.minimumProtocolVersion()).toBe(protocolString) + expect(unsupportedType.toString()).toBe(representation) + expect(unsupportedType.message).toBe(parameters[3]) }) }) diff --git a/packages/neo4j-driver-deno/deno.lock b/packages/neo4j-driver-deno/deno.lock new file mode 100644 index 000000000..c4c3cf6e9 --- /dev/null +++ b/packages/neo4j-driver-deno/deno.lock @@ -0,0 +1,92 @@ +{ + "version": "4", + "remote": { + "https://deno.land/std@0.119.0/_util/assert.ts": "2f868145a042a11d5ad0a3c748dcf580add8a0dbc0e876eaa0026303a5488f58", + "https://deno.land/std@0.119.0/_util/os.ts": "dfb186cc4e968c770ab6cc3288bd65f4871be03b93beecae57d657232ecffcac", + "https://deno.land/std@0.119.0/async/deadline.ts": "1d6ac7aeaee22f75eb86e4e105d6161118aad7b41ae2dd14f4cfd3bf97472b93", + "https://deno.land/std@0.119.0/async/debounce.ts": "b2f693e4baa16b62793fd618de6c003b63228db50ecfe3bd51fc5f6dc0bc264b", + "https://deno.land/std@0.119.0/async/deferred.ts": "ab60d46ba561abb3b13c0c8085d05797a384b9f182935f051dc67136817acdee", + "https://deno.land/std@0.119.0/async/delay.ts": "f2d8ccaa8ebc26594bd8b0989edfd8a96257a714c1dee2fb54d986e5bdd840ac", + "https://deno.land/std@0.119.0/async/mod.ts": "78425176fabea7bd1046ce3819fd69ce40da85c83e0f174d17e8e224a91f7d10", + "https://deno.land/std@0.119.0/async/mux_async_iterator.ts": "62abff3af9ff619e8f2adc96fc70d4ca020fa48a50c23c13f12d02ed2b760dbe", + "https://deno.land/std@0.119.0/async/pool.ts": "353ce4f91865da203a097aa6f33de8966340c91b6f4a055611c8c5d534afd12f", + "https://deno.land/std@0.119.0/async/tee.ts": "3e9f2ef6b36e55188de16a667c702ace4ad0cf84e3720379160e062bf27348ad", + "https://deno.land/std@0.119.0/bytes/bytes_list.ts": "3bff6a09c72b2e0b1e92e29bd3b135053894196cca07a2bba842901073efe5cb", + "https://deno.land/std@0.119.0/bytes/equals.ts": "69f55fdbd45c71f920c1a621e6c0865dc780cd8ae34e0f5e55a9497b70c31c1b", + "https://deno.land/std@0.119.0/bytes/mod.ts": "fedb80b8da2e7ad8dd251148e65f92a04c73d6c5a430b7d197dc39588c8dda6f", + "https://deno.land/std@0.119.0/encoding/base64.ts": "0b58bd6477214838bf711eef43eac21e47ba9e5c81b2ce185fe25d9ecab3ebb3", + "https://deno.land/std@0.119.0/encoding/base64url.ts": "a5c3f71c99a397f9c6da7701e7cae4c031700ae180ba68a0fc9ff9baca71e4ac", + "https://deno.land/std@0.119.0/flags/mod.ts": "5bd80147c97e481efcc4c041096c6c1a1393248e2849ccd571269d62c2634cbe", + "https://deno.land/std@0.119.0/fmt/colors.ts": "8368ddf2d48dfe413ffd04cdbb7ae6a1009cf0dccc9c7ff1d76259d9c61a0621", + "https://deno.land/std@0.119.0/fmt/printf.ts": "419510e0a3f7c8d680fbf6472d5a11e372854f1c2b32fca5fdb513575c485068", + "https://deno.land/std@0.119.0/fs/_util.ts": "f2ce811350236ea8c28450ed822a5f42a0892316515b1cd61321dec13569c56b", + "https://deno.land/std@0.119.0/fs/empty_dir.ts": "5f08b263dd064dc7917c4bbeb13de0f5505a664b9cdfe312fa86e7518cfaeb84", + "https://deno.land/std@0.119.0/fs/ensure_dir.ts": "b7c103dc41a3d1dbbb522bf183c519c37065fdc234831a4a0f7d671b1ed5fea7", + "https://deno.land/std@0.119.0/fs/ensure_file.ts": "c06031af24368e80c330897e4b8e9109efc8602ffabc8f3e2306be07529e1d13", + "https://deno.land/std@0.119.0/fs/ensure_link.ts": "26e54363508b822afd87a3f6e873bbbcd6b5993dd638f8170758c16262a75065", + "https://deno.land/std@0.119.0/fs/ensure_symlink.ts": "c07b6d19ef58b6f5c671ffa942e7f9be50315f4f78e2f9f511626fd2e13beccc", + "https://deno.land/std@0.119.0/fs/eol.ts": "afaebaaac36f48c423b920c836551997715672b80a0fee9aa7667c181a94f2df", + "https://deno.land/std@0.119.0/fs/exists.ts": "c3c3335a212bd945bb75df379096ab57fb6c86598fa273dfb24da3b3939a951e", + "https://deno.land/std@0.119.0/fs/expand_glob.ts": "f6f64ef54addcc84c9012d6dfcf66d39ecc2565e40c4d2b7644d585fe4d12a04", + "https://deno.land/std@0.119.0/fs/mod.ts": "2bf5468fc950479b2a791cceae3d6fe3f32e573243b004d1f8e0a3df92211680", + "https://deno.land/std@0.119.0/fs/move.ts": "4623058e39bbbeb3ad30aeff9c974c55d2d574ad7c480295c12b04c244686a99", + "https://deno.land/std@0.119.0/fs/walk.ts": "31464d75099aa3fc7764212576a8772dfabb2692783e6eabb910f874a26eac54", + "https://deno.land/std@0.119.0/io/buffer.ts": "8f10342821b81990acf859cdccb4e4031c7c9187a0ffc3ed6b356ee29ecc6681", + "https://deno.land/std@0.119.0/log/handlers.ts": "bb0685d4124c7401efbacd9e019c0c1abd2dfb381b939601338b158d2b327cb7", + "https://deno.land/std@0.119.0/log/levels.ts": "088a883039ece5fa0da5f74bc7688654045ea7cb01bf200b438191a28d728eae", + "https://deno.land/std@0.119.0/log/logger.ts": "6b2dd8cbe6f407100b9becfe61595d7681f8ce3692412fad843de84d617a038e", + "https://deno.land/std@0.119.0/log/mod.ts": "9393719dafdb360620ea9222c0ce0db35a0ebb0d49ea6d5c30406f332d2be334", + "https://deno.land/std@0.119.0/node/_buffer.js": "a43c35f89ef15c2107cba863d2cd0bd573e829a2a3b80167033da9b96066ce51", + "https://deno.land/std@0.119.0/node/_core.ts": "8b105f152c9f8990f7558b0a0a514d4f3ab90a85c09ca60e489ca92ed5271f75", + "https://deno.land/std@0.119.0/node/_errors.ts": "bf047995427fc15a27a182ee13021e94315fa758c1cc7c3576374876ab9f952a", + "https://deno.land/std@0.119.0/node/_fixed_queue.ts": "ac68975e5663ea9cf2e465e91a7600fa3d5dc1a2f556cf80fd1ee25b37dbcedf", + "https://deno.land/std@0.119.0/node/_next_tick.ts": "9b0bde39bfad9774be73b0fe9e77df757e147e2fc04784d51fe777d36d142260", + "https://deno.land/std@0.119.0/node/_process/process.ts": "828b67fa5858e30901e11a84968b2732057cd0bea34afcf49f617498040e7dbe", + "https://deno.land/std@0.119.0/node/_util/_debuglog.ts": "b46f7b640bad2afb8adf2b3560e6969071f9de0721dcec9e3530465ab5ec6c40", + "https://deno.land/std@0.119.0/node/_util/_util_callbackify.ts": "a89ade5b5d989f9eb9261cd8179a5f8a1579c6a898549fab304200a85ee520b0", + "https://deno.land/std@0.119.0/node/_util/_util_promisify.ts": "6d8d88fd81763f1074c84f4494484f9dd86182dfe46b63fe5aadd6448b767896", + "https://deno.land/std@0.119.0/node/_utils.ts": "42e5b28e1740ba0be9b4ace2c9adb95317d9cadb099418c51ed34cd6a301cae3", + "https://deno.land/std@0.119.0/node/buffer.ts": "cf37645cd1fc08f1afa02532dc6682cefd8cabbf44812aa9a4916e79bdd1cd11", + "https://deno.land/std@0.119.0/node/internal/buffer.js": "21f4bfea78679e18bfebeb1d9ece1a94d337d282a2a68d43ab5ff655c2d33e56", + "https://deno.land/std@0.119.0/node/internal/idna.ts": "6d7cce3e569fd1d9e558d63ab522700e57b998597196a4746436a62f3f8b1c7f", + "https://deno.land/std@0.119.0/node/internal/querystring.ts": "1fdee1158205dd220c3711cce2e994bd0848abc7518d245856d142b08a266a07", + "https://deno.land/std@0.119.0/node/internal/util.js": "11ef4e4724a4d40f1f5ed4a54e42cee3c3af0f75dcea33ac063747a6e3b9a582", + "https://deno.land/std@0.119.0/node/internal/util/comparisons.ts": "9e6979948221ee00a105355d8a9afe47fa059a331351cbb2e11fa8e2f50749d4", + "https://deno.land/std@0.119.0/node/internal/util/inspect.js": "2b50eb7e8b1d5a73a933f56a361262cf2f23429a8e1ca6ee47db04229bf12208", + "https://deno.land/std@0.119.0/node/internal/util/types.ts": "31745332605771b59701baebf1655f389202b10bb787afb78e66c92486bc0332", + "https://deno.land/std@0.119.0/node/internal/validators.js": "16b58d8ac8505897422d4ad273652a8cb36c470f470df9677700cc3b78c24c19", + "https://deno.land/std@0.119.0/node/internal_binding/_libuv_winerror.ts": "689b8fa52dafb7a1b55f3ffceca5905f77fb2720a8b9f77c921cd598e3ef3757", + "https://deno.land/std@0.119.0/node/internal_binding/_node.ts": "c257e872993334cfab1eaab8212d422b24f7388281f73c7bbdd9bbf1bb2a7841", + "https://deno.land/std@0.119.0/node/internal_binding/_utils.ts": "ee6830db046e829b5c4d6df1de21f1a3d6464469a2fe303b32bc44bb171c2eeb", + "https://deno.land/std@0.119.0/node/internal_binding/_winerror.ts": "27e4a7d78ae31e7b07faafd25fe46fa367271aec0a49f3be067f7ec160396a38", + "https://deno.land/std@0.119.0/node/internal_binding/buffer.ts": "f92daf02083bdaf0006a06fa1f26a26436f4b7b0c5d000aff7d01da3d1aa42a5", + "https://deno.land/std@0.119.0/node/internal_binding/constants.ts": "91c9274c8891f93262032129348b25f170162cb126dc424ec7ce8a2172812657", + "https://deno.land/std@0.119.0/node/internal_binding/string_decoder.ts": "6aca87fb018705e34c39d6f67d610b14c8ca04a47ca58f0d1fc8d5f9281e6b7b", + "https://deno.land/std@0.119.0/node/internal_binding/types.ts": "80621e22989a1431068bc3b7f59cab3afb42cfb4d4cd273e61fa2d11ab3abab6", + "https://deno.land/std@0.119.0/node/internal_binding/util.ts": "446b4d704f4d588df98db9c6f9c7465c08a23f20f781ba55bcc246fb260012af", + "https://deno.land/std@0.119.0/node/internal_binding/uv.ts": "3b722cd20508d54e4d790c825b23510a5fa4313ad42bfb8904704a738df32325", + "https://deno.land/std@0.119.0/node/path.ts": "86b262d6957fba13d4f3d58a92ced49de4f40169d06542326b5547ff97257f0d", + "https://deno.land/std@0.119.0/node/querystring.ts": "4f436efdd97659fe567c00f1cff233d4f5b67002ef388951db052dfe7c3de114", + "https://deno.land/std@0.119.0/node/string_decoder.ts": "e97d4988a3490fd572fc23e64b3a33dabc4ac76c1fb82665f34dc8956d57a658", + "https://deno.land/std@0.119.0/node/url.ts": "c58bd8adfde3833026c1c3c8f55cd14e37f9f1e4dd6b7b99c5feb4ace710e9b4", + "https://deno.land/std@0.119.0/node/util.ts": "3be88d5d1c908f279bf7fecd77ff3933e048aa50205029fdd69280f67aea5901", + "https://deno.land/std@0.119.0/path/_constants.ts": "1247fee4a79b70c89f23499691ef169b41b6ccf01887a0abd131009c5581b853", + "https://deno.land/std@0.119.0/path/_interface.ts": "1fa73b02aaa24867e481a48492b44f2598cd9dfa513c7b34001437007d3642e4", + "https://deno.land/std@0.119.0/path/_util.ts": "2e06a3b9e79beaf62687196bd4b60a4c391d862cfa007a20fc3a39f778ba073b", + "https://deno.land/std@0.119.0/path/common.ts": "f41a38a0719a1e85aa11c6ba3bea5e37c15dd009d705bd8873f94c833568cbc4", + "https://deno.land/std@0.119.0/path/glob.ts": "ea87985765b977cc284b92771003b2070c440e0807c90e1eb0ff3e095911a820", + "https://deno.land/std@0.119.0/path/mod.ts": "4465dc494f271b02569edbb4a18d727063b5dbd6ed84283ff906260970a15d12", + "https://deno.land/std@0.119.0/path/posix.ts": "34349174b9cd121625a2810837a82dd8b986bbaaad5ade690d1de75bbb4555b2", + "https://deno.land/std@0.119.0/path/separator.ts": "8fdcf289b1b76fd726a508f57d3370ca029ae6976fcde5044007f062e643ff1c", + "https://deno.land/std@0.119.0/path/win32.ts": "11549e8c6df8307a8efcfa47ad7b2a75da743eac7d4c89c9723a944661c8bd2e", + "https://deno.land/std@0.119.0/streams/conversion.ts": "7ff9af42540063fa72003ab31a377ba9dde8532d43b16329b933c37a6d7aac5f", + "https://deno.land/std@0.119.0/testing/_diff.ts": "e6a10d2aca8d6c27a9c5b8a2dbbf64353874730af539707b5b39d4128140642d", + "https://deno.land/std@0.119.0/testing/asserts.ts": "e8bd3ff280731e2d2b48c67d6ed97ce2c0b717601ccb38816aff89edce71680d", + "https://deno.land/std@0.157.0/_util/assert.ts": "e94f2eb37cebd7f199952e242c77654e43333c1ac4c5c700e929ea3aa5489f74", + "https://deno.land/std@0.157.0/bytes/bytes_list.ts": "aba5e2369e77d426b10af1de0dcc4531acecec27f9b9056f4f7bfbf8ac147ab4", + "https://deno.land/std@0.157.0/bytes/equals.ts": "3c3558c3ae85526f84510aa2b48ab2ad7bdd899e2e0f5b7a8ffc85acb3a6043a", + "https://deno.land/std@0.157.0/bytes/mod.ts": "763f97d33051cc3f28af1a688dfe2830841192a9fea0cbaa55f927b49d49d0bf", + "https://deno.land/std@0.157.0/io/buffer.ts": "fae02290f52301c4e0188670e730cd902f9307fb732d79c4aa14ebdc82497289", + "https://deno.land/std@0.157.0/streams/conversion.ts": "fc4eb76a14148c43f0b85e903a5a1526391aa40ed9434dc21e34f88304eb823e" + } +} diff --git a/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js b/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js index 350df5c18..4b8668c7f 100644 --- a/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js +++ b/packages/neo4j-driver-deno/lib/bolt-connection/bolt/bolt-protocol-v6x0.transformer.js @@ -18,7 +18,7 @@ import v5x8 from './bolt-protocol-v5x8.transformer.js' import { TypeTransformer } from './transformer.js' import { structure } from '../packstream/index.js' -import { Vector, UnknownType, isUnknownType, newError } from '../../core/index.ts' +import { Vector, UnsupportedType, isUnsupportedType, newError } from '../../core/index.ts' const VECTOR = 0x56 const FLOAT_32 = 0xc6 const FLOAT_64 = 0xc1 @@ -26,7 +26,7 @@ const INT_8 = 0xc8 const INT_16 = 0xc9 const INT_32 = 0xca const INT_64 = 0xcb -const UNKNOWN = 0x3F +const UNSUPPORTED = 0x3F const typeToTypeMarker = { INT8: INT_8, @@ -133,15 +133,15 @@ function checkLittleEndian () { return typeArray[0] === 1000 } -function createUnknownTypeTransformer () { +function createUnsupportedTypeTransformer () { return new TypeTransformer({ - signature: UNKNOWN, - isTypeInstance: object => isUnknownType(object), + signature: UNSUPPORTED, + isTypeInstance: object => isUnsupportedType(object), toStructure: _ => { - throw newError('Unknown Type object can not be transmitted') + throw newError('Unsupported Type object can not be transmitted') }, fromStructure: structure => { - return new UnknownType(structure.fields[0], structure.fields[1], structure.fields[2], structure.fields[3].message) + return new UnsupportedType(structure.fields[0], structure.fields[1], structure.fields[2], structure.fields[3].message) } }) } @@ -149,5 +149,5 @@ function createUnknownTypeTransformer () { export default { ...v5x8, createVectorTransformer, - createUnknownTypeTransformer + createUnsupportedTypeTransformer } diff --git a/packages/neo4j-driver-deno/lib/core/index.ts b/packages/neo4j-driver-deno/lib/core/index.ts index 1c95f7e51..44a018c49 100644 --- a/packages/neo4j-driver-deno/lib/core/index.ts +++ b/packages/neo4j-driver-deno/lib/core/index.ts @@ -103,7 +103,7 @@ import resultTransformers, { ResultTransformer } from './result-transformers.ts' import ClientCertificate, { clientCertificateProviders, ClientCertificateProvider, ClientCertificateProviders, RotatingClientCertificateProvider, resolveCertificateProvider } from './client-certificate.ts' import * as internal from './internal/index.ts' import Vector, { VectorType, vector } from './vector.ts' -import UnknownType, { isUnknownType } from './unknown-type.ts' +import UnsupportedType, { isUnsupportedType } from './unsupported-type.ts' /** * Object containing string constants representing predefined {@link Neo4jError} codes. @@ -191,8 +191,8 @@ const forExport = { notificationFilterMinimumSeverityLevel, clientCertificateProviders, resolveCertificateProvider, - UnknownType, - isUnknownType + UnsupportedType, + isUnsupportedType } export { @@ -272,8 +272,8 @@ export { clientCertificateProviders, resolveCertificateProvider, Vector, - UnknownType, - isUnknownType, + UnsupportedType, + isUnsupportedType, vector } diff --git a/packages/neo4j-driver-deno/lib/core/unknown-type.ts b/packages/neo4j-driver-deno/lib/core/unsupported-type.ts similarity index 84% rename from packages/neo4j-driver-deno/lib/core/unknown-type.ts rename to packages/neo4j-driver-deno/lib/core/unsupported-type.ts index dc8a63bab..9cb077ffd 100644 --- a/packages/neo4j-driver-deno/lib/core/unknown-type.ts +++ b/packages/neo4j-driver-deno/lib/core/unsupported-type.ts @@ -15,14 +15,14 @@ * limitations under the License. */ -const UNKNOWN_TYPE_IDENTIFIER_PROPERTY = '__isType__' +const UNSUPPORTED_TYPE_IDENTIFIER_PROPERTY = '__isType__' /** * A representation of a value that could not be transmitted over the wire due to an outdated protocol version. * @access public - * @exports UnknownType + * @exports UnsupportedType */ -export default class UnknownType { +export default class UnsupportedType { name: string _minimumProtocolMajor: number _minimumProtocolMinor: number @@ -64,11 +64,11 @@ export default class UnknownType { } toString (): string { - return `UnknownType<${this.name}>` + return `UnsupportedType<${this.name}>` } } -Object.defineProperty(UnknownType.prototype, UNKNOWN_TYPE_IDENTIFIER_PROPERTY, { +Object.defineProperty(UnsupportedType.prototype, UNSUPPORTED_TYPE_IDENTIFIER_PROPERTY, { value: true, enumerable: false, configurable: false, @@ -80,7 +80,7 @@ Object.defineProperty(UnknownType.prototype, UNKNOWN_TYPE_IDENTIFIER_PROPERTY, { * @param {Object} obj the object to test. * @return {boolean} `true` if given object is a {@link Point}, `false` otherwise. */ -export function isUnknownType (obj: unknown): obj is UnknownType { +export function isUnsupportedType (obj: unknown): obj is UnsupportedType { const anyObj: any | null | undefined = obj - return obj != null && anyObj[UNKNOWN_TYPE_IDENTIFIER_PROPERTY] === true + return obj != null && anyObj[UNSUPPORTED_TYPE_IDENTIFIER_PROPERTY] === true } diff --git a/packages/neo4j-driver-deno/lib/mod.ts b/packages/neo4j-driver-deno/lib/mod.ts index 66e9a2b22..cf250cc1a 100644 --- a/packages/neo4j-driver-deno/lib/mod.ts +++ b/packages/neo4j-driver-deno/lib/mod.ts @@ -52,7 +52,7 @@ import { isRetryableError, isTime, isUnboundRelationship, - isUnknownType, + isUnsupportedType, LocalDateTime, LocalTime, ManagedTransaction, @@ -397,7 +397,7 @@ const forExport = { isPathSegment, isRelationship, isUnboundRelationship, - isUnknownType, + isUnsupportedType, integer, Neo4jError, isRetriableError, @@ -472,7 +472,7 @@ export { isPathSegment, isRelationship, isUnboundRelationship, - isUnknownType, + isUnsupportedType, integer, Neo4jError, isRetriableError, diff --git a/packages/neo4j-driver-lite/src/index.ts b/packages/neo4j-driver-lite/src/index.ts index de1ede81d..f3087fab7 100644 --- a/packages/neo4j-driver-lite/src/index.ts +++ b/packages/neo4j-driver-lite/src/index.ts @@ -52,7 +52,7 @@ import { isRetryableError, isTime, isUnboundRelationship, - isUnknownType, + isUnsupportedType, LocalDateTime, LocalTime, ManagedTransaction, @@ -396,7 +396,7 @@ const forExport = { isPathSegment, isRelationship, isUnboundRelationship, - isUnknownType, + isUnsupportedType, integer, Neo4jError, isRetriableError, @@ -471,7 +471,7 @@ export { isPathSegment, isRelationship, isUnboundRelationship, - isUnknownType, + isUnsupportedType, integer, Neo4jError, isRetriableError, diff --git a/packages/neo4j-driver/src/index.js b/packages/neo4j-driver/src/index.js index d7dcc0ef7..d230b7846 100644 --- a/packages/neo4j-driver/src/index.js +++ b/packages/neo4j-driver/src/index.js @@ -46,7 +46,7 @@ import { isRelationship, isTime, isUnboundRelationship, - isUnknownType, + isUnsupportedType, LocalDateTime, LocalTime, Time, @@ -360,7 +360,7 @@ const forExport = { isPathSegment, isRelationship, isUnboundRelationship, - isUnknownType, + isUnsupportedType, integer, Neo4jError, isRetriableError, @@ -433,7 +433,7 @@ export { isPathSegment, isRelationship, isUnboundRelationship, - isUnknownType, + isUnsupportedType, integer, Neo4jError, isRetriableError, diff --git a/packages/neo4j-driver/types/index.d.ts b/packages/neo4j-driver/types/index.d.ts index d8f2bb20e..4481ddc16 100644 --- a/packages/neo4j-driver/types/index.d.ts +++ b/packages/neo4j-driver/types/index.d.ts @@ -44,7 +44,7 @@ import { isPathSegment, isRelationship, isUnboundRelationship, - isUnknownType, + isUnsupportedType, LocalDateTime, LocalTime, Time, @@ -290,7 +290,7 @@ declare const forExport: { isPathSegment: typeof isPathSegment isRelationship: typeof isRelationship isUnboundRelationship: typeof isUnboundRelationship - isUnknownType: typeof isUnknownType + isUnsupportedType: typeof isUnsupportedType bookmarkManager: typeof bookmarkManager resultTransformers: typeof resultTransformers notificationCategory: typeof notificationCategory @@ -372,7 +372,7 @@ export { isPathSegment, isRelationship, isUnboundRelationship, - isUnknownType, + isUnsupportedType, bookmarkManager, resultTransformers, notificationCategory, diff --git a/packages/testkit-backend/src/cypher-native-binders.js b/packages/testkit-backend/src/cypher-native-binders.js index 8917f5057..0f6478a93 100644 --- a/packages/testkit-backend/src/cypher-native-binders.js +++ b/packages/testkit-backend/src/cypher-native-binders.js @@ -183,12 +183,12 @@ export default function CypherNativeBinders (neo4j) { return structResponse('CypherVector', { dtype, data }) } - if (neo4j.isUnknownType(x)) { + if (neo4j.isUnsupportedType(x)) { const name = x.name const minimumProtocolMajor = x._minimumProtocolMajor const minimumProtocolMinor = x._minimumProtocolMinor const message = x.message - return structResponse('CypherUnknownType', { name, minimumProtocolMajor, minimumProtocolMinor, message }) + return structResponse('CypherUnsupportedType', { name, minimumProtocolMajor, minimumProtocolMinor, message }) } // If all failed, interpret as a map diff --git a/packages/testkit-backend/src/feature/common.js b/packages/testkit-backend/src/feature/common.js index 984af3f21..0c472c034 100644 --- a/packages/testkit-backend/src/feature/common.js +++ b/packages/testkit-backend/src/feature/common.js @@ -43,8 +43,8 @@ const features = [ 'Feature:API:Session:NotificationsConfig', 'Feature:API:Summary:GqlStatusObjects', 'Feature:API:Liveness.Check', + 'Feature:API:Type.UnsupportedType', 'Feature:API:Type.Vector', - 'Feature:API:Type.UnknownType', 'Optimization:AuthPipelining', 'Optimization:EagerTransactionBegin', 'Optimization:ExecuteQueryPipelining', From 7cd2c6cb34cec2ab0e6ab9f995e44e0caee1acd7 Mon Sep 17 00:00:00 2001 From: ci <61233757+MaxAake@users.noreply.github.com> Date: Fri, 19 Sep 2025 13:13:25 +0200 Subject: [PATCH 13/13] adjustment of CypherUnsupportedType --- packages/testkit-backend/src/cypher-native-binders.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/testkit-backend/src/cypher-native-binders.js b/packages/testkit-backend/src/cypher-native-binders.js index 0f6478a93..c6ca893ce 100644 --- a/packages/testkit-backend/src/cypher-native-binders.js +++ b/packages/testkit-backend/src/cypher-native-binders.js @@ -188,7 +188,7 @@ export default function CypherNativeBinders (neo4j) { const minimumProtocolMajor = x._minimumProtocolMajor const minimumProtocolMinor = x._minimumProtocolMinor const message = x.message - return structResponse('CypherUnsupportedType', { name, minimumProtocolMajor, minimumProtocolMinor, message }) + return structResponse('CypherUnsupportedType', { name, minimumProtocol: minimumProtocolMajor + '.' + minimumProtocolMinor, message }) } // If all failed, interpret as a map