@neo4j-cypher/query-tools 2.0.0-next.38 → 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.
- package/CHANGELOG.md +9 -0
- package/api-extractor/api-report.api.md +340 -0
- package/api-extractor.json +10 -0
- package/checkApiReport.ts +4 -0
- package/dist/cjs/index.cjs +4 -3
- package/dist/cjs/index.cjs.map +2 -2
- package/dist/esm/package.json +4 -3
- package/dist/esm/src/cypher-execution/extract-unique-nodes-and-relationships.d.ts +2 -3
- package/dist/esm/src/cypher-execution/extract-unique-nodes-and-relationships.js +2 -3
- package/dist/esm/src/cypher-execution/extract-unique-nodes-and-relationships.js.map +1 -1
- 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.map +1 -1
- package/dist/esm/src/data-transforms/cypher-type-names.d.ts +1 -2
- package/dist/esm/src/index.d.ts +5 -4
- package/dist/esm/src/index.js +1 -1
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/neo4jConnection.d.ts +2 -3
- package/dist/esm/src/neo4jConnection.js +1 -0
- package/dist/esm/src/neo4jConnection.js.map +1 -1
- package/dist/esm/src/queries/databases.d.ts +1 -2
- package/dist/esm/src/result-transformers/graph-result-transformer.d.ts +3 -4
- package/dist/esm/src/result-transformers/graph-result-transformer.js.map +1 -1
- package/dist/esm/src/{integration-tests → tests/integration}/pollingIntegrationTests.test.js +1 -1
- package/dist/esm/src/tests/integration/pollingIntegrationTests.test.js.map +1 -0
- package/dist/esm/src/tests/integration/setupTestContainer.js.map +1 -0
- package/dist/esm/src/types/cypher-data-types.d.ts +1 -2
- package/dist/esm/src/types/sdkTypes.d.ts +2 -3
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/vitest.config.d.mts +1 -1
- package/dist/esm/vitest.config.mjs +20 -4
- package/dist/esm/vitest.config.mjs.map +1 -1
- package/dist/types/src/cypher-execution/extract-unique-nodes-and-relationships.d.ts +2 -3
- package/dist/types/src/data-transforms/cypher-type-names.d.ts +1 -2
- package/dist/types/src/index.d.ts +5 -4
- package/dist/types/src/neo4jConnection.d.ts +2 -3
- package/dist/types/src/queries/databases.d.ts +1 -2
- package/dist/types/src/result-transformers/graph-result-transformer.d.ts +3 -4
- package/dist/types/src/types/cypher-data-types.d.ts +1 -2
- package/dist/types/src/types/sdkTypes.d.ts +2 -3
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/vitest.config.d.mts +1 -1
- package/package.json +5 -4
- package/src/cypher-execution/extract-unique-nodes-and-relationships.test.ts +5 -5
- package/src/cypher-execution/extract-unique-nodes-and-relationships.ts +2 -3
- package/src/cypher-execution/query-result.ts +1 -0
- package/src/data-transforms/cypher-type-names.ts +1 -1
- package/src/index.ts +17 -3
- package/src/neo4jConnection.ts +3 -2
- package/src/queries/databases.ts +1 -1
- package/src/result-transformers/graph-result-transformer.ts +7 -3
- package/src/{integration-tests → tests/integration}/pollingIntegrationTests.test.ts +2 -2
- package/src/types/cypher-data-types.ts +1 -1
- package/src/types/sdkTypes.ts +2 -2
- package/vitest.config.mts +20 -4
- package/dist/esm/src/integration-tests/pollingIntegrationTests.test.js.map +0 -1
- package/dist/esm/src/integration-tests/setupTestContainer.js.map +0 -1
- /package/dist/esm/src/{integration-tests → tests/integration}/pollingIntegrationTests.test.d.ts +0 -0
- /package/dist/esm/src/{integration-tests → tests/integration}/setupTestContainer.d.ts +0 -0
- /package/dist/esm/src/{integration-tests → tests/integration}/setupTestContainer.js +0 -0
- /package/dist/types/src/{integration-tests → tests/integration}/pollingIntegrationTests.test.d.ts +0 -0
- /package/dist/types/src/{integration-tests → tests/integration}/setupTestContainer.d.ts +0 -0
- /package/src/{integration-tests → tests/integration}/setupTestContainer.ts +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("
|
|
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.
|
|
3
|
+
"version": "2.0.0-next.39",
|
|
4
4
|
"description": "",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/neo4j/cypher-language-support/issues"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"ajv": "^8.12.0",
|
|
28
28
|
"neo4j-driver": "6.0.1",
|
|
29
|
-
"@neo4j-cypher/language-support": "2.0.0-next.
|
|
29
|
+
"@neo4j-cypher/language-support": "2.0.0-next.39"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@testcontainers/neo4j": "^11.5.1"
|
|
@@ -39,9 +39,10 @@
|
|
|
39
39
|
"build-esm": "tsc --outDir dist/esm",
|
|
40
40
|
"build-commonjs": "esbuild ./src/index.ts --bundle --format=cjs --sourcemap --packages=external --outfile=dist/cjs/index.cjs",
|
|
41
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",
|
|
42
44
|
"dev": "concurrently 'npm:build-esm -- --watch' 'npm:build-commonjs -- --watch'",
|
|
43
45
|
"clean": "rm -rf dist tsconfig*.tsbuildinfo",
|
|
44
|
-
"test": "vitest run
|
|
45
|
-
"test:polling": "vitest run pollingIntegrationTests"
|
|
46
|
+
"test": "vitest run"
|
|
46
47
|
}
|
|
47
48
|
}
|
|
@@ -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';
|
|
@@ -39,7 +39,7 @@ describe('extractNodesAndRels', () => {
|
|
|
39
39
|
const boltRecord = {
|
|
40
40
|
keys: ['p'],
|
|
41
41
|
get: () => path,
|
|
42
|
-
} as unknown as
|
|
42
|
+
} as unknown as Neo4jRecord;
|
|
43
43
|
|
|
44
44
|
const { nodes, relationships } = extractUniqueNodesAndRels([boltRecord]);
|
|
45
45
|
|
|
@@ -106,7 +106,7 @@ describe('extractNodesAndRels', () => {
|
|
|
106
106
|
const boltRecord = {
|
|
107
107
|
keys: ['n'],
|
|
108
108
|
get: () => [node1, node2, relationship],
|
|
109
|
-
} as unknown as
|
|
109
|
+
} as unknown as Neo4jRecord;
|
|
110
110
|
|
|
111
111
|
const { nodes, relationships, limitHit } = extractUniqueNodesAndRels([
|
|
112
112
|
boltRecord,
|
|
@@ -149,7 +149,7 @@ describe('extractNodesAndRels', () => {
|
|
|
149
149
|
const boltRecord = {
|
|
150
150
|
keys: ['p'],
|
|
151
151
|
get: () => path,
|
|
152
|
-
} as unknown as
|
|
152
|
+
} as unknown as Neo4jRecord;
|
|
153
153
|
|
|
154
154
|
const { nodes, relationships, limitHit } = extractUniqueNodesAndRels(
|
|
155
155
|
[boltRecord],
|
|
@@ -202,7 +202,7 @@ describe('extractNodesAndRels', () => {
|
|
|
202
202
|
const boltRecord = {
|
|
203
203
|
keys: ['p'],
|
|
204
204
|
get: () => path,
|
|
205
|
-
} as unknown as
|
|
205
|
+
} as unknown as Neo4jRecord;
|
|
206
206
|
|
|
207
207
|
const { nodes, relationships, limitHit } = extractUniqueNodesAndRels(
|
|
208
208
|
[boltRecord],
|
|
@@ -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
|
|
36
|
-
* @param
|
|
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
|
*/
|
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 {
|
|
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 {
|
|
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';
|
package/src/neo4jConnection.ts
CHANGED
|
@@ -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,6 +77,7 @@ export class Neo4jConnection {
|
|
|
77
77
|
} else {
|
|
78
78
|
result = tx.run(query, parameters);
|
|
79
79
|
}
|
|
80
|
+
// oxlint-disable-next-line typescript/no-explicit-any
|
|
80
81
|
const records: Array<any> = [];
|
|
81
82
|
let recordLimitHit = false;
|
|
82
83
|
|
package/src/queries/databases.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
Integer,
|
|
3
|
+
Record as Neo4jRecord,
|
|
4
|
+
ResultSummary,
|
|
5
|
+
} from 'neo4j-driver';
|
|
2
6
|
import { resultTransformers } from 'neo4j-driver';
|
|
3
7
|
|
|
4
8
|
import type { DeduplicatedNodesAndRels } from '../cypher-execution/extract-unique-nodes-and-relationships.js';
|
|
@@ -10,9 +14,9 @@ import { extractUniqueNodesAndRels } from '../cypher-execution/extract-unique-no
|
|
|
10
14
|
*
|
|
11
15
|
* See {@link DeduplicatedNodesAndRels} for the type of the nodes and relationships.
|
|
12
16
|
*/
|
|
13
|
-
type GraphResult = DeduplicatedNodesAndRels & {
|
|
17
|
+
export type GraphResult = DeduplicatedNodesAndRels & {
|
|
14
18
|
/** Original Neo4j records returned by the query */
|
|
15
|
-
records:
|
|
19
|
+
records: Neo4jRecord[];
|
|
16
20
|
summary: ResultSummary<Integer>;
|
|
17
21
|
};
|
|
18
22
|
|
|
@@ -2,11 +2,11 @@ import type { Driver, Session } from 'neo4j-driver';
|
|
|
2
2
|
import { auth, driver } from 'neo4j-driver';
|
|
3
3
|
import { createAndStartTestContainer } from './setupTestContainer.js';
|
|
4
4
|
import type { StartedNeo4jContainer } from '@testcontainers/neo4j';
|
|
5
|
-
import type { GraphSchema } from '
|
|
5
|
+
import type { GraphSchema } from '../../queries/graphSchema.js';
|
|
6
6
|
import {
|
|
7
7
|
extractRelationshipsWithNamedNodes,
|
|
8
8
|
validateGraphSchema,
|
|
9
|
-
} from '
|
|
9
|
+
} from '../../queries/graphSchema.js';
|
|
10
10
|
|
|
11
11
|
describe('Polling integration', () => {
|
|
12
12
|
let session: Session;
|
|
@@ -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
|
package/src/types/sdkTypes.ts
CHANGED
|
@@ -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/vitest.config.mts
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineProject } from 'vitest/config';
|
|
2
2
|
|
|
3
|
-
export default
|
|
3
|
+
export default defineProject({
|
|
4
4
|
test: {
|
|
5
5
|
globals: true,
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
projects: [
|
|
7
|
+
{
|
|
8
|
+
extends: true,
|
|
9
|
+
test: {
|
|
10
|
+
name: 'unit',
|
|
11
|
+
include: ['src/**/*.test.ts'],
|
|
12
|
+
exclude: ['src/tests/integration/**'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
extends: true,
|
|
17
|
+
test: {
|
|
18
|
+
name: 'integration',
|
|
19
|
+
include: ['src/tests/integration/**/*.test.ts'],
|
|
20
|
+
hookTimeout: 90000,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
],
|
|
8
24
|
},
|
|
9
25
|
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pollingIntegrationTests.test.js","sourceRoot":"","sources":["../../../../src/integration-tests/pollingIntegrationTests.test.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAGtE,OAAO,EACL,kCAAkC,EAClC,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AAEnC,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,IAAI,OAAgB,CAAC;IACrB,IAAI,aAAoC,CAAC;IACzC,IAAI,UAAkB,CAAC;IACvB,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,aAAa,GAAG,MAAM,2BAA2B,EAAE,CAAC;QACpD,MAAM,aAAa,GAAG,aAAa,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;QACnE,UAAU,GAAG,MAAM,CACjB,qBAAqB,aAAa,EAAE,EACpC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,CAChC,CAAC;QACF,OAAO,GAAG,UAAU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,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setupTestContainer.js","sourceRoot":"","sources":["../../../../src/integration-tests/setupTestContainer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAQvD,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,OAAsB;IACpB,aAAa,EAAE,2BAA2B;IAC1C,YAAY,EAAE,oBAAoB;CACnC;IAED,MAAM,QAAQ,GAAG,UAAU,CAAC;IAC5B,MAAM,GAAG,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,8BAA8B,EAAE,KAAK,EAAE,CAAC;IAEnE,MAAM,SAAS,GAAG,MAAM,IAAI,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC;SAC1D,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC;SAC5B,QAAQ,EAAE;SACV,YAAY,CAAC,QAAQ,CAAC;SACtB,eAAe,CAAC,GAAG,CAAC;QACrB,4DAA4D;QAC5D,sDAAsD;QACtD,gDAAgD;SAC/C,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC;SAC5B,KAAK,EAAE,CAAC;IAEX,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
/package/dist/esm/src/{integration-tests → tests/integration}/pollingIntegrationTests.test.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/types/src/{integration-tests → tests/integration}/pollingIntegrationTests.test.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|