@neo4j-cypher/query-tools 2.0.0-next.37 → 2.0.0-next.39

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 (187) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/api-extractor/api-report.api.md +340 -0
  3. package/api-extractor.json +10 -0
  4. package/checkApiReport.ts +4 -0
  5. package/dist/cjs/index.cjs +1849 -0
  6. package/dist/cjs/index.cjs.map +7 -0
  7. package/dist/esm/package.json +12 -10
  8. package/dist/esm/src/connectionErrorHandler.d.ts +1 -0
  9. package/dist/esm/src/connectionErrorHandler.js.map +1 -1
  10. package/dist/esm/src/cypher-execution/extract-unique-nodes-and-relationships.d.ts +3 -4
  11. package/dist/esm/src/cypher-execution/extract-unique-nodes-and-relationships.js +2 -3
  12. package/dist/esm/src/cypher-execution/extract-unique-nodes-and-relationships.js.map +1 -1
  13. package/dist/esm/src/cypher-execution/extract-unique-nodes-and-relationships.test.js +0 -4
  14. package/dist/esm/src/cypher-execution/extract-unique-nodes-and-relationships.test.js.map +1 -1
  15. package/dist/esm/src/cypher-execution/query-result.js +2 -9
  16. package/dist/esm/src/cypher-execution/query-result.js.map +1 -1
  17. package/dist/esm/src/data-transforms/cypher-type-names.d.ts +1 -2
  18. package/dist/esm/src/data-transforms/record-to-string.js +1 -2
  19. package/dist/esm/src/data-transforms/record-to-string.js.map +1 -1
  20. package/dist/esm/src/index.d.ts +5 -4
  21. package/dist/esm/src/index.js +1 -1
  22. package/dist/esm/src/index.js.map +1 -1
  23. package/dist/esm/src/metadataPoller.d.ts +4 -4
  24. package/dist/esm/src/metadataPoller.js +1 -1
  25. package/dist/esm/src/metadataPoller.js.map +1 -1
  26. package/dist/esm/src/neo4jConnection.d.ts +6 -7
  27. package/dist/esm/src/neo4jConnection.js +3 -2
  28. package/dist/esm/src/neo4jConnection.js.map +1 -1
  29. package/dist/esm/src/queries/dataSummary.d.ts +1 -1
  30. package/dist/esm/src/queries/dataSummary.js.map +1 -1
  31. package/dist/esm/src/queries/databases.d.ts +2 -3
  32. package/dist/esm/src/queries/databases.js +0 -3
  33. package/dist/esm/src/queries/databases.js.map +1 -1
  34. package/dist/esm/src/queries/functions.d.ts +1 -1
  35. package/dist/esm/src/queries/functions.js +1 -2
  36. package/dist/esm/src/queries/functions.js.map +1 -1
  37. package/dist/esm/src/queries/graphSchema.d.ts +1 -1
  38. package/dist/esm/src/queries/graphSchema.js +1 -1
  39. package/dist/esm/src/queries/graphSchema.js.map +1 -1
  40. package/dist/esm/src/queries/procedures.d.ts +1 -1
  41. package/dist/esm/src/queries/procedures.js +1 -2
  42. package/dist/esm/src/queries/procedures.js.map +1 -1
  43. package/dist/esm/src/queries/version.d.ts +1 -1
  44. package/dist/esm/src/result-transformers/graph-result-transformer.d.ts +4 -5
  45. package/dist/esm/src/result-transformers/graph-result-transformer.js +2 -2
  46. package/dist/esm/src/result-transformers/graph-result-transformer.js.map +1 -1
  47. package/dist/esm/src/schemaPoller.d.ts +3 -3
  48. package/dist/esm/src/schemaPoller.js.map +1 -1
  49. package/dist/esm/src/{integration-tests → tests/integration}/pollingIntegrationTests.test.js +1 -1
  50. package/dist/esm/src/tests/integration/pollingIntegrationTests.test.js.map +1 -0
  51. package/dist/{types/src/integration-tests → esm/src/tests/integration}/setupTestContainer.d.ts +1 -1
  52. package/dist/esm/src/{integration-tests → tests/integration}/setupTestContainer.js +1 -1
  53. package/dist/esm/src/tests/integration/setupTestContainer.js.map +1 -0
  54. package/dist/esm/src/types/cypher-data-types.d.ts +1 -2
  55. package/dist/esm/src/types/sdkTypes.d.ts +2 -3
  56. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  57. package/dist/esm/vitest.config.d.mts +1 -1
  58. package/dist/esm/vitest.config.mjs +20 -4
  59. package/dist/esm/vitest.config.mjs.map +1 -1
  60. package/dist/types/src/connectionErrorHandler.d.ts +1 -0
  61. package/dist/types/src/cypher-execution/extract-unique-nodes-and-relationships.d.ts +3 -4
  62. package/dist/types/src/data-transforms/cypher-type-names.d.ts +1 -2
  63. package/dist/types/src/index.d.ts +5 -4
  64. package/dist/types/src/metadataPoller.d.ts +4 -4
  65. package/dist/types/src/neo4jConnection.d.ts +6 -7
  66. package/dist/types/src/queries/dataSummary.d.ts +1 -1
  67. package/dist/types/src/queries/databases.d.ts +2 -3
  68. package/dist/types/src/queries/functions.d.ts +1 -1
  69. package/dist/types/src/queries/graphSchema.d.ts +1 -1
  70. package/dist/types/src/queries/procedures.d.ts +1 -1
  71. package/dist/types/src/queries/version.d.ts +1 -1
  72. package/dist/types/src/result-transformers/graph-result-transformer.d.ts +4 -5
  73. package/dist/types/src/schemaPoller.d.ts +3 -3
  74. package/dist/{esm/src/integration-tests → types/src/tests/integration}/setupTestContainer.d.ts +1 -1
  75. package/dist/types/src/types/cypher-data-types.d.ts +1 -2
  76. package/dist/types/src/types/sdkTypes.d.ts +2 -3
  77. package/dist/types/tsconfig.tsbuildinfo +1 -1
  78. package/dist/types/vitest.config.d.mts +1 -1
  79. package/package.json +13 -11
  80. package/src/connectionErrorHandler.ts +5 -2
  81. package/src/cypher-execution/extract-unique-nodes-and-relationships.test.ts +5 -9
  82. package/src/cypher-execution/extract-unique-nodes-and-relationships.ts +3 -4
  83. package/src/cypher-execution/query-result.ts +2 -13
  84. package/src/data-transforms/cypher-type-names.ts +1 -1
  85. package/src/data-transforms/record-to-string.ts +2 -3
  86. package/src/index.ts +17 -3
  87. package/src/metadataPoller.ts +14 -10
  88. package/src/neo4jConnection.ts +9 -8
  89. package/src/queries/dataSummary.ts +4 -4
  90. package/src/queries/databases.ts +3 -5
  91. package/src/queries/functions.ts +6 -3
  92. package/src/queries/graphSchema.ts +7 -6
  93. package/src/queries/procedures.ts +6 -3
  94. package/src/queries/version.ts +1 -1
  95. package/src/result-transformers/graph-result-transformer.ts +7 -9
  96. package/src/schemaPoller.ts +4 -3
  97. package/src/{integration-tests → tests/integration}/pollingIntegrationTests.test.ts +7 -6
  98. package/src/{integration-tests → tests/integration}/setupTestContainer.ts +3 -2
  99. package/src/types/cypher-data-types.ts +1 -1
  100. package/src/types/sdkTypes.ts +2 -2
  101. package/tsconfig.json +4 -4
  102. package/tsconfig.node.json +1 -2
  103. package/vitest.config.mts +20 -4
  104. package/dist/cjs/package.json +0 -46
  105. package/dist/cjs/src/connectionErrorHandler.d.ts +0 -10
  106. package/dist/cjs/src/connectionErrorHandler.js +0 -40
  107. package/dist/cjs/src/connectionErrorHandler.js.map +0 -1
  108. package/dist/cjs/src/cypher-execution/extract-unique-nodes-and-relationships.d.ts +0 -33
  109. package/dist/cjs/src/cypher-execution/extract-unique-nodes-and-relationships.js +0 -93
  110. package/dist/cjs/src/cypher-execution/extract-unique-nodes-and-relationships.js.map +0 -1
  111. package/dist/cjs/src/cypher-execution/extract-unique-nodes-and-relationships.test.d.ts +0 -1
  112. package/dist/cjs/src/cypher-execution/extract-unique-nodes-and-relationships.test.js +0 -129
  113. package/dist/cjs/src/cypher-execution/extract-unique-nodes-and-relationships.test.js.map +0 -1
  114. package/dist/cjs/src/cypher-execution/query-result.d.ts +0 -11
  115. package/dist/cjs/src/cypher-execution/query-result.js +0 -239
  116. package/dist/cjs/src/cypher-execution/query-result.js.map +0 -1
  117. package/dist/cjs/src/data-transforms/clean-type.d.ts +0 -6
  118. package/dist/cjs/src/data-transforms/clean-type.js +0 -16
  119. package/dist/cjs/src/data-transforms/clean-type.js.map +0 -1
  120. package/dist/cjs/src/data-transforms/cypher-type-names.d.ts +0 -6
  121. package/dist/cjs/src/data-transforms/cypher-type-names.js +0 -91
  122. package/dist/cjs/src/data-transforms/cypher-type-names.js.map +0 -1
  123. package/dist/cjs/src/data-transforms/format-float.d.ts +0 -1
  124. package/dist/cjs/src/data-transforms/format-float.js +0 -14
  125. package/dist/cjs/src/data-transforms/format-float.js.map +0 -1
  126. package/dist/cjs/src/data-transforms/record-to-string.d.ts +0 -8
  127. package/dist/cjs/src/data-transforms/record-to-string.js +0 -185
  128. package/dist/cjs/src/data-transforms/record-to-string.js.map +0 -1
  129. package/dist/cjs/src/index.d.ts +0 -17
  130. package/dist/cjs/src/index.js +0 -33
  131. package/dist/cjs/src/index.js.map +0 -1
  132. package/dist/cjs/src/integration-tests/pollingIntegrationTests.test.js +0 -42
  133. package/dist/cjs/src/integration-tests/pollingIntegrationTests.test.js.map +0 -1
  134. package/dist/cjs/src/integration-tests/setupTestContainer.d.ts +0 -10
  135. package/dist/cjs/src/integration-tests/setupTestContainer.js +0 -23
  136. package/dist/cjs/src/integration-tests/setupTestContainer.js.map +0 -1
  137. package/dist/cjs/src/metadataPoller.d.ts +0 -34
  138. package/dist/cjs/src/metadataPoller.js +0 -214
  139. package/dist/cjs/src/metadataPoller.js.map +0 -1
  140. package/dist/cjs/src/neo4jConnection.d.ts +0 -36
  141. package/dist/cjs/src/neo4jConnection.js +0 -128
  142. package/dist/cjs/src/neo4jConnection.js.map +0 -1
  143. package/dist/cjs/src/queries/dataSummary.d.ts +0 -7
  144. package/dist/cjs/src/queries/dataSummary.js +0 -33
  145. package/dist/cjs/src/queries/dataSummary.js.map +0 -1
  146. package/dist/cjs/src/queries/databases.d.ts +0 -28
  147. package/dist/cjs/src/queries/databases.js +0 -112
  148. package/dist/cjs/src/queries/databases.js.map +0 -1
  149. package/dist/cjs/src/queries/functions.d.ts +0 -14
  150. package/dist/cjs/src/queries/functions.js +0 -87
  151. package/dist/cjs/src/queries/functions.js.map +0 -1
  152. package/dist/cjs/src/queries/graphSchema.d.ts +0 -28
  153. package/dist/cjs/src/queries/graphSchema.js +0 -88
  154. package/dist/cjs/src/queries/graphSchema.js.map +0 -1
  155. package/dist/cjs/src/queries/procedures.d.ts +0 -14
  156. package/dist/cjs/src/queries/procedures.js +0 -105
  157. package/dist/cjs/src/queries/procedures.js.map +0 -1
  158. package/dist/cjs/src/queries/roles.d.ts +0 -11
  159. package/dist/cjs/src/queries/roles.js +0 -24
  160. package/dist/cjs/src/queries/roles.js.map +0 -1
  161. package/dist/cjs/src/queries/users.d.ts +0 -15
  162. package/dist/cjs/src/queries/users.js +0 -24
  163. package/dist/cjs/src/queries/users.js.map +0 -1
  164. package/dist/cjs/src/queries/version.d.ts +0 -7
  165. package/dist/cjs/src/queries/version.js +0 -32
  166. package/dist/cjs/src/queries/version.js.map +0 -1
  167. package/dist/cjs/src/result-transformers/graph-result-transformer.d.ts +0 -37
  168. package/dist/cjs/src/result-transformers/graph-result-transformer.js +0 -37
  169. package/dist/cjs/src/result-transformers/graph-result-transformer.js.map +0 -1
  170. package/dist/cjs/src/schemaPoller.d.ts +0 -45
  171. package/dist/cjs/src/schemaPoller.js +0 -199
  172. package/dist/cjs/src/schemaPoller.js.map +0 -1
  173. package/dist/cjs/src/types/cypher-data-types.d.ts +0 -41
  174. package/dist/cjs/src/types/cypher-data-types.js +0 -47
  175. package/dist/cjs/src/types/cypher-data-types.js.map +0 -1
  176. package/dist/cjs/src/types/sdkTypes.d.ts +0 -18
  177. package/dist/cjs/src/types/sdkTypes.js +0 -11
  178. package/dist/cjs/src/types/sdkTypes.js.map +0 -1
  179. package/dist/cjs/tsconfig.tsbuildinfo +0 -1
  180. package/dist/cjs/vitest.config.d.mts +0 -2
  181. package/dist/cjs/vitest.config.mjs +0 -10
  182. package/dist/cjs/vitest.config.mjs.map +0 -1
  183. package/dist/esm/src/integration-tests/pollingIntegrationTests.test.js.map +0 -1
  184. package/dist/esm/src/integration-tests/setupTestContainer.js.map +0 -1
  185. package/dist/types/src/integration-tests/pollingIntegrationTests.test.d.ts +0 -1
  186. /package/dist/{cjs/src/integration-tests → esm/src/tests/integration}/pollingIntegrationTests.test.d.ts +0 -0
  187. /package/dist/{esm/src/integration-tests → types/src/tests/integration}/pollingIntegrationTests.test.d.ts +0 -0
@@ -1,2 +1,2 @@
1
- declare const _default: import("vite").UserConfig;
1
+ declare const _default: import("vitest/config").UserWorkspaceConfig;
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-cypher/query-tools",
3
- "version": "2.0.0-next.37",
3
+ "version": "2.0.0-next.39",
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.37"
29
+ "@neo4j-cypher/language-support": "2.0.0-next.39"
29
30
  },
30
31
  "devDependencies": {
31
32
  "@testcontainers/neo4j": "^11.5.1"
@@ -35,12 +36,13 @@
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",
42
+ "check-api-report": "tsx checkApiReport.ts",
43
+ "gen-api-report": "pnpm build-types && pnpm check-api-report",
41
44
  "dev": "concurrently 'npm:build-esm -- --watch' 'npm:build-commonjs -- --watch'",
42
- "clean": "rm -rf {dist,tsconfig.tsbuildinfo}",
43
- "test": "vitest run extract-unique-nodes-and-relationships",
44
- "test:polling": "vitest run pollingIntegrationTests"
45
+ "clean": "rm -rf dist tsconfig*.tsbuildinfo",
46
+ "test": "vitest run"
45
47
  }
46
48
  }
@@ -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':
@@ -1,4 +1,4 @@
1
- import type { Record } from 'neo4j-driver';
1
+ import type { Record as Neo4jRecord } from 'neo4j-driver';
2
2
  import { Node, Path, PathSegment, Relationship } from 'neo4j-driver';
3
3
 
4
4
  import { describe, expect, test } from 'vitest';
@@ -36,11 +36,10 @@ 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,
43
- } as unknown as Record;
42
+ } as unknown as Neo4jRecord;
44
43
 
45
44
  const { nodes, relationships } = extractUniqueNodesAndRels([boltRecord]);
46
45
 
@@ -104,11 +103,10 @@ 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],
111
- } as unknown as Record;
109
+ } as unknown as Neo4jRecord;
112
110
 
113
111
  const { nodes, relationships, limitHit } = extractUniqueNodesAndRels([
114
112
  boltRecord,
@@ -148,11 +146,10 @@ 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,
155
- } as unknown as Record;
152
+ } as unknown as Neo4jRecord;
156
153
 
157
154
  const { nodes, relationships, limitHit } = extractUniqueNodesAndRels(
158
155
  [boltRecord],
@@ -202,11 +199,10 @@ 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,
209
- } as unknown as Record;
205
+ } as unknown as Neo4jRecord;
210
206
 
211
207
  const { nodes, relationships, limitHit } = extractUniqueNodesAndRels(
212
208
  [boltRecord],
@@ -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
 
@@ -32,9 +32,8 @@ export type DeduplicatedNodesAndRels = {
32
32
  * nested objects.
33
33
  *
34
34
  * @param records - Array of Neo4j records to process
35
- * @param options - Configuration options for extraction
36
- * @param options.nodeLimit - Maximum number of unique nodes to extract (optional)
37
- * @param options.keepDanglingRels - Whether to keep relationships whose start/end nodes are missing (default: false)
35
+ * @param nodeLimit - Configuration option: Maximum number of unique nodes to extract (optional)
36
+ * @param keepDanglingRels - Configuration option: Whether to keep relationships whose start/end nodes are missing (default: false)
38
37
  *
39
38
  * @returns The {@link DeduplicatedNodesAndRels} containing unique nodes and relationships
40
39
  */
@@ -1,3 +1,4 @@
1
+ // oxlint-disable typescript/no-explicit-any
1
2
  import type { QueryResult, Record as Neo4jRecord } from 'neo4j-driver';
2
3
  import { int, isInt, isVector, types, Vector } from 'neo4j-driver';
3
4
 
@@ -28,7 +29,6 @@ export type Neo4jType =
28
29
 
29
30
  export function addAnnotationProp(
30
31
  obj: Record<string, unknown>,
31
- // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
32
32
  type: string | unknown,
33
33
  prop: string = RESERVED_TYPE_PROPERTY_NAME,
34
34
  ): Record<string, unknown> {
@@ -73,14 +73,11 @@ function copyAndAnnotate(
73
73
  obj: Exclude<Neo4jType | QueryResult, undefined | null | Neo4jType[]>,
74
74
  ): Record<string, unknown> {
75
75
  return Object.keys(obj).reduce<Record<string, unknown>>((newObj, key) => {
76
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
77
76
  // @ts-ignore TypeScript complains about not being able to use `key` to
78
77
  // index `obj`, but we know that `key` exists in `obj` since it's coming
79
78
  // from Object.keys.
80
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
81
79
  const value = obj[key] as unknown as Neo4jType;
82
80
 
83
- // eslint-disable-next-line @typescript-eslint/no-use-before-define
84
81
  newObj[key] = serializeTypeAnnotations(value);
85
82
  return newObj;
86
83
  }, {});
@@ -99,11 +96,11 @@ export function serializeTypeAnnotations(
99
96
  return item.map((i) => serializeTypeAnnotations(i));
100
97
  }
101
98
  if (item === null || item === undefined) {
99
+ // This is needed due to the method overloading types
102
100
  return item;
103
101
  }
104
102
 
105
103
  if (item instanceof types.Record) {
106
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
107
104
  // @ts-ignore There are two versions of the type for Record coming from the
108
105
  // driver.
109
106
  const tmp = copyAndAnnotate(item);
@@ -181,17 +178,10 @@ export function serializeTypeAnnotations(
181
178
  return addAnnotationProp(tmp, 'Object');
182
179
  }
183
180
 
184
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
185
181
  // @ts-ignore this type isn't inferred correctly
186
182
  return item;
187
183
  }
188
184
 
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
185
  export function deserializeTypeAnnotations(
196
186
  rawItem: Record<string, unknown>,
197
187
  ): QueryResult | Neo4jRecord;
@@ -369,7 +359,6 @@ export function deserializeTypeAnnotations(
369
359
  break;
370
360
  case 'INT64':
371
361
  // For INT64, values are stored as strings to avoid BigInt serialization issues
372
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call
373
362
  typedArray = new BigInt64Array(values.map((v: any) => BigInt(v)));
374
363
  break;
375
364
  case 'FLOAT32':
@@ -22,7 +22,7 @@ import {
22
22
  isInt8Array,
23
23
  } from '../types/cypher-data-types.js';
24
24
 
25
- type CypherPropertyName =
25
+ export type CypherPropertyName =
26
26
  | 'Float'
27
27
  | 'null'
28
28
  | 'String'
@@ -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(
package/src/index.ts CHANGED
@@ -7,7 +7,10 @@ export {
7
7
  getCypherTypeName,
8
8
  getPropertyTypeDisplayName,
9
9
  } from './data-transforms/cypher-type-names.js';
10
- export type { CypherDataTypeName } from './data-transforms/cypher-type-names.js';
10
+ export type {
11
+ CypherDataTypeName,
12
+ CypherPropertyName,
13
+ } from './data-transforms/cypher-type-names.js';
11
14
  export * from './data-transforms/record-to-string.js';
12
15
  export * from './types/cypher-data-types.js';
13
16
  export type {
@@ -18,10 +21,21 @@ export type {
18
21
  export type {
19
22
  Neo4jConnection,
20
23
  QueryResultWithLimit,
24
+ RunCypherQueryArgs,
25
+ SdkQueryArgs,
21
26
  } from './neo4jConnection.js';
22
- export type { Database } from './queries/databases.js';
23
- export { graphResultTransformer } from './result-transformers/graph-result-transformer.js';
27
+ export type { Database, DatabaseStatus } from './queries/databases.js';
28
+ export {
29
+ graphResultTransformer,
30
+ GraphResult,
31
+ } from './result-transformers/graph-result-transformer.js';
24
32
  export { Neo4jSchemaPoller } from './schemaPoller.js';
25
33
  export type { ConnnectionResult } from './schemaPoller.js';
26
34
  export type { CypherDataType } from './types/cypher-data-types.js';
27
35
  export { getVersion } from './queries/version.js';
36
+ export {
37
+ ExecuteQueryArgs,
38
+ QueryType,
39
+ ExtendedQueryConfig,
40
+ Result,
41
+ } from './types/sdkTypes.js';
@@ -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
 
@@ -33,12 +33,12 @@ function resolveInitialDatabase(
33
33
  return home?.name ?? def?.name ?? system?.name ?? databases[0]?.name;
34
34
  }
35
35
 
36
- type SdkQueryArgs = {
36
+ export type SdkQueryArgs = {
37
37
  queryType: QueryType;
38
38
  abortSignal?: AbortSignal;
39
39
  };
40
40
 
41
- type RunCypherQueryArgs = {
41
+ export type RunCypherQueryArgs = {
42
42
  query: string;
43
43
  parameters: Record<string, unknown>;
44
44
  database?: string;
@@ -77,7 +77,8 @@ export class Neo4jConnection {
77
77
  } else {
78
78
  result = tx.run(query, parameters);
79
79
  }
80
- const records = [];
80
+ // oxlint-disable-next-line typescript/no-explicit-any
81
+ const records: Array<any> = [];
81
82
  let recordLimitHit = false;
82
83
 
83
84
  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
- type DatabaseStatus =
6
+ export type DatabaseStatus =
6
7
  | 'online'
7
8
  | 'offline'
8
9
  | 'starting'
@@ -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);
@@ -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,
@@ -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 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
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 { 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';
@@ -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,12 @@
1
- import {
1
+ import type {
2
2
  Integer,
3
- Record,
3
+ Record as Neo4jRecord,
4
4
  ResultSummary,
5
- resultTransformers,
6
5
  } from 'neo4j-driver';
6
+ import { resultTransformers } from 'neo4j-driver';
7
7
 
8
- import {
9
- DeduplicatedNodesAndRels,
10
- extractUniqueNodesAndRels,
11
- } from '../cypher-execution/extract-unique-nodes-and-relationships.js';
8
+ import type { DeduplicatedNodesAndRels } from '../cypher-execution/extract-unique-nodes-and-relationships.js';
9
+ import { extractUniqueNodesAndRels } from '../cypher-execution/extract-unique-nodes-and-relationships.js';
12
10
 
13
11
  /**
14
12
  * Result type for graph queries that includes deduplicated nodes and relationships
@@ -16,9 +14,9 @@ import {
16
14
  *
17
15
  * See {@link DeduplicatedNodesAndRels} for the type of the nodes and relationships.
18
16
  */
19
- type GraphResult = DeduplicatedNodesAndRels & {
17
+ export type GraphResult = DeduplicatedNodesAndRels & {
20
18
  /** Original Neo4j records returned by the query */
21
- records: Record[];
19
+ records: Neo4jRecord[];
22
20
  summary: ResultSummary<Integer>;
23
21
  };
24
22
 
@@ -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';
@@ -1,11 +1,12 @@
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
- } from '../queries/graphSchema.js';
9
+ } from '../../queries/graphSchema.js';
9
10
 
10
11
  describe('Polling integration', () => {
11
12
  let session: Session;
@@ -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)
@@ -23,7 +23,7 @@ import {
23
23
  isTime,
24
24
  isVector,
25
25
  } from 'neo4j-driver';
26
- type NumberOrInteger = number | Integer | bigint;
26
+ export type NumberOrInteger = number | Integer | bigint;
27
27
 
28
28
  /**
29
29
  The neo4j driver type mapping - https://neo4j.com/docs/javascript-manual/current/cypher-workflow/#js-driver-type-mapping
@@ -18,10 +18,10 @@ export type QueryType =
18
18
  // Query that has been derived from the user input.
19
19
  | 'user-transpiled';
20
20
 
21
- type ExtendedQueryConfig<T> = QueryConfig<T> &
21
+ export type ExtendedQueryConfig<T> = QueryConfig<T> &
22
22
  Required<Pick<QueryConfig<T>, 'routing' | 'resultTransformer'>>;
23
23
 
24
- type Result<T> = T & { summary: ResultSummary };
24
+ export type Result<T> = T & { summary: ResultSummary };
25
25
 
26
26
  export type ExecuteQueryArgs<T> = {
27
27
  query: string;
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
  }