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
28 changes: 28 additions & 0 deletions packages/neo4j-driver-deno/lib/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ import {
isDuration,
isLocalDateTime,
isLocalTime,
isNode,
isPath,
isPathSegment,
isRelationship,
isTime,
isUnboundRelationship,
LocalDateTime,
LocalTime,
Time,
Expand Down Expand Up @@ -413,6 +418,17 @@ const temporal = {
isDateTime
}

/**
* Object containing functions to work with graph types, like {@link Node} or {@link Relationship}.
*/
const graph = {
isNode,
isPath,
isPathSegment,
isRelationship,
isUnboundRelationship
}

/**
* @private
*/
Expand All @@ -428,6 +444,11 @@ const forExport = {
isDate,
isLocalDateTime,
isDateTime,
isNode,
isPath,
isPathSegment,
isRelationship,
isUnboundRelationship,
integer,
Neo4jError,
isRetriableError,
Expand All @@ -436,6 +457,7 @@ const forExport = {
types,
session,
error,
graph,
spatial,
temporal,
Driver,
Expand Down Expand Up @@ -481,6 +503,11 @@ export {
isDate,
isLocalDateTime,
isDateTime,
isNode,
isPath,
isPathSegment,
isRelationship,
isUnboundRelationship,
integer,
Neo4jError,
isRetriableError,
Expand All @@ -489,6 +516,7 @@ export {
types,
session,
error,
graph,
spatial,
temporal,
Driver,
Expand Down
28 changes: 28 additions & 0 deletions packages/neo4j-driver-lite/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ import {
isDuration,
isLocalDateTime,
isLocalTime,
isNode,
isPath,
isPathSegment,
isRelationship,
isTime,
isUnboundRelationship,
LocalDateTime,
LocalTime,
Time,
Expand Down Expand Up @@ -412,6 +417,17 @@ const temporal = {
isDateTime
}

/**
* Object containing functions to work with graph types, like {@link Node} or {@link Relationship}.
*/
const graph = {
isNode,
isPath,
isPathSegment,
isRelationship,
isUnboundRelationship
}

/**
* @private
*/
Expand All @@ -427,6 +443,11 @@ const forExport = {
isDate,
isLocalDateTime,
isDateTime,
isNode,
isPath,
isPathSegment,
isRelationship,
isUnboundRelationship,
integer,
Neo4jError,
isRetriableError,
Expand All @@ -435,6 +456,7 @@ const forExport = {
types,
session,
error,
graph,
spatial,
temporal,
Driver,
Expand Down Expand Up @@ -480,6 +502,11 @@ export {
isDate,
isLocalDateTime,
isDateTime,
isNode,
isPath,
isPathSegment,
isRelationship,
isUnboundRelationship,
integer,
Neo4jError,
isRetriableError,
Expand All @@ -488,6 +515,7 @@ export {
types,
session,
error,
graph,
spatial,
temporal,
Driver,
Expand Down
104 changes: 103 additions & 1 deletion packages/neo4j-driver-lite/test/unit/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ import neo4j, {
Date,
LocalDateTime,
DateTime,
BookmarkManager
BookmarkManager,
graph,
isNode,
isRelationship,
isPath,
isPathSegment,
isUnboundRelationship
} from '../../'

describe('index', () => {
Expand Down Expand Up @@ -301,4 +307,100 @@ describe('index', () => {
const date: DateTime<number> = new DateTime(1, 2, 3, 3, 5, 6, 6, 5)
expect(date).toBeDefined()
})

it('should export isNode', () => {
const node = new Node(int(123), ['abc'], [1])

expect(isNode(node)).toBe(true)
})

it('should export graph.isNode', () => {
const node = new Node(int(123), ['abc'], [1])

expect(graph.isNode(node)).toBe(true)
})

it('should export isRelationship', () => {
const rel = new Relationship(
int(123),
int(1),
int(1),
'rel',
{}
)

expect(isRelationship(rel)).toBe(true)
})

it('should export graph.isRelationship', () => {
const rel = new Relationship(
int(123),
int(1),
int(1),
'rel',
{}
)

expect(graph.isRelationship(rel)).toBe(true)
})

it('should export isUnboundRelationship', () => {
const rel = new UnboundRelationship(
int(123),
'rel',
{}
)

expect(isUnboundRelationship(rel)).toBe(true)
})

it('should export graph.isUnboundRelationship', () => {
const rel = new UnboundRelationship(
int(123),
'rel',
{}
)

expect(graph.isUnboundRelationship(rel)).toBe(true)
})

it('should export isPath', () => {
const path = new Path(
new Node(int(1), ['a'], ['1']),
new Node(int(1), ['a'], ['1']),
[]
)

expect(isPath(path)).toBe(true)
})

it('should export graph.isPath', () => {
const path = new Path(
new Node(int(1), ['a'], ['1']),
new Node(int(1), ['a'], ['1']),
[]
)

expect(graph.isPath(path)).toBe(true)
})

it('should export isPathSegment', () => {
const pathSeg = new PathSegment(
new Node(int(1), ['a'], ['1']),
new Relationship(int(123), int(1), int(1), 'rel', {}),
new Node(int(1), ['a'], ['1'])
)

expect(isPathSegment(pathSeg)).toBe(true)
})

it('should export graph.isPath', () => {
const pathSeg = new PathSegment(
new Node(int(1), ['a'], ['1']),
new Relationship(int(123), int(1), int(1), 'rel', {}),
new Node(int(1), ['a'], ['1'])
)

expect(graph.isPathSegment(pathSeg)).toBe(true)
})
})
28 changes: 28 additions & 0 deletions packages/neo4j-driver/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ import {
isDuration,
isLocalDateTime,
isLocalTime,
isNode,
isPath,
isPathSegment,
isRelationship,
isTime,
isUnboundRelationship,
LocalDateTime,
LocalTime,
Time,
Expand Down Expand Up @@ -401,6 +406,17 @@ const temporal = {
isDateTime
}

/**
* Object containing functions to work with graph types, like {@link Node} or {@link Relationship}.
*/
const graph = {
isNode,
isPath,
isPathSegment,
isRelationship,
isUnboundRelationship
}

/**
* @private
*/
Expand All @@ -416,6 +432,11 @@ const forExport = {
isDate,
isLocalDateTime,
isDateTime,
isNode,
isPath,
isPathSegment,
isRelationship,
isUnboundRelationship,
integer,
Neo4jError,
isRetryableError,
Expand All @@ -424,6 +445,7 @@ const forExport = {
types,
session,
error,
graph,
spatial,
temporal,
Driver,
Expand Down Expand Up @@ -470,6 +492,11 @@ export {
isDate,
isLocalDateTime,
isDateTime,
isNode,
isPath,
isPathSegment,
isRelationship,
isUnboundRelationship,
integer,
Neo4jError,
isRetryableError,
Expand All @@ -478,6 +505,7 @@ export {
types,
session,
error,
graph,
spatial,
temporal,
Driver,
Expand Down
Loading