Skip to content

Commit 225402c

Browse files
authored
Correct exporting of vector features in ts files (#1356)
Primarily adds vector and Vector to the index.d.ts exports. Also ensures that VectorType is consistently exported only as a type (for type annotations)
1 parent 636a908 commit 225402c

File tree

6 files changed

+28
-13
lines changed

6 files changed

+28
-13
lines changed

packages/neo4j-driver-deno/lib/mod.ts

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/neo4j-driver-lite/src/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ function driver (
270270
routingContext: parsedUrl.query
271271
})
272272
} else {
273-
if (!isEmptyObjectOrNull(parsedUrl.query)) {
273+
if (isEmptyObjectOrNull(parsedUrl.query) !== true) {
274274
throw new Error(
275275
`Parameters are not supported with none routed scheme. Given URL: '${url}'`
276276
)
@@ -330,7 +330,8 @@ const types = {
330330
LocalDateTime,
331331
LocalTime,
332332
Time,
333-
Integer
333+
Integer,
334+
Vector
334335
}
335336

336337
/**
@@ -534,6 +535,7 @@ export {
534535
notificationFilterMinimumSeverityLevel,
535536
clientCertificateProviders,
536537
vector,
538+
Vector,
537539
rule,
538540
RecordObjectMapping,
539541
StandardCase
@@ -568,7 +570,6 @@ export type {
568570
ClientCertificateProvider,
569571
ClientCertificateProviders,
570572
RotatingClientCertificateProvider,
571-
Vector,
572573
VectorType,
573574
Rule,
574575
Rules,

packages/neo4j-driver/src/index.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ import {
8383
resolveCertificateProvider,
8484
isVector,
8585
Vector,
86-
VectorType,
8786
vector,
8887
Rule,
8988
Rules,
@@ -297,7 +296,6 @@ const types = {
297296
Time,
298297
Integer,
299298
Vector,
300-
VectorType,
301299
Rule,
302300
Rules,
303301
ProtocolVersion
@@ -425,6 +423,7 @@ const forExport = {
425423
clientCertificateProviders,
426424
isVector,
427425
vector,
426+
Vector,
428427
rule,
429428
mappingDecorators,
430429
RecordObjectMapping,
@@ -507,7 +506,6 @@ export {
507506
isVector,
508507
vector,
509508
Vector,
510-
VectorType,
511509
Rule,
512510
Rules,
513511
rule,

packages/neo4j-driver/test/types/export.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import driver, {
2727
RxResult,
2828
Session,
2929
Record,
30+
VectorType,
3031
types
3132
} from '../../'
3233

@@ -82,6 +83,7 @@ const dummy: any = null
8283
const rxSession: RxSession = dummy
8384
const rxTransaction: RxTransaction = dummy
8485
const rxResult: RxResult = dummy
86+
const vectorType: VectorType = dummy
8587

8688
const record: Record = new Record(['role'], [124])
8789

@@ -104,6 +106,7 @@ const instanceOfRxSession: boolean = dummy instanceof types.RxSession
104106
const instanceOfRxTransaction: boolean = dummy instanceof types.RxTransaction
105107
const instanceOfRxManagedTransaction: boolean = dummy instanceof types.RxManagedTransaction
106108
const instanceOfRxResult: boolean = dummy instanceof types.RxResult
109+
const instanceOfVector: boolean = dummy instanceof types.Vector
107110

108111
const instanceOfDriverDriver: boolean = dummy instanceof driver.Driver
109112
const instanceOfDriverNeo4jError: boolean = dummy instanceof driver.Neo4jError

packages/neo4j-driver/test/types/index.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ import {
4747
notificationFilterDisabledCategory,
4848
NotificationFilterDisabledClassification,
4949
notificationFilterDisabledClassification,
50-
authTokenManagers
50+
authTokenManagers,
51+
vector
5152
} from '../../types/index'
5253

5354
import Driver from '../../types/driver'
@@ -137,6 +138,8 @@ const neo4jIsPathSegment: boolean = isPathSegment({})
137138
const neo4jIsRelationship: boolean = isRelationship({})
138139
const neo4jIsUnboundRelationship: boolean = isUnboundRelationship({})
139140

141+
const vectorConstructorFunction = vector(Int16Array.from([0]))
142+
140143
const unknownSeverityString: string = notificationSeverityLevel.UNKNOWN
141144
const warningSeverityString: string = notificationSeverityLevel.WARNING
142145
const informationSeverityString: string = notificationSeverityLevel.INFORMATION

packages/neo4j-driver/types/index.d.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ import {
106106
StandardCase,
107107
MappedQueryResult,
108108
types as coreTypes,
109-
isVector
109+
isVector,
110+
vector,
111+
Vector,
112+
VectorType
110113
} from 'neo4j-driver-core'
111114
import {
112115
AuthToken,
@@ -185,6 +188,7 @@ declare const types: {
185188
RxTransaction: typeof RxTransaction
186189
RxManagedTransaction: typeof RxManagedTransaction
187190
RxResult: typeof RxResult
191+
Vector: typeof Vector
188192
}
189193

190194
declare const session: {
@@ -309,6 +313,8 @@ declare const forExport: {
309313
logging: typeof logging
310314
clientCertificateProviders: typeof clientCertificateProviders
311315
isVector: typeof isVector
316+
vector: typeof vector
317+
Vector: typeof Vector
312318
}
313319

314320
export {
@@ -391,7 +397,9 @@ export {
391397
notificationFilterMinimumSeverityLevel,
392398
logging,
393399
clientCertificateProviders,
394-
isVector
400+
isVector,
401+
vector,
402+
Vector
395403
}
396404

397405
export type {
@@ -421,7 +429,8 @@ export type {
421429
rule,
422430
RecordObjectMapping,
423431
StandardCase,
424-
MappedQueryResult
432+
MappedQueryResult,
433+
VectorType
425434
}
426435

427436
export default forExport

0 commit comments

Comments
 (0)