Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/src/connection-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import Connection from './connection'
import { bookmarks } from './internal'
import { ProtocolVersion } from './internal/protocol-version'
import { ProtocolVersion } from './protocol-version'
import { ServerInfo } from './result-summary'
import { AuthToken } from './types'

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import { Bookmarks } from './internal/bookmarks'
import { AccessMode, TelemetryApis } from './internal/constants'
import { ResultStreamObserver } from './internal/observers'
import { ProtocolVersion } from './internal/protocol-version'
import { ProtocolVersion } from './protocol-version'
import { TxConfig } from './internal/tx-config'
import NotificationFilter from './notification-filter'

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import { newError } from './error'
import NotificationFilter from './notification-filter'
import HomeDatabaseCache from './internal/homedb-cache'
import { cacheKey } from './internal/auth-util'
import { ProtocolVersion } from './internal/protocol-version'
import { ProtocolVersion } from './protocol-version'

const DEFAULT_MAX_CONNECTION_LIFETIME: number = 60 * 60 * 1000 // 1 hour

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ import * as json from './json'
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 { ProtocolVersion } from './internal/protocol-version'
import { ProtocolVersion } from './protocol-version'
import Vector, { VectorType, vector, isVector } from './vector'
import { StandardCase } from './mapping.nameconventions'
import { Rule, Rules, RecordObjectMapping } from './mapping.highlevel'
Expand Down Expand Up @@ -292,7 +292,7 @@ export {
RecordObjectMapping,
StandardCase,
UnsupportedType,
isUnsupportedType,
isUnsupportedType
}

export type {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/internal/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

import { ProtocolVersion } from './protocol-version'
import { ProtocolVersion } from '../protocol-version'

const FETCH_ALL = -1
const DEFAULT_POOL_ACQUISITION_TIMEOUT = 60 * 1000 // 60 seconds
Expand Down
50 changes: 0 additions & 50 deletions packages/core/src/internal/protocol-version.ts

This file was deleted.

106 changes: 106 additions & 0 deletions packages/core/src/protocol-version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/**
* 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.
*/

/**
*
* @access public
* @class A class representing a protocol version the driver is using to communicate with the server.
* @param {number} major the major version of the protocol.
* @param {number} minor the minor version of the protocol.
*/
export class ProtocolVersion {
private readonly major: number
private readonly minor: number
constructor (major: number, minor: number) {
this.major = major
this.minor = minor
}

/**
*
* @returns {number} The major version of the protocol
*/
getMajor (): number {
return this.major
}

/**
* @returns {number} The minor version of the protocol
*/
getMinor (): number {
return this.major
}

/**
*
* @param {ProtocolVersion | {major: number, minor: number}} other the protocol version to compare to
* @returns {boolean} If this version semantically smaller than the other version.
*/
isLessThan (other: ProtocolVersion): boolean {
if (this.major < other.major) {
return true
} else if (this.major === other.major && this.minor < other.minor) {
return true
}
return false
}

/**
*
* @param {ProtocolVersion | {major: number, minor: number}} other the protocol version to compare to
* @returns {boolean} If this version is semantically larger than the other version.
*/
isGreaterThan (other: ProtocolVersion): boolean {
if (this.major > other.major) {
return true
} else if (this.major === other.major && this.minor > other.minor) {
return true
}
return false
}

/**
*
* @param {ProtocolVersion | {major: number, minor: number}} other the protocol version to compare to
* @returns {boolean} if this version is semantically larger or equal to the other version.
*/
isGreaterOrEqualTo (other: ProtocolVersion): boolean {
return !this.isLessThan(other)
}

/**
*
* @param {ProtocolVersion | {major: number, minor: number}} other the protocol version to compare to
* @returns {boolean} if this version is semantically smaller or equal to the other version.
*/
isLessOrEqualTo (other: ProtocolVersion): boolean {
return !this.isGreaterThan(other)
}

/**
*
* @param {ProtocolVersion | {major: number, minor: number}} other the protocol version to compare to
* @returns {boolean} If this version is the equal to the other version.
*/
isEqualTo (other: ProtocolVersion): boolean {
return this.major === other.major && this.minor === other.minor
}

toString (): string {
return this.major.toString() + '.' + this.minor.toString()
}
}
2 changes: 1 addition & 1 deletion packages/core/src/result-summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Integer from './integer'
import { NumberOrInteger } from './graph-types'
import { util } from './internal'
import GqlStatusObject, { Notification, buildGqlStatusObjectFromMetadata, buildNotificationsFromMetadata } from './notification'
import { ProtocolVersion } from './internal/protocol-version'
import { ProtocolVersion } from './protocol-version'

/**
* A ResultSummary instance contains structured metadata for a {@link Result}.
Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/driver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { LogLevel } from '../src/types'
import resultTransformers from '../src/result-transformers'
import Record, { RecordShape } from '../src/record'
import { invalidNotificationFilters, validNotificationFilters } from './utils/notification-filters.fixtures'
import { ProtocolVersion } from '../src/internal/protocol-version'
import { ProtocolVersion } from '../src/protocol-version'

describe('Driver', () => {
let driver: Driver | null
Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/result-summary.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

import { int } from '../src'
import { ProtocolVersion } from '../src/internal/protocol-version'
import { ProtocolVersion } from '../src/protocol-version'
import {
ServerInfo,
ProfiledPlan,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/result.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import ResultStreamObserverMock from './utils/result-stream-observer.mock'
import Result from '../src/result'
import FakeConnection from './utils/connection.fake'
import { Logger } from '../src/internal/logger'
import { ProtocolVersion } from '../src/internal/protocol-version'
import { ProtocolVersion } from '../src/protocol-version'

interface AB {
a: number
Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/utils/connection.fake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import { Connection, ResultObserver, ResultSummary } from '../../src'
import { BeginTransactionConfig, CommitTransactionConfig, RollbackConnectionConfig, RunQueryConfig } from '../../src/connection'
import { ResultStreamObserver } from '../../src/internal/observers'
import { ProtocolVersion } from '../../src/internal/protocol-version'
import { ProtocolVersion } from '../../src/protocol-version'

/**
* This class is like a mock of {@link Connection} that tracks invocations count.
Expand Down
2 changes: 1 addition & 1 deletion packages/neo4j-driver-deno/lib/core/connection-provider.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/neo4j-driver-deno/lib/core/connection.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/neo4j-driver-deno/lib/core/driver.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/neo4j-driver-deno/lib/core/index.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/neo4j-driver-deno/lib/core/internal/constants.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 0 additions & 50 deletions packages/neo4j-driver-deno/lib/core/internal/protocol-version.ts

This file was deleted.

Loading