@neo4j-cypher/query-tools 2.0.0-next.36 → 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.
Files changed (162) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/index.cjs +1848 -0
  3. package/dist/cjs/index.cjs.map +7 -0
  4. package/dist/esm/package.json +9 -8
  5. package/dist/esm/src/connectionErrorHandler.d.ts +1 -2
  6. package/dist/esm/src/connectionErrorHandler.js +1 -1
  7. package/dist/esm/src/connectionErrorHandler.js.map +1 -1
  8. package/dist/esm/src/cypher-execution/extract-unique-nodes-and-relationships.d.ts +1 -1
  9. package/dist/esm/src/cypher-execution/extract-unique-nodes-and-relationships.test.js +0 -4
  10. package/dist/esm/src/cypher-execution/extract-unique-nodes-and-relationships.test.js.map +1 -1
  11. package/dist/esm/src/cypher-execution/query-result.js +2 -9
  12. package/dist/esm/src/cypher-execution/query-result.js.map +1 -1
  13. package/dist/esm/src/data-transforms/record-to-string.js +1 -2
  14. package/dist/esm/src/data-transforms/record-to-string.js.map +1 -1
  15. package/dist/esm/src/integration-tests/pollingIntegrationTests.test.js.map +1 -1
  16. package/dist/esm/src/integration-tests/setupTestContainer.d.ts +1 -1
  17. package/dist/esm/src/integration-tests/setupTestContainer.js +1 -1
  18. package/dist/esm/src/integration-tests/setupTestContainer.js.map +1 -1
  19. package/dist/esm/src/metadataPoller.d.ts +4 -4
  20. package/dist/esm/src/metadataPoller.js +1 -1
  21. package/dist/esm/src/metadataPoller.js.map +1 -1
  22. package/dist/esm/src/neo4jConnection.d.ts +4 -4
  23. package/dist/esm/src/neo4jConnection.js +2 -2
  24. package/dist/esm/src/neo4jConnection.js.map +1 -1
  25. package/dist/esm/src/queries/dataSummary.d.ts +1 -1
  26. package/dist/esm/src/queries/dataSummary.js.map +1 -1
  27. package/dist/esm/src/queries/databases.d.ts +3 -13
  28. package/dist/esm/src/queries/databases.js +2 -5
  29. package/dist/esm/src/queries/databases.js.map +1 -1
  30. package/dist/esm/src/queries/functions.d.ts +1 -3
  31. package/dist/esm/src/queries/functions.js +2 -3
  32. package/dist/esm/src/queries/functions.js.map +1 -1
  33. package/dist/esm/src/queries/graphSchema.d.ts +2 -2
  34. package/dist/esm/src/queries/graphSchema.js +1 -1
  35. package/dist/esm/src/queries/graphSchema.js.map +1 -1
  36. package/dist/esm/src/queries/procedures.d.ts +1 -3
  37. package/dist/esm/src/queries/procedures.js +2 -3
  38. package/dist/esm/src/queries/procedures.js.map +1 -1
  39. package/dist/esm/src/queries/version.d.ts +1 -1
  40. package/dist/esm/src/result-transformers/graph-result-transformer.d.ts +4 -3
  41. package/dist/esm/src/result-transformers/graph-result-transformer.js +2 -2
  42. package/dist/esm/src/result-transformers/graph-result-transformer.js.map +1 -1
  43. package/dist/esm/src/schemaPoller.d.ts +3 -3
  44. package/dist/esm/src/schemaPoller.js.map +1 -1
  45. package/dist/esm/src/types/sdkTypes.d.ts +1 -6
  46. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  47. package/dist/types/src/connectionErrorHandler.d.ts +1 -2
  48. package/dist/types/src/cypher-execution/extract-unique-nodes-and-relationships.d.ts +1 -1
  49. package/dist/types/src/integration-tests/setupTestContainer.d.ts +1 -1
  50. package/dist/types/src/metadataPoller.d.ts +4 -4
  51. package/dist/types/src/neo4jConnection.d.ts +4 -4
  52. package/dist/types/src/queries/dataSummary.d.ts +1 -1
  53. package/dist/types/src/queries/databases.d.ts +3 -13
  54. package/dist/types/src/queries/functions.d.ts +1 -3
  55. package/dist/types/src/queries/graphSchema.d.ts +2 -2
  56. package/dist/types/src/queries/procedures.d.ts +1 -3
  57. package/dist/types/src/queries/version.d.ts +1 -1
  58. package/dist/types/src/result-transformers/graph-result-transformer.d.ts +4 -3
  59. package/dist/types/src/schemaPoller.d.ts +3 -3
  60. package/dist/types/src/types/sdkTypes.d.ts +1 -6
  61. package/dist/types/tsconfig.tsbuildinfo +1 -1
  62. package/package.json +10 -9
  63. package/src/connectionErrorHandler.ts +6 -3
  64. package/src/cypher-execution/extract-unique-nodes-and-relationships.test.ts +0 -4
  65. package/src/cypher-execution/extract-unique-nodes-and-relationships.ts +1 -1
  66. package/src/cypher-execution/query-result.ts +1 -13
  67. package/src/data-transforms/record-to-string.ts +2 -3
  68. package/src/integration-tests/pollingIntegrationTests.test.ts +6 -5
  69. package/src/integration-tests/setupTestContainer.ts +3 -2
  70. package/src/metadataPoller.ts +14 -10
  71. package/src/neo4jConnection.ts +6 -6
  72. package/src/queries/dataSummary.ts +4 -4
  73. package/src/queries/databases.ts +5 -7
  74. package/src/queries/functions.ts +7 -4
  75. package/src/queries/graphSchema.ts +8 -7
  76. package/src/queries/procedures.ts +7 -4
  77. package/src/queries/version.ts +1 -1
  78. package/src/result-transformers/graph-result-transformer.ts +5 -11
  79. package/src/schemaPoller.ts +4 -3
  80. package/src/types/sdkTypes.ts +1 -7
  81. package/tsconfig.json +4 -4
  82. package/tsconfig.node.json +1 -2
  83. package/dist/cjs/package.json +0 -46
  84. package/dist/cjs/src/connectionErrorHandler.d.ts +0 -12
  85. package/dist/cjs/src/connectionErrorHandler.js +0 -41
  86. package/dist/cjs/src/connectionErrorHandler.js.map +0 -1
  87. package/dist/cjs/src/cypher-execution/extract-unique-nodes-and-relationships.d.ts +0 -33
  88. package/dist/cjs/src/cypher-execution/extract-unique-nodes-and-relationships.js +0 -93
  89. package/dist/cjs/src/cypher-execution/extract-unique-nodes-and-relationships.js.map +0 -1
  90. package/dist/cjs/src/cypher-execution/extract-unique-nodes-and-relationships.test.d.ts +0 -1
  91. package/dist/cjs/src/cypher-execution/extract-unique-nodes-and-relationships.test.js +0 -129
  92. package/dist/cjs/src/cypher-execution/extract-unique-nodes-and-relationships.test.js.map +0 -1
  93. package/dist/cjs/src/cypher-execution/query-result.d.ts +0 -11
  94. package/dist/cjs/src/cypher-execution/query-result.js +0 -239
  95. package/dist/cjs/src/cypher-execution/query-result.js.map +0 -1
  96. package/dist/cjs/src/data-transforms/clean-type.d.ts +0 -6
  97. package/dist/cjs/src/data-transforms/clean-type.js +0 -16
  98. package/dist/cjs/src/data-transforms/clean-type.js.map +0 -1
  99. package/dist/cjs/src/data-transforms/cypher-type-names.d.ts +0 -6
  100. package/dist/cjs/src/data-transforms/cypher-type-names.js +0 -91
  101. package/dist/cjs/src/data-transforms/cypher-type-names.js.map +0 -1
  102. package/dist/cjs/src/data-transforms/format-float.d.ts +0 -1
  103. package/dist/cjs/src/data-transforms/format-float.js +0 -14
  104. package/dist/cjs/src/data-transforms/format-float.js.map +0 -1
  105. package/dist/cjs/src/data-transforms/record-to-string.d.ts +0 -8
  106. package/dist/cjs/src/data-transforms/record-to-string.js +0 -185
  107. package/dist/cjs/src/data-transforms/record-to-string.js.map +0 -1
  108. package/dist/cjs/src/index.d.ts +0 -17
  109. package/dist/cjs/src/index.js +0 -33
  110. package/dist/cjs/src/index.js.map +0 -1
  111. package/dist/cjs/src/integration-tests/pollingIntegrationTests.test.d.ts +0 -1
  112. package/dist/cjs/src/integration-tests/pollingIntegrationTests.test.js +0 -42
  113. package/dist/cjs/src/integration-tests/pollingIntegrationTests.test.js.map +0 -1
  114. package/dist/cjs/src/integration-tests/setupTestContainer.d.ts +0 -10
  115. package/dist/cjs/src/integration-tests/setupTestContainer.js +0 -23
  116. package/dist/cjs/src/integration-tests/setupTestContainer.js.map +0 -1
  117. package/dist/cjs/src/metadataPoller.d.ts +0 -34
  118. package/dist/cjs/src/metadataPoller.js +0 -214
  119. package/dist/cjs/src/metadataPoller.js.map +0 -1
  120. package/dist/cjs/src/neo4jConnection.d.ts +0 -36
  121. package/dist/cjs/src/neo4jConnection.js +0 -128
  122. package/dist/cjs/src/neo4jConnection.js.map +0 -1
  123. package/dist/cjs/src/queries/dataSummary.d.ts +0 -7
  124. package/dist/cjs/src/queries/dataSummary.js +0 -33
  125. package/dist/cjs/src/queries/dataSummary.js.map +0 -1
  126. package/dist/cjs/src/queries/databases.d.ts +0 -38
  127. package/dist/cjs/src/queries/databases.js +0 -114
  128. package/dist/cjs/src/queries/databases.js.map +0 -1
  129. package/dist/cjs/src/queries/functions.d.ts +0 -16
  130. package/dist/cjs/src/queries/functions.js +0 -88
  131. package/dist/cjs/src/queries/functions.js.map +0 -1
  132. package/dist/cjs/src/queries/graphSchema.d.ts +0 -28
  133. package/dist/cjs/src/queries/graphSchema.js +0 -88
  134. package/dist/cjs/src/queries/graphSchema.js.map +0 -1
  135. package/dist/cjs/src/queries/procedures.d.ts +0 -16
  136. package/dist/cjs/src/queries/procedures.js +0 -106
  137. package/dist/cjs/src/queries/procedures.js.map +0 -1
  138. package/dist/cjs/src/queries/roles.d.ts +0 -11
  139. package/dist/cjs/src/queries/roles.js +0 -24
  140. package/dist/cjs/src/queries/roles.js.map +0 -1
  141. package/dist/cjs/src/queries/users.d.ts +0 -15
  142. package/dist/cjs/src/queries/users.js +0 -24
  143. package/dist/cjs/src/queries/users.js.map +0 -1
  144. package/dist/cjs/src/queries/version.d.ts +0 -7
  145. package/dist/cjs/src/queries/version.js +0 -32
  146. package/dist/cjs/src/queries/version.js.map +0 -1
  147. package/dist/cjs/src/result-transformers/graph-result-transformer.d.ts +0 -36
  148. package/dist/cjs/src/result-transformers/graph-result-transformer.js +0 -37
  149. package/dist/cjs/src/result-transformers/graph-result-transformer.js.map +0 -1
  150. package/dist/cjs/src/schemaPoller.d.ts +0 -45
  151. package/dist/cjs/src/schemaPoller.js +0 -199
  152. package/dist/cjs/src/schemaPoller.js.map +0 -1
  153. package/dist/cjs/src/types/cypher-data-types.d.ts +0 -41
  154. package/dist/cjs/src/types/cypher-data-types.js +0 -47
  155. package/dist/cjs/src/types/cypher-data-types.js.map +0 -1
  156. package/dist/cjs/src/types/sdkTypes.d.ts +0 -23
  157. package/dist/cjs/src/types/sdkTypes.js +0 -11
  158. package/dist/cjs/src/types/sdkTypes.js.map +0 -1
  159. package/dist/cjs/tsconfig.tsbuildinfo +0 -1
  160. package/dist/cjs/vitest.config.d.mts +0 -2
  161. package/dist/cjs/vitest.config.mjs +0 -10
  162. 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.36",
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
- "main": "./dist/cjs/src/index.js",
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/esm/index.d.ts",
20
- "require": "./dist/cjs/src/index.js",
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/src/index.js"
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.36"
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 --module esnext --outDir dist/esm",
39
- "build-commonjs": "tsc --module commonjs --moduleResolution node --outDir dist/cjs",
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 {dist,tsconfig.tsbuildinfo}",
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: { [key: string]: string } = {
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':
@@ -26,7 +29,7 @@ export function isRetriableNeo4jError(error: unknown): boolean {
26
29
  return isNeo4jError(error) ? error.retriable : true;
27
30
  }
28
31
 
29
- export function isNeo4jError(error: unknown): error is Neo4jError {
32
+ function isNeo4jError(error: unknown): error is Neo4jError {
30
33
  return (
31
34
  error instanceof Error &&
32
35
  (error as Neo4jError).code !== undefined &&
@@ -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 = true,
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 { auth, Driver, driver, Session } from 'neo4j-driver';
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].toObject());
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].toObject()] as GraphSchema[];
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 { Neo4jContainer, StartedNeo4jContainer } from '@testcontainers/neo4j';
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 = { ...(opts.env ?? {}), NEO4J_ACCEPT_LICENSE_AGREEMENT: 'yes' };
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)
@@ -1,19 +1,23 @@
1
- import type { CypherVersion } from '@neo4j-cypher/language-support';
2
- import {
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 { EventEmitter } from 'events';
9
- import { Neo4jConnection } from './neo4jConnection.js';
10
- import { Database, listDatabases } from './queries/databases.js';
11
- import { DataSummary, getDataSummary } from './queries/dataSummary.js';
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 { listRoles, Neo4jRole } from './queries/roles.js';
15
- import { listUsers, Neo4jUser } from './queries/users.js';
16
- import { ExecuteQueryArgs } from './types/sdkTypes.js';
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';
@@ -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 { version } from '../package.json';
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
  },
@@ -1,8 +1,9 @@
1
1
  import type { CypherVersion } from '@neo4j-cypher/language-support';
2
2
  import { resultTransformers } from 'neo4j-driver';
3
- import { ExecuteQueryArgs, DbType } from '../types/sdkTypes.js';
3
+ import type { ExecuteQueryArgs } from '../types/sdkTypes.js';
4
+ import { DbType } from '../types/sdkTypes.js';
4
5
 
5
- export type DatabaseStatus =
6
+ type DatabaseStatus =
6
7
  | 'online'
7
8
  | 'offline'
8
9
  | 'starting'
@@ -111,7 +112,7 @@ export function listDatabases(): ExecuteQueryArgs<{
111
112
  * @input instances - a record of database instances
112
113
  * @output a record of logical databases
113
114
  */
114
- export function getLogicalDatabases(
115
+ function getLogicalDatabases(
115
116
  instances: Record<string, Database>,
116
117
  ): Record<string, Database> {
117
118
  // Two databases with the same name but different properties will be merged into one
@@ -145,10 +146,8 @@ export function getLogicalDatabases(
145
146
  );
146
147
  }
147
148
 
148
- export function sortDatabases(databases: Database[]) {
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 @@ export 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);
@@ -1,5 +1,9 @@
1
- import { CypherVersion, Neo4jFunction } from '@neo4j-cypher/language-support';
2
- import Ajv, { JSONSchemaType } from 'ajv';
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,
@@ -20,7 +24,7 @@ function cleanTypes(result: Neo4jFunction): Neo4jFunction {
20
24
  };
21
25
  }
22
26
 
23
- export const functionSchema: JSONSchemaType<Neo4jFunction> = {
27
+ const functionSchema: JSONSchemaType<Neo4jFunction> = {
24
28
  type: 'object',
25
29
  properties: {
26
30
  aggregating: { type: 'boolean' },
@@ -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,8 +1,9 @@
1
1
  import { resultTransformers } from 'neo4j-driver';
2
- import { ExecuteQueryArgs } from '../types/sdkTypes.js';
3
- import Ajv, { JSONSchemaType } from 'ajv';
2
+ import type { ExecuteQueryArgs } from '../types/sdkTypes.js';
3
+ import type { JSONSchemaType } from 'ajv';
4
+ import { Ajv } from 'ajv';
4
5
 
5
- export type NeoNode = {
6
+ type NeoNode = {
6
7
  labels: string[];
7
8
  elementId: string;
8
9
  };
@@ -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 { CypherVersion, Neo4jProcedure } from '@neo4j-cypher/language-support';
2
- import Ajv, { JSONSchemaType } from 'ajv';
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';
@@ -9,7 +13,7 @@ type ListProcedureArgs = {
9
13
  cypherVersion?: CypherVersion;
10
14
  };
11
15
 
12
- export const procedureSchema: JSONSchemaType<Neo4jProcedure> = {
16
+ const procedureSchema: JSONSchemaType<Neo4jProcedure> = {
13
17
  type: 'object',
14
18
  properties: {
15
19
  admin: { type: 'boolean' },
@@ -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
  },
@@ -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
  /**
5
5
  * Get dbms version
@@ -1,14 +1,8 @@
1
- import {
2
- Integer,
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
- DeduplicatedNodesAndRels,
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
@@ -16,7 +10,7 @@ import {
16
10
  *
17
11
  * See {@link DeduplicatedNodesAndRels} for the type of the nodes and relationships.
18
12
  */
19
- export type GraphResult = DeduplicatedNodesAndRels & {
13
+ type GraphResult = DeduplicatedNodesAndRels & {
20
14
  /** Original Neo4j records returned by the query */
21
15
  records: Record[];
22
16
  summary: ResultSummary<Integer>;
@@ -1,15 +1,16 @@
1
1
  import { EventEmitter } from 'events';
2
- import neo4j, { Config, Driver } from 'neo4j-driver';
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';
@@ -18,13 +18,7 @@ export type QueryType =
18
18
  // Query that has been derived from the user input.
19
19
  | 'user-transpiled';
20
20
 
21
- export type CypherTransactionMetadata = {
22
- app: 'neo4j-sdk';
23
- type: QueryType;
24
- version?: string;
25
- };
26
-
27
- export type ExtendedQueryConfig<T> = QueryConfig<T> &
21
+ type ExtendedQueryConfig<T> = QueryConfig<T> &
28
22
  Required<Pick<QueryConfig<T>, 'routing' | 'resultTransformer'>>;
29
23
 
30
24
  type Result<T> = T & { summary: ResultSummary };
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
- "strict": true,
6
- "module": "esnext",
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
  }
@@ -2,7 +2,6 @@
2
2
  "extends": "../../tsconfig.base.json",
3
3
  "include": ["vitest.config.mts"],
4
4
  "compilerOptions": {
5
- "noEmit": true,
6
- "declaration": false
5
+ "noEmit": true
7
6
  }
8
7
  }
@@ -1,46 +0,0 @@
1
- {
2
- "name": "@neo4j-cypher/query-tools",
3
- "version": "2.0.0-next.36",
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,12 +0,0 @@
1
- import { Neo4jError } from 'neo4j-driver';
2
- export declare const FRIENDLY_ERROR_MESSAGES: {
3
- [key: string]: string;
4
- };
5
- export type ConnectionError = {
6
- message: string;
7
- friendlyMessage: string;
8
- code: string;
9
- };
10
- export declare function isRetriableNeo4jError(error: unknown): boolean;
11
- export declare function isNeo4jError(error: unknown): error is Neo4jError;
12
- export declare function getConnectionError(error: unknown): ConnectionError;