@neo4j-cypher/query-tools 2.0.0-next.37 → 2.0.0-next.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/index.cjs +1848 -0
- package/dist/cjs/index.cjs.map +7 -0
- package/dist/esm/package.json +9 -8
- package/dist/esm/src/connectionErrorHandler.d.ts +1 -0
- package/dist/esm/src/connectionErrorHandler.js.map +1 -1
- package/dist/esm/src/cypher-execution/extract-unique-nodes-and-relationships.d.ts +1 -1
- package/dist/esm/src/cypher-execution/extract-unique-nodes-and-relationships.test.js +0 -4
- package/dist/esm/src/cypher-execution/extract-unique-nodes-and-relationships.test.js.map +1 -1
- package/dist/esm/src/cypher-execution/query-result.js +2 -9
- package/dist/esm/src/cypher-execution/query-result.js.map +1 -1
- package/dist/esm/src/data-transforms/record-to-string.js +1 -2
- package/dist/esm/src/data-transforms/record-to-string.js.map +1 -1
- package/dist/esm/src/integration-tests/pollingIntegrationTests.test.js.map +1 -1
- package/dist/esm/src/integration-tests/setupTestContainer.d.ts +1 -1
- package/dist/esm/src/integration-tests/setupTestContainer.js +1 -1
- package/dist/esm/src/integration-tests/setupTestContainer.js.map +1 -1
- package/dist/esm/src/metadataPoller.d.ts +4 -4
- package/dist/esm/src/metadataPoller.js +1 -1
- package/dist/esm/src/metadataPoller.js.map +1 -1
- package/dist/esm/src/neo4jConnection.d.ts +4 -4
- package/dist/esm/src/neo4jConnection.js +2 -2
- package/dist/esm/src/neo4jConnection.js.map +1 -1
- package/dist/esm/src/queries/dataSummary.d.ts +1 -1
- package/dist/esm/src/queries/dataSummary.js.map +1 -1
- package/dist/esm/src/queries/databases.d.ts +1 -1
- package/dist/esm/src/queries/databases.js +0 -3
- package/dist/esm/src/queries/databases.js.map +1 -1
- package/dist/esm/src/queries/functions.d.ts +1 -1
- package/dist/esm/src/queries/functions.js +1 -2
- package/dist/esm/src/queries/functions.js.map +1 -1
- package/dist/esm/src/queries/graphSchema.d.ts +1 -1
- package/dist/esm/src/queries/graphSchema.js +1 -1
- package/dist/esm/src/queries/graphSchema.js.map +1 -1
- package/dist/esm/src/queries/procedures.d.ts +1 -1
- package/dist/esm/src/queries/procedures.js +1 -2
- package/dist/esm/src/queries/procedures.js.map +1 -1
- package/dist/esm/src/queries/version.d.ts +1 -1
- package/dist/esm/src/result-transformers/graph-result-transformer.d.ts +2 -2
- package/dist/esm/src/result-transformers/graph-result-transformer.js +2 -2
- package/dist/esm/src/result-transformers/graph-result-transformer.js.map +1 -1
- package/dist/esm/src/schemaPoller.d.ts +3 -3
- package/dist/esm/src/schemaPoller.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/connectionErrorHandler.d.ts +1 -0
- package/dist/types/src/cypher-execution/extract-unique-nodes-and-relationships.d.ts +1 -1
- package/dist/types/src/integration-tests/setupTestContainer.d.ts +1 -1
- package/dist/types/src/metadataPoller.d.ts +4 -4
- package/dist/types/src/neo4jConnection.d.ts +4 -4
- package/dist/types/src/queries/dataSummary.d.ts +1 -1
- package/dist/types/src/queries/databases.d.ts +1 -1
- package/dist/types/src/queries/functions.d.ts +1 -1
- package/dist/types/src/queries/graphSchema.d.ts +1 -1
- package/dist/types/src/queries/procedures.d.ts +1 -1
- package/dist/types/src/queries/version.d.ts +1 -1
- package/dist/types/src/result-transformers/graph-result-transformer.d.ts +2 -2
- package/dist/types/src/schemaPoller.d.ts +3 -3
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -9
- package/src/connectionErrorHandler.ts +5 -2
- package/src/cypher-execution/extract-unique-nodes-and-relationships.test.ts +0 -4
- package/src/cypher-execution/extract-unique-nodes-and-relationships.ts +1 -1
- package/src/cypher-execution/query-result.ts +1 -13
- package/src/data-transforms/record-to-string.ts +2 -3
- package/src/integration-tests/pollingIntegrationTests.test.ts +6 -5
- package/src/integration-tests/setupTestContainer.ts +3 -2
- package/src/metadataPoller.ts +14 -10
- package/src/neo4jConnection.ts +6 -6
- package/src/queries/dataSummary.ts +4 -4
- package/src/queries/databases.ts +2 -4
- package/src/queries/functions.ts +6 -3
- package/src/queries/graphSchema.ts +7 -6
- package/src/queries/procedures.ts +6 -3
- package/src/queries/version.ts +1 -1
- package/src/result-transformers/graph-result-transformer.ts +4 -10
- package/src/schemaPoller.ts +4 -3
- package/tsconfig.json +4 -4
- package/tsconfig.node.json +1 -2
- package/dist/cjs/package.json +0 -46
- package/dist/cjs/src/connectionErrorHandler.d.ts +0 -10
- package/dist/cjs/src/connectionErrorHandler.js +0 -40
- package/dist/cjs/src/connectionErrorHandler.js.map +0 -1
- package/dist/cjs/src/cypher-execution/extract-unique-nodes-and-relationships.d.ts +0 -33
- package/dist/cjs/src/cypher-execution/extract-unique-nodes-and-relationships.js +0 -93
- package/dist/cjs/src/cypher-execution/extract-unique-nodes-and-relationships.js.map +0 -1
- package/dist/cjs/src/cypher-execution/extract-unique-nodes-and-relationships.test.d.ts +0 -1
- package/dist/cjs/src/cypher-execution/extract-unique-nodes-and-relationships.test.js +0 -129
- package/dist/cjs/src/cypher-execution/extract-unique-nodes-and-relationships.test.js.map +0 -1
- package/dist/cjs/src/cypher-execution/query-result.d.ts +0 -11
- package/dist/cjs/src/cypher-execution/query-result.js +0 -239
- package/dist/cjs/src/cypher-execution/query-result.js.map +0 -1
- package/dist/cjs/src/data-transforms/clean-type.d.ts +0 -6
- package/dist/cjs/src/data-transforms/clean-type.js +0 -16
- package/dist/cjs/src/data-transforms/clean-type.js.map +0 -1
- package/dist/cjs/src/data-transforms/cypher-type-names.d.ts +0 -6
- package/dist/cjs/src/data-transforms/cypher-type-names.js +0 -91
- package/dist/cjs/src/data-transforms/cypher-type-names.js.map +0 -1
- package/dist/cjs/src/data-transforms/format-float.d.ts +0 -1
- package/dist/cjs/src/data-transforms/format-float.js +0 -14
- package/dist/cjs/src/data-transforms/format-float.js.map +0 -1
- package/dist/cjs/src/data-transforms/record-to-string.d.ts +0 -8
- package/dist/cjs/src/data-transforms/record-to-string.js +0 -185
- package/dist/cjs/src/data-transforms/record-to-string.js.map +0 -1
- package/dist/cjs/src/index.d.ts +0 -17
- package/dist/cjs/src/index.js +0 -33
- package/dist/cjs/src/index.js.map +0 -1
- package/dist/cjs/src/integration-tests/pollingIntegrationTests.test.d.ts +0 -1
- package/dist/cjs/src/integration-tests/pollingIntegrationTests.test.js +0 -42
- package/dist/cjs/src/integration-tests/pollingIntegrationTests.test.js.map +0 -1
- package/dist/cjs/src/integration-tests/setupTestContainer.d.ts +0 -10
- package/dist/cjs/src/integration-tests/setupTestContainer.js +0 -23
- package/dist/cjs/src/integration-tests/setupTestContainer.js.map +0 -1
- package/dist/cjs/src/metadataPoller.d.ts +0 -34
- package/dist/cjs/src/metadataPoller.js +0 -214
- package/dist/cjs/src/metadataPoller.js.map +0 -1
- package/dist/cjs/src/neo4jConnection.d.ts +0 -36
- package/dist/cjs/src/neo4jConnection.js +0 -128
- package/dist/cjs/src/neo4jConnection.js.map +0 -1
- package/dist/cjs/src/queries/dataSummary.d.ts +0 -7
- package/dist/cjs/src/queries/dataSummary.js +0 -33
- package/dist/cjs/src/queries/dataSummary.js.map +0 -1
- package/dist/cjs/src/queries/databases.d.ts +0 -28
- package/dist/cjs/src/queries/databases.js +0 -112
- package/dist/cjs/src/queries/databases.js.map +0 -1
- package/dist/cjs/src/queries/functions.d.ts +0 -14
- package/dist/cjs/src/queries/functions.js +0 -87
- package/dist/cjs/src/queries/functions.js.map +0 -1
- package/dist/cjs/src/queries/graphSchema.d.ts +0 -28
- package/dist/cjs/src/queries/graphSchema.js +0 -88
- package/dist/cjs/src/queries/graphSchema.js.map +0 -1
- package/dist/cjs/src/queries/procedures.d.ts +0 -14
- package/dist/cjs/src/queries/procedures.js +0 -105
- package/dist/cjs/src/queries/procedures.js.map +0 -1
- package/dist/cjs/src/queries/roles.d.ts +0 -11
- package/dist/cjs/src/queries/roles.js +0 -24
- package/dist/cjs/src/queries/roles.js.map +0 -1
- package/dist/cjs/src/queries/users.d.ts +0 -15
- package/dist/cjs/src/queries/users.js +0 -24
- package/dist/cjs/src/queries/users.js.map +0 -1
- package/dist/cjs/src/queries/version.d.ts +0 -7
- package/dist/cjs/src/queries/version.js +0 -32
- package/dist/cjs/src/queries/version.js.map +0 -1
- package/dist/cjs/src/result-transformers/graph-result-transformer.d.ts +0 -37
- package/dist/cjs/src/result-transformers/graph-result-transformer.js +0 -37
- package/dist/cjs/src/result-transformers/graph-result-transformer.js.map +0 -1
- package/dist/cjs/src/schemaPoller.d.ts +0 -45
- package/dist/cjs/src/schemaPoller.js +0 -199
- package/dist/cjs/src/schemaPoller.js.map +0 -1
- package/dist/cjs/src/types/cypher-data-types.d.ts +0 -41
- package/dist/cjs/src/types/cypher-data-types.js +0 -47
- package/dist/cjs/src/types/cypher-data-types.js.map +0 -1
- package/dist/cjs/src/types/sdkTypes.d.ts +0 -18
- package/dist/cjs/src/types/sdkTypes.js +0 -11
- package/dist/cjs/src/types/sdkTypes.js.map +0 -1
- package/dist/cjs/tsconfig.tsbuildinfo +0 -1
- package/dist/cjs/vitest.config.d.mts +0 -2
- package/dist/cjs/vitest.config.mjs +0 -10
- package/dist/cjs/vitest.config.mjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-cypher/query-tools",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.38",
|
|
4
4
|
"description": "",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/neo4j/cypher-language-support/issues"
|
|
@@ -11,21 +11,22 @@
|
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "git://github.com/neo4j/cypher-language-support.git"
|
|
13
13
|
},
|
|
14
|
-
"
|
|
14
|
+
"type": "module",
|
|
15
|
+
"main": "./dist/cjs/index.cjs",
|
|
15
16
|
"module": "./dist/esm/src/index.js",
|
|
16
17
|
"types": "./dist/types/src/index.d.ts",
|
|
17
18
|
"exports": {
|
|
18
19
|
".": {
|
|
19
|
-
"types": "./dist/
|
|
20
|
-
"require": "./dist/cjs/
|
|
20
|
+
"types": "./dist/types/src/index.d.ts",
|
|
21
|
+
"require": "./dist/cjs/index.cjs",
|
|
21
22
|
"import": "./dist/esm/src/index.js",
|
|
22
|
-
"default": "./dist/cjs/
|
|
23
|
+
"default": "./dist/cjs/index.cjs"
|
|
23
24
|
}
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
27
|
"ajv": "^8.12.0",
|
|
27
28
|
"neo4j-driver": "6.0.1",
|
|
28
|
-
"@neo4j-cypher/language-support": "2.0.0-next.
|
|
29
|
+
"@neo4j-cypher/language-support": "2.0.0-next.38"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@testcontainers/neo4j": "^11.5.1"
|
|
@@ -35,11 +36,11 @@
|
|
|
35
36
|
},
|
|
36
37
|
"scripts": {
|
|
37
38
|
"build": "concurrently 'npm:build-esm' 'npm:build-commonjs' 'npm:build-types'",
|
|
38
|
-
"build-esm": "tsc --
|
|
39
|
-
"build-commonjs": "
|
|
39
|
+
"build-esm": "tsc --outDir dist/esm",
|
|
40
|
+
"build-commonjs": "esbuild ./src/index.ts --bundle --format=cjs --sourcemap --packages=external --outfile=dist/cjs/index.cjs",
|
|
40
41
|
"build-types": "tsc --emitDeclarationOnly --outDir dist/types",
|
|
41
42
|
"dev": "concurrently 'npm:build-esm -- --watch' 'npm:build-commonjs -- --watch'",
|
|
42
|
-
"clean": "rm -rf
|
|
43
|
+
"clean": "rm -rf dist tsconfig*.tsbuildinfo",
|
|
43
44
|
"test": "vitest run extract-unique-nodes-and-relationships",
|
|
44
45
|
"test:polling": "vitest run pollingIntegrationTests"
|
|
45
46
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { Neo4jError } from 'neo4j-driver';
|
|
1
|
+
import type { Neo4jError } from 'neo4j-driver';
|
|
2
2
|
|
|
3
|
-
export const FRIENDLY_ERROR_MESSAGES: {
|
|
3
|
+
export const FRIENDLY_ERROR_MESSAGES: {
|
|
4
|
+
Default: string;
|
|
5
|
+
[key: string]: string;
|
|
6
|
+
} = {
|
|
4
7
|
'Neo.ClientError.Security.AuthenticationRateLimit':
|
|
5
8
|
'Double check your username and password',
|
|
6
9
|
'Neo.ClientError.Security.CredentialsExpired':
|
|
@@ -36,7 +36,6 @@ describe('extractNodesAndRels', () => {
|
|
|
36
36
|
const pathSegment = new PathSegment(startNode, relationship, endNode);
|
|
37
37
|
const path = new Path(startNode, endNode, [pathSegment]);
|
|
38
38
|
|
|
39
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
40
39
|
const boltRecord = {
|
|
41
40
|
keys: ['p'],
|
|
42
41
|
get: () => path,
|
|
@@ -104,7 +103,6 @@ describe('extractNodesAndRels', () => {
|
|
|
104
103
|
'node34',
|
|
105
104
|
);
|
|
106
105
|
|
|
107
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
108
106
|
const boltRecord = {
|
|
109
107
|
keys: ['n'],
|
|
110
108
|
get: () => [node1, node2, relationship],
|
|
@@ -148,7 +146,6 @@ describe('extractNodesAndRels', () => {
|
|
|
148
146
|
const pathSegment = new PathSegment(startNode, relationship, endNode);
|
|
149
147
|
const path = new Path(startNode, endNode, [pathSegment]);
|
|
150
148
|
|
|
151
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
152
149
|
const boltRecord = {
|
|
153
150
|
keys: ['p'],
|
|
154
151
|
get: () => path,
|
|
@@ -202,7 +199,6 @@ describe('extractNodesAndRels', () => {
|
|
|
202
199
|
const pathSegment = new PathSegment(startNode, relationship, endNode);
|
|
203
200
|
const path = new Path(startNode, endNode, [pathSegment]);
|
|
204
201
|
|
|
205
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
206
202
|
const boltRecord = {
|
|
207
203
|
keys: ['p'],
|
|
208
204
|
get: () => path,
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
Relationship,
|
|
8
8
|
} from 'neo4j-driver';
|
|
9
9
|
import { isNode, isPath, isRelationship } from 'neo4j-driver';
|
|
10
|
-
import { CypherProperty } from '../types/cypher-data-types.js';
|
|
10
|
+
import type { CypherProperty } from '../types/cypher-data-types.js';
|
|
11
11
|
|
|
12
12
|
export type Properties = RecordShape<string, CypherProperty>;
|
|
13
13
|
|
|
@@ -28,7 +28,6 @@ export type Neo4jType =
|
|
|
28
28
|
|
|
29
29
|
export function addAnnotationProp(
|
|
30
30
|
obj: Record<string, unknown>,
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
|
|
32
31
|
type: string | unknown,
|
|
33
32
|
prop: string = RESERVED_TYPE_PROPERTY_NAME,
|
|
34
33
|
): Record<string, unknown> {
|
|
@@ -73,14 +72,11 @@ function copyAndAnnotate(
|
|
|
73
72
|
obj: Exclude<Neo4jType | QueryResult, undefined | null | Neo4jType[]>,
|
|
74
73
|
): Record<string, unknown> {
|
|
75
74
|
return Object.keys(obj).reduce<Record<string, unknown>>((newObj, key) => {
|
|
76
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
77
75
|
// @ts-ignore TypeScript complains about not being able to use `key` to
|
|
78
76
|
// index `obj`, but we know that `key` exists in `obj` since it's coming
|
|
79
77
|
// from Object.keys.
|
|
80
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
81
78
|
const value = obj[key] as unknown as Neo4jType;
|
|
82
79
|
|
|
83
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
84
80
|
newObj[key] = serializeTypeAnnotations(value);
|
|
85
81
|
return newObj;
|
|
86
82
|
}, {});
|
|
@@ -99,11 +95,11 @@ export function serializeTypeAnnotations(
|
|
|
99
95
|
return item.map((i) => serializeTypeAnnotations(i));
|
|
100
96
|
}
|
|
101
97
|
if (item === null || item === undefined) {
|
|
98
|
+
// This is needed due to the method overloading types
|
|
102
99
|
return item;
|
|
103
100
|
}
|
|
104
101
|
|
|
105
102
|
if (item instanceof types.Record) {
|
|
106
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
107
103
|
// @ts-ignore There are two versions of the type for Record coming from the
|
|
108
104
|
// driver.
|
|
109
105
|
const tmp = copyAndAnnotate(item);
|
|
@@ -181,17 +177,10 @@ export function serializeTypeAnnotations(
|
|
|
181
177
|
return addAnnotationProp(tmp, 'Object');
|
|
182
178
|
}
|
|
183
179
|
|
|
184
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
185
180
|
// @ts-ignore this type isn't inferred correctly
|
|
186
181
|
return item;
|
|
187
182
|
}
|
|
188
183
|
|
|
189
|
-
/* eslint-disable @typescript-eslint/no-explicit-any,
|
|
190
|
-
@typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access,
|
|
191
|
-
@typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-assignment,
|
|
192
|
-
no-underscore-dangle, @typescript-eslint/no-redundant-type-constituents
|
|
193
|
-
*/
|
|
194
|
-
|
|
195
184
|
export function deserializeTypeAnnotations(
|
|
196
185
|
rawItem: Record<string, unknown>,
|
|
197
186
|
): QueryResult | Neo4jRecord;
|
|
@@ -369,7 +358,6 @@ export function deserializeTypeAnnotations(
|
|
|
369
358
|
break;
|
|
370
359
|
case 'INT64':
|
|
371
360
|
// For INT64, values are stored as strings to avoid BigInt serialization issues
|
|
372
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
373
361
|
typedArray = new BigInt64Array(values.map((v: any) => BigInt(v)));
|
|
374
362
|
break;
|
|
375
363
|
case 'FLOAT32':
|
|
@@ -70,7 +70,6 @@ export function propertyToString(
|
|
|
70
70
|
|
|
71
71
|
if (typeof property === 'string') {
|
|
72
72
|
if (quoteStrings) {
|
|
73
|
-
// oxlint-disable-next-line typescript-eslint/restrict-template-expressions
|
|
74
73
|
return `"${property}"`;
|
|
75
74
|
}
|
|
76
75
|
return property;
|
|
@@ -88,7 +87,7 @@ const cypherShellStyleStringify = (
|
|
|
88
87
|
value: Node | Relationship | Path,
|
|
89
88
|
{
|
|
90
89
|
stringStyle,
|
|
91
|
-
quoteStrings
|
|
90
|
+
quoteStrings,
|
|
92
91
|
}: { stringStyle: CypherStringStyle; quoteStrings: boolean },
|
|
93
92
|
): string => {
|
|
94
93
|
const includeIds = stringStyle === 'cypher-with-ids';
|
|
@@ -142,7 +141,7 @@ const cypherShellStyleStringify = (
|
|
|
142
141
|
|
|
143
142
|
return value.segments
|
|
144
143
|
.map((segment, index) => {
|
|
145
|
-
const result = [];
|
|
144
|
+
const result: string[] = [];
|
|
146
145
|
|
|
147
146
|
if (index === 0) {
|
|
148
147
|
result.push(
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Driver, Session } from 'neo4j-driver';
|
|
2
|
+
import { auth, driver } from 'neo4j-driver';
|
|
2
3
|
import { createAndStartTestContainer } from './setupTestContainer.js';
|
|
3
|
-
import { StartedNeo4jContainer } from '@testcontainers/neo4j';
|
|
4
|
+
import type { StartedNeo4jContainer } from '@testcontainers/neo4j';
|
|
5
|
+
import type { GraphSchema } from '../queries/graphSchema.js';
|
|
4
6
|
import {
|
|
5
7
|
extractRelationshipsWithNamedNodes,
|
|
6
|
-
GraphSchema,
|
|
7
8
|
validateGraphSchema,
|
|
8
9
|
} from '../queries/graphSchema.js';
|
|
9
10
|
|
|
@@ -32,14 +33,14 @@ describe('Polling integration', () => {
|
|
|
32
33
|
test('Polling graph schema query gives results in correct shape', async () => {
|
|
33
34
|
const query = 'CALL db.schema.visualization() YIELD *';
|
|
34
35
|
const result = await session.run(query);
|
|
35
|
-
validateGraphSchema(result.records[0]
|
|
36
|
+
validateGraphSchema(result.records[0]!.toObject());
|
|
36
37
|
expect(validateGraphSchema.errors).toBe(null);
|
|
37
38
|
});
|
|
38
39
|
|
|
39
40
|
test('Polled graph schema is correctly retrieved from polling query result', async () => {
|
|
40
41
|
const query = 'CALL db.schema.visualization() YIELD *';
|
|
41
42
|
const result = await session.run(query);
|
|
42
|
-
const actualResult = [result.records[0]
|
|
43
|
+
const actualResult = [result.records[0]!.toObject()] as GraphSchema[];
|
|
43
44
|
validateGraphSchema(actualResult[0]);
|
|
44
45
|
const graphSchema = extractRelationshipsWithNamedNodes(actualResult);
|
|
45
46
|
expect(graphSchema).toContainEqual({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { StartedNeo4jContainer } from '@testcontainers/neo4j';
|
|
2
|
+
import { Neo4jContainer } from '@testcontainers/neo4j';
|
|
2
3
|
|
|
3
4
|
type ContainerOpts = {
|
|
4
5
|
containerName: string;
|
|
@@ -13,7 +14,7 @@ export async function createAndStartTestContainer(
|
|
|
13
14
|
},
|
|
14
15
|
): Promise<StartedNeo4jContainer> {
|
|
15
16
|
const password = 'password';
|
|
16
|
-
const env = { ...
|
|
17
|
+
const env = { ...opts.env, NEO4J_ACCEPT_LICENSE_AGREEMENT: 'yes' };
|
|
17
18
|
|
|
18
19
|
const container = await new Neo4jContainer(opts.neo4jVersion)
|
|
19
20
|
.withExposedPorts(7474, 7687)
|
package/src/metadataPoller.ts
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
allCypherVersions,
|
|
1
|
+
import type {
|
|
2
|
+
CypherVersion,
|
|
4
3
|
DbSchema,
|
|
5
4
|
Neo4jFunction,
|
|
6
5
|
Neo4jProcedure,
|
|
7
6
|
} from '@neo4j-cypher/language-support';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import { allCypherVersions } from '@neo4j-cypher/language-support';
|
|
8
|
+
import type { EventEmitter } from 'events';
|
|
9
|
+
import type { Neo4jConnection } from './neo4jConnection.js';
|
|
10
|
+
import type { Database } from './queries/databases.js';
|
|
11
|
+
import { listDatabases } from './queries/databases.js';
|
|
12
|
+
import type { DataSummary } from './queries/dataSummary.js';
|
|
13
|
+
import { getDataSummary } from './queries/dataSummary.js';
|
|
12
14
|
import { listFunctions } from './queries/functions.js';
|
|
13
15
|
import { listProcedures } from './queries/procedures.js';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
16
|
+
import type { Neo4jRole } from './queries/roles.js';
|
|
17
|
+
import { listRoles } from './queries/roles.js';
|
|
18
|
+
import type { Neo4jUser } from './queries/users.js';
|
|
19
|
+
import { listUsers } from './queries/users.js';
|
|
20
|
+
import type { ExecuteQueryArgs } from './types/sdkTypes.js';
|
|
17
21
|
import { listGraphSchema } from './queries/graphSchema.js';
|
|
18
22
|
|
|
19
23
|
type PollingStatus = 'not-started' | 'fetching' | 'fetched' | 'error';
|
package/src/neo4jConnection.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
Driver,
|
|
3
3
|
ManagedTransaction,
|
|
4
4
|
QueryResult,
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
Result,
|
|
7
7
|
Session,
|
|
8
8
|
} from 'neo4j-driver';
|
|
9
|
-
import
|
|
10
|
-
import { Database } from './queries/databases.js';
|
|
11
|
-
import { ExecuteQueryArgs, QueryType } from './types/sdkTypes.js';
|
|
9
|
+
import packageJson from '../package.json' with { type: 'json' };
|
|
10
|
+
import type { Database } from './queries/databases.js';
|
|
11
|
+
import type { ExecuteQueryArgs, QueryType } from './types/sdkTypes.js';
|
|
12
12
|
|
|
13
13
|
const METADATA_BASE = {
|
|
14
14
|
app: 'neo4j-sdk',
|
|
15
|
-
version: version,
|
|
15
|
+
version: packageJson.version,
|
|
16
16
|
};
|
|
17
17
|
const RECORD_LIMIT = 5000;
|
|
18
18
|
|
|
@@ -77,7 +77,7 @@ export class Neo4jConnection {
|
|
|
77
77
|
} else {
|
|
78
78
|
result = tx.run(query, parameters);
|
|
79
79
|
}
|
|
80
|
-
const records = [];
|
|
80
|
+
const records: Array<any> = [];
|
|
81
81
|
let recordLimitHit = false;
|
|
82
82
|
|
|
83
83
|
for await (const record of result) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resultTransformers } from 'neo4j-driver';
|
|
2
|
-
import { ExecuteQueryArgs } from '../types/sdkTypes.js';
|
|
2
|
+
import type { ExecuteQueryArgs } from '../types/sdkTypes.js';
|
|
3
3
|
|
|
4
4
|
export type DataSummary = {
|
|
5
5
|
labels: string[];
|
|
@@ -27,9 +27,9 @@ RETURN COLLECT(propertyKey)[..${ITEM_LIMIT}] AS result`;
|
|
|
27
27
|
},
|
|
28
28
|
collect(results, summary) {
|
|
29
29
|
return {
|
|
30
|
-
labels: results[0]
|
|
31
|
-
relationshipTypes: results[1]
|
|
32
|
-
propertyKeys: results[2]
|
|
30
|
+
labels: results[0]!,
|
|
31
|
+
relationshipTypes: results[1]!,
|
|
32
|
+
propertyKeys: results[2]!,
|
|
33
33
|
summary,
|
|
34
34
|
};
|
|
35
35
|
},
|
package/src/queries/databases.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CypherVersion } from '@neo4j-cypher/language-support';
|
|
2
2
|
import { resultTransformers } from 'neo4j-driver';
|
|
3
|
-
import { ExecuteQueryArgs
|
|
3
|
+
import type { ExecuteQueryArgs } from '../types/sdkTypes.js';
|
|
4
|
+
import { DbType } from '../types/sdkTypes.js';
|
|
4
5
|
|
|
5
6
|
type DatabaseStatus =
|
|
6
7
|
| 'online'
|
|
@@ -147,8 +148,6 @@ function getLogicalDatabases(
|
|
|
147
148
|
|
|
148
149
|
function sortDatabases(databases: Database[]) {
|
|
149
150
|
function databaseComparator(a: Database, b: Database) {
|
|
150
|
-
// disable eslint to make code more readable
|
|
151
|
-
/* eslint-disable curly */
|
|
152
151
|
// home is greater than default
|
|
153
152
|
if (a.default && b.home) return 1;
|
|
154
153
|
|
|
@@ -159,7 +158,6 @@ function sortDatabases(databases: Database[]) {
|
|
|
159
158
|
// system is less than anything else
|
|
160
159
|
if (a.name === 'system') return 1;
|
|
161
160
|
if (b.name === 'system') return -1;
|
|
162
|
-
/* eslint-enable curly */
|
|
163
161
|
|
|
164
162
|
// else sort alphabetically
|
|
165
163
|
return a.name.localeCompare(b.name);
|
package/src/queries/functions.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type {
|
|
2
|
+
CypherVersion,
|
|
3
|
+
Neo4jFunction,
|
|
4
|
+
} from '@neo4j-cypher/language-support';
|
|
5
|
+
import type { JSONSchemaType } from 'ajv';
|
|
6
|
+
import { Ajv } from 'ajv';
|
|
3
7
|
import { resultTransformers } from 'neo4j-driver';
|
|
4
8
|
import {
|
|
5
9
|
cleanType,
|
|
@@ -84,7 +88,6 @@ export function listFunctions(
|
|
|
84
88
|
map(record) {
|
|
85
89
|
const objResult = record.toObject();
|
|
86
90
|
validateFunction(objResult);
|
|
87
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
88
91
|
const result = cleanTypes(objResult as Neo4jFunction);
|
|
89
92
|
return result;
|
|
90
93
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { resultTransformers } from 'neo4j-driver';
|
|
2
|
-
import { ExecuteQueryArgs } from '../types/sdkTypes.js';
|
|
3
|
-
import
|
|
2
|
+
import type { ExecuteQueryArgs } from '../types/sdkTypes.js';
|
|
3
|
+
import type { JSONSchemaType } from 'ajv';
|
|
4
|
+
import { Ajv } from 'ajv';
|
|
4
5
|
|
|
5
6
|
type NeoNode = {
|
|
6
7
|
labels: string[];
|
|
@@ -94,16 +95,16 @@ export function extractRelationshipsWithNamedNodes(
|
|
|
94
95
|
if (graphSchemas.length !== 1) {
|
|
95
96
|
return items;
|
|
96
97
|
}
|
|
97
|
-
const graphSchema = graphSchemas[0]
|
|
98
|
+
const graphSchema = graphSchemas[0]!;
|
|
98
99
|
const nodes: Record<string, string> = {};
|
|
99
100
|
|
|
100
101
|
for (const node of graphSchema.nodes) {
|
|
101
102
|
//Query should only return 1 label
|
|
102
|
-
nodes[node.elementId] = node.labels[0]
|
|
103
|
+
nodes[node.elementId] = node.labels[0]!;
|
|
103
104
|
}
|
|
104
105
|
for (const rel of graphSchema.relationships) {
|
|
105
|
-
const from = nodes[rel.startNodeElementId]
|
|
106
|
-
const to = nodes[rel.endNodeElementId]
|
|
106
|
+
const from = nodes[rel.startNodeElementId]!;
|
|
107
|
+
const to = nodes[rel.endNodeElementId]!;
|
|
107
108
|
const relType = rel.type;
|
|
108
109
|
items.push({ from, to, relType });
|
|
109
110
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type {
|
|
2
|
+
CypherVersion,
|
|
3
|
+
Neo4jProcedure,
|
|
4
|
+
} from '@neo4j-cypher/language-support';
|
|
5
|
+
import type { JSONSchemaType } from 'ajv';
|
|
6
|
+
import { Ajv } from 'ajv';
|
|
3
7
|
import { resultTransformers } from 'neo4j-driver';
|
|
4
8
|
import { cleanTypeDescription } from '../data-transforms/clean-type.js';
|
|
5
9
|
import type { ExecuteQueryArgs } from '../types/sdkTypes.js';
|
|
@@ -97,7 +101,6 @@ export function listProcedures(
|
|
|
97
101
|
const objResult = record.toObject();
|
|
98
102
|
validateProcedure(objResult);
|
|
99
103
|
// Type is verified in integration tests
|
|
100
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
101
104
|
const result = cleanTypes(objResult as Neo4jProcedure);
|
|
102
105
|
return result;
|
|
103
106
|
},
|
package/src/queries/version.ts
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
Record,
|
|
4
|
-
ResultSummary,
|
|
5
|
-
resultTransformers,
|
|
6
|
-
} from 'neo4j-driver';
|
|
1
|
+
import type { Integer, Record, ResultSummary } from 'neo4j-driver';
|
|
2
|
+
import { resultTransformers } from 'neo4j-driver';
|
|
7
3
|
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
extractUniqueNodesAndRels,
|
|
11
|
-
} from '../cypher-execution/extract-unique-nodes-and-relationships.js';
|
|
4
|
+
import type { DeduplicatedNodesAndRels } from '../cypher-execution/extract-unique-nodes-and-relationships.js';
|
|
5
|
+
import { extractUniqueNodesAndRels } from '../cypher-execution/extract-unique-nodes-and-relationships.js';
|
|
12
6
|
|
|
13
7
|
/**
|
|
14
8
|
* Result type for graph queries that includes deduplicated nodes and relationships
|
package/src/schemaPoller.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
-
import
|
|
2
|
+
import type { Config, Driver } from 'neo4j-driver';
|
|
3
|
+
import neo4j from 'neo4j-driver';
|
|
4
|
+
import type { ConnectionError } from './connectionErrorHandler.js';
|
|
3
5
|
import {
|
|
4
|
-
ConnectionError,
|
|
5
6
|
FRIENDLY_ERROR_MESSAGES,
|
|
6
7
|
getConnectionError,
|
|
7
8
|
isRetriableNeo4jError,
|
|
8
9
|
} from './connectionErrorHandler.js';
|
|
10
|
+
import type { MetadataPoller } from './metadataPoller.js';
|
|
9
11
|
import {
|
|
10
12
|
ConnectedMetadataPoller,
|
|
11
13
|
DisconnectedMetadataPoller,
|
|
12
|
-
MetadataPoller,
|
|
13
14
|
} from './metadataPoller.js';
|
|
14
15
|
import { Neo4jConnection } from './neo4jConnection.js';
|
|
15
16
|
import { listDatabases } from './queries/databases.js';
|
package/tsconfig.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"extends": "../../tsconfig.base.json",
|
|
3
3
|
"include": ["src", "package.json", "vitest.config.mts"],
|
|
4
4
|
"compilerOptions": {
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"moduleResolution": "bundler",
|
|
5
|
+
"module": "nodenext",
|
|
6
|
+
"moduleResolution": "nodenext",
|
|
8
7
|
"resolveJsonModule": true,
|
|
9
|
-
"types": ["vitest/globals"]
|
|
8
|
+
"types": ["vitest/globals", "node"],
|
|
9
|
+
"strictNullChecks": true // TODO: Move to tsconfig.base.json
|
|
10
10
|
}
|
|
11
11
|
}
|
package/tsconfig.node.json
CHANGED
package/dist/cjs/package.json
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@neo4j-cypher/query-tools",
|
|
3
|
-
"version": "2.0.0-next.37",
|
|
4
|
-
"description": "",
|
|
5
|
-
"bugs": {
|
|
6
|
-
"url": "https://github.com/neo4j/cypher-language-support/issues"
|
|
7
|
-
},
|
|
8
|
-
"license": "Apache-2.0",
|
|
9
|
-
"author": "Neo4j Inc.",
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "git://github.com/neo4j/cypher-language-support.git"
|
|
13
|
-
},
|
|
14
|
-
"main": "./dist/cjs/src/index.js",
|
|
15
|
-
"module": "./dist/esm/src/index.js",
|
|
16
|
-
"types": "./dist/types/src/index.d.ts",
|
|
17
|
-
"exports": {
|
|
18
|
-
".": {
|
|
19
|
-
"types": "./dist/esm/index.d.ts",
|
|
20
|
-
"require": "./dist/cjs/src/index.js",
|
|
21
|
-
"import": "./dist/esm/src/index.js",
|
|
22
|
-
"default": "./dist/cjs/src/index.js"
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"scripts": {
|
|
26
|
-
"build": "concurrently 'npm:build-esm' 'npm:build-commonjs' 'npm:build-types'",
|
|
27
|
-
"build-esm": "tsc --module esnext --outDir dist/esm",
|
|
28
|
-
"build-commonjs": "tsc --module commonjs --moduleResolution node --outDir dist/cjs",
|
|
29
|
-
"build-types": "tsc --emitDeclarationOnly --outDir dist/types",
|
|
30
|
-
"dev": "concurrently 'npm:build-esm -- --watch' 'npm:build-commonjs -- --watch'",
|
|
31
|
-
"clean": "rm -rf {dist,tsconfig.tsbuildinfo}",
|
|
32
|
-
"test": "vitest run extract-unique-nodes-and-relationships",
|
|
33
|
-
"test:polling": "vitest run pollingIntegrationTests"
|
|
34
|
-
},
|
|
35
|
-
"dependencies": {
|
|
36
|
-
"@neo4j-cypher/language-support": "workspace:*",
|
|
37
|
-
"ajv": "^8.12.0",
|
|
38
|
-
"neo4j-driver": "catalog:"
|
|
39
|
-
},
|
|
40
|
-
"devDependencies": {
|
|
41
|
-
"@testcontainers/neo4j": "^11.5.1"
|
|
42
|
-
},
|
|
43
|
-
"engines": {
|
|
44
|
-
"node": ">=24.11.1"
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const FRIENDLY_ERROR_MESSAGES: {
|
|
2
|
-
[key: string]: string;
|
|
3
|
-
};
|
|
4
|
-
export type ConnectionError = {
|
|
5
|
-
message: string;
|
|
6
|
-
friendlyMessage: string;
|
|
7
|
-
code: string;
|
|
8
|
-
};
|
|
9
|
-
export declare function isRetriableNeo4jError(error: unknown): boolean;
|
|
10
|
-
export declare function getConnectionError(error: unknown): ConnectionError;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FRIENDLY_ERROR_MESSAGES = void 0;
|
|
4
|
-
exports.isRetriableNeo4jError = isRetriableNeo4jError;
|
|
5
|
-
exports.getConnectionError = getConnectionError;
|
|
6
|
-
exports.FRIENDLY_ERROR_MESSAGES = {
|
|
7
|
-
'Neo.ClientError.Security.AuthenticationRateLimit': 'Double check your username and password',
|
|
8
|
-
'Neo.ClientError.Security.CredentialsExpired': 'Double check your username and password',
|
|
9
|
-
'Neo.ClientError.Security.Unauthorized': 'Double check your username and password',
|
|
10
|
-
'Neo.ClientError.Security.TokenExpired': 'Double check your username and password',
|
|
11
|
-
'Neo.ClientError.Database.DatabaseNotFound': 'Double check that the database exists',
|
|
12
|
-
ServiceUnavailable: 'Double check the scheme, host and port are correct, make sure Neo4j is running and that you have a network connection if needed',
|
|
13
|
-
Default: 'An error occurred while connecting to Neo4j',
|
|
14
|
-
};
|
|
15
|
-
function isRetriableNeo4jError(error) {
|
|
16
|
-
return isNeo4jError(error) ? error.retriable : true;
|
|
17
|
-
}
|
|
18
|
-
function isNeo4jError(error) {
|
|
19
|
-
return (error instanceof Error &&
|
|
20
|
-
error.code !== undefined &&
|
|
21
|
-
error.message !== undefined);
|
|
22
|
-
}
|
|
23
|
-
function getConnectionError(error) {
|
|
24
|
-
if (isNeo4jError(error)) {
|
|
25
|
-
return {
|
|
26
|
-
message: stripTrailingPeriod(error.message),
|
|
27
|
-
code: error.code,
|
|
28
|
-
friendlyMessage: exports.FRIENDLY_ERROR_MESSAGES[error.code] ?? exports.FRIENDLY_ERROR_MESSAGES.Default,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
return {
|
|
32
|
-
message: '',
|
|
33
|
-
code: '',
|
|
34
|
-
friendlyMessage: exports.FRIENDLY_ERROR_MESSAGES.Default,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
function stripTrailingPeriod(message) {
|
|
38
|
-
return message.endsWith('.') ? message.slice(0, -1) : message;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=connectionErrorHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connectionErrorHandler.js","sourceRoot":"","sources":["../../../src/connectionErrorHandler.ts"],"names":[],"mappings":";;;AAwBA,sDAEC;AAUD,gDAeC;AAjDY,QAAA,uBAAuB,GAA8B;IAChE,kDAAkD,EAChD,yCAAyC;IAC3C,6CAA6C,EAC3C,yCAAyC;IAC3C,uCAAuC,EACrC,yCAAyC;IAC3C,uCAAuC,EACrC,yCAAyC;IAC3C,2CAA2C,EACzC,uCAAuC;IACzC,kBAAkB,EAChB,iIAAiI;IACnI,OAAO,EAAE,6CAA6C;CACvD,CAAC;AAQF,SAAgB,qBAAqB,CAAC,KAAc;IAClD,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;AACtD,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,CACL,KAAK,YAAY,KAAK;QACrB,KAAoB,CAAC,IAAI,KAAK,SAAS;QACvC,KAAoB,CAAC,OAAO,KAAK,SAAS,CAC5C,CAAC;AACJ,CAAC;AAED,SAAgB,kBAAkB,CAAC,KAAc;IAC/C,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO;YACL,OAAO,EAAE,mBAAmB,CAAC,KAAK,CAAC,OAAO,CAAC;YAC3C,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,eAAe,EACb,+BAAuB,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,+BAAuB,CAAC,OAAO;SACzE,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,EAAE;QACX,IAAI,EAAE,EAAE;QACR,eAAe,EAAE,+BAAuB,CAAC,OAAO;KACjD,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAAC,OAAe;IAC1C,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AAChE,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { Integer, Node, Record, RecordShape, Relationship } from 'neo4j-driver';
|
|
2
|
-
import { CypherProperty } from '../types/cypher-data-types.js';
|
|
3
|
-
export type Properties = RecordShape<string, CypherProperty>;
|
|
4
|
-
/**
|
|
5
|
-
* Result type containing deduplicated nodes and relationships extracted from Neo4j records.
|
|
6
|
-
*/
|
|
7
|
-
export type DeduplicatedNodesAndRels = {
|
|
8
|
-
/** Array of unique nodes found in the records */
|
|
9
|
-
nodes: Node<Integer, Properties, string>[];
|
|
10
|
-
/** Array of unique relationships found in the records */
|
|
11
|
-
relationships: Relationship<Integer, Properties, string>[];
|
|
12
|
-
/** Whether the max node limit was reached during extraction */
|
|
13
|
-
limitHit: boolean;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Extracts and deduplicates nodes and relationships from Neo4j query records.
|
|
17
|
-
*
|
|
18
|
-
* This function processes Neo4j records to find all nodes and relationships,
|
|
19
|
-
* removing duplicates based on their element IDs. It can handle various data
|
|
20
|
-
* structures including individual nodes/relationships, paths, arrays, and
|
|
21
|
-
* nested objects.
|
|
22
|
-
*
|
|
23
|
-
* @param records - Array of Neo4j records to process
|
|
24
|
-
* @param options - Configuration options for extraction
|
|
25
|
-
* @param options.nodeLimit - Maximum number of unique nodes to extract (optional)
|
|
26
|
-
* @param options.keepDanglingRels - Whether to keep relationships whose start/end nodes are missing (default: false)
|
|
27
|
-
*
|
|
28
|
-
* @returns The {@link DeduplicatedNodesAndRels} containing unique nodes and relationships
|
|
29
|
-
*/
|
|
30
|
-
export declare const extractUniqueNodesAndRels: (records: Record[], { nodeLimit, keepDanglingRels, }?: {
|
|
31
|
-
nodeLimit?: number;
|
|
32
|
-
keepDanglingRels?: boolean;
|
|
33
|
-
}) => DeduplicatedNodesAndRels;
|