@neo4j-labs/experimental-query-api-wrapper 0.0.1-alpha01
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/.github/workflows/ci.yml +19 -0
- package/LICENSE +201 -0
- package/README.adoc +24 -0
- package/example/index.js +36 -0
- package/example/package.json +15 -0
- package/jest.config.ts +196 -0
- package/lib/http-connection/connection-provider.http.js +127 -0
- package/lib/http-connection/connection.http.js +214 -0
- package/lib/http-connection/index.js +24 -0
- package/lib/http-connection/query.codec.js +602 -0
- package/lib/http-connection/stream-observers.js +141 -0
- package/lib/index.js +279 -0
- package/lib/logging.js +20 -0
- package/lib/types.js +2 -0
- package/lib/wrapper-session.impl.js +21 -0
- package/lib/wrapper.impl.js +34 -0
- package/package.json +44 -0
- package/tsconfig.build.json +6 -0
- package/tsconfig.json +20 -0
- package/types/http-connection/connection-provider.http.d.ts +50 -0
- package/types/http-connection/connection.http.d.ts +45 -0
- package/types/http-connection/index.d.ts +18 -0
- package/types/http-connection/query.codec.d.ts +152 -0
- package/types/http-connection/stream-observers.d.ts +51 -0
- package/types/index.d.ts +247 -0
- package/types/logging.d.ts +14 -0
- package/types/types.d.ts +35 -0
- package/types/wrapper-session.impl.d.ts +27 -0
- package/types/wrapper.impl.d.ts +28 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) "Neo4j"
|
|
3
|
+
* Neo4j Sweden AB [https://neo4j.com]
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import HttpConnectionProvider from "./connection-provider.http";
|
|
18
|
+
export { HttpConnectionProvider };
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) "Neo4j"
|
|
3
|
+
* Neo4j Sweden AB [https://neo4j.com]
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { Node, Relationship, types, Integer, Time, Date, LocalTime, Point, DateTime, LocalDateTime, Duration, Path } from "neo4j-driver-core";
|
|
18
|
+
import { RunQueryConfig } from "neo4j-driver-core/types/connection";
|
|
19
|
+
type RawQueryValueTypes = 'Null' | 'Boolean' | 'Integer' | 'Float' | 'String' | 'Time' | 'Date' | 'LocalTime' | 'ZonedDateTime' | 'OffsetDateTime' | 'LocalDateTime' | 'Duration' | 'Point' | 'Base64' | 'Map' | 'List' | 'Node' | 'Relationship' | 'Path';
|
|
20
|
+
type PointShape = {
|
|
21
|
+
srid: number;
|
|
22
|
+
x: string;
|
|
23
|
+
y: string;
|
|
24
|
+
z?: string;
|
|
25
|
+
};
|
|
26
|
+
type NodeShape = {
|
|
27
|
+
_element_id: string;
|
|
28
|
+
_labels: string[];
|
|
29
|
+
_properties?: Record<string, RawQueryValue>;
|
|
30
|
+
};
|
|
31
|
+
type RelationshipShape = {
|
|
32
|
+
_element_id: string;
|
|
33
|
+
_start_node_element_id: string;
|
|
34
|
+
_end_node_element_id: string;
|
|
35
|
+
_type: string;
|
|
36
|
+
_properties?: Record<string, RawQueryValue>;
|
|
37
|
+
};
|
|
38
|
+
type PathShape = (RawQueryRelationship | RawQueryNode)[];
|
|
39
|
+
type RawQueryValueDef<T extends RawQueryValueTypes, V extends unknown> = {
|
|
40
|
+
$type: T;
|
|
41
|
+
_value: V;
|
|
42
|
+
};
|
|
43
|
+
type RawQueryNull = RawQueryValueDef<'Null', null>;
|
|
44
|
+
type RawQueryBoolean = RawQueryValueDef<'Boolean', boolean>;
|
|
45
|
+
type RawQueryInteger = RawQueryValueDef<'Integer', string>;
|
|
46
|
+
type RawQueryFloat = RawQueryValueDef<'Float', string>;
|
|
47
|
+
type RawQueryString = RawQueryValueDef<'String', string>;
|
|
48
|
+
type RawQueryTime = RawQueryValueDef<'Time', string>;
|
|
49
|
+
type RawQueryDate = RawQueryValueDef<'Date', string>;
|
|
50
|
+
type RawQueryLocalTime = RawQueryValueDef<'LocalTime', string>;
|
|
51
|
+
type RawQueryZonedDateTime = RawQueryValueDef<'ZonedDateTime', string>;
|
|
52
|
+
type RawQueryOffsetDateTime = RawQueryValueDef<'OffsetDateTime', string>;
|
|
53
|
+
type RawQueryLocalDateTime = RawQueryValueDef<'LocalDateTime', string>;
|
|
54
|
+
type RawQueryDuration = RawQueryValueDef<'Duration', string>;
|
|
55
|
+
type RawQueryPoint = RawQueryValueDef<'Point', PointShape>;
|
|
56
|
+
type RawQueryBinary = RawQueryValueDef<'Base64', string>;
|
|
57
|
+
interface RawQueryMap extends RawQueryValueDef<'Map', Record<string, RawQueryValue>> {
|
|
58
|
+
}
|
|
59
|
+
interface RawQueryList extends RawQueryValueDef<'List', RawQueryValue[]> {
|
|
60
|
+
}
|
|
61
|
+
type RawQueryNode = RawQueryValueDef<'Node', NodeShape>;
|
|
62
|
+
type RawQueryRelationship = RawQueryValueDef<'Relationship', RelationshipShape>;
|
|
63
|
+
type RawQueryPath = RawQueryValueDef<'Path', PathShape>;
|
|
64
|
+
type RawQueryValue = RawQueryNull | RawQueryBoolean | RawQueryInteger | RawQueryFloat | RawQueryString | RawQueryTime | RawQueryDate | RawQueryLocalTime | RawQueryZonedDateTime | RawQueryOffsetDateTime | RawQueryLocalDateTime | RawQueryDuration | RawQueryPoint | RawQueryBinary | RawQueryMap | RawQueryList | RawQueryNode | RawQueryRelationship | RawQueryPath;
|
|
65
|
+
type Counters = {
|
|
66
|
+
containsUpdates: boolean;
|
|
67
|
+
nodesCreated: number;
|
|
68
|
+
nodesDeleted: number;
|
|
69
|
+
propertiesSet: number;
|
|
70
|
+
relationshipsCreated: number;
|
|
71
|
+
relationshipsDeleted: number;
|
|
72
|
+
labelsAdded: number;
|
|
73
|
+
labelsRemoved: number;
|
|
74
|
+
indexesAdded: number;
|
|
75
|
+
indexesRemoved: number;
|
|
76
|
+
constraintsAdded: number;
|
|
77
|
+
constraintsRemoved: number;
|
|
78
|
+
containsSystemUpdates: boolean;
|
|
79
|
+
systemUpdates: number;
|
|
80
|
+
};
|
|
81
|
+
type ProfiledQueryPlan = {
|
|
82
|
+
dbHits: number;
|
|
83
|
+
records: number;
|
|
84
|
+
hasPageCacheStats: boolean;
|
|
85
|
+
pageCacheHits: number;
|
|
86
|
+
pageCacheMisses: number;
|
|
87
|
+
pageCacheHitRatio: number;
|
|
88
|
+
time: number;
|
|
89
|
+
operatorType: string;
|
|
90
|
+
arguments: Record<string, unknown>;
|
|
91
|
+
identifiers: string[];
|
|
92
|
+
children: ProfiledQueryPlan[];
|
|
93
|
+
};
|
|
94
|
+
type RawQueryData = {
|
|
95
|
+
fields: string[];
|
|
96
|
+
values: RawQueryValue[];
|
|
97
|
+
};
|
|
98
|
+
export type RawQueryResponse = {
|
|
99
|
+
data: RawQueryData;
|
|
100
|
+
counters: Counters;
|
|
101
|
+
bookmarks: string[];
|
|
102
|
+
profiledQueryPlan?: ProfiledQueryPlan;
|
|
103
|
+
errors?: [];
|
|
104
|
+
notifications?: unknown[];
|
|
105
|
+
[str: string]: unknown;
|
|
106
|
+
};
|
|
107
|
+
export declare class QueryResponseCodec {
|
|
108
|
+
private _config;
|
|
109
|
+
private _contentType;
|
|
110
|
+
private _rawQueryResponse;
|
|
111
|
+
constructor(_config: types.InternalConfig, _contentType: string, _rawQueryResponse: RawQueryResponse);
|
|
112
|
+
get hasError(): boolean;
|
|
113
|
+
get error(): Error;
|
|
114
|
+
get keys(): string[];
|
|
115
|
+
stream(): Generator<any[]>;
|
|
116
|
+
get meta(): Record<string, unknown>;
|
|
117
|
+
private _decodeStats;
|
|
118
|
+
private _decodeProfile;
|
|
119
|
+
private _decodeValue;
|
|
120
|
+
_decodeInteger(value: string): Integer | number | bigint;
|
|
121
|
+
_decodeFloat(value: string): number;
|
|
122
|
+
_decodeTime(value: string): Time<Integer | bigint | number>;
|
|
123
|
+
_decodeDate(value: string): Date<Integer | bigint | number>;
|
|
124
|
+
_decodeLocalTime(value: string): LocalTime<Integer | bigint | number>;
|
|
125
|
+
_decodeZonedDateTime(value: string): DateTime<Integer | bigint | number>;
|
|
126
|
+
_decodeOffsetDateTime(value: string): DateTime<Integer | bigint | number>;
|
|
127
|
+
_decodeLocalDateTime(value: string): LocalDateTime<Integer | bigint | number>;
|
|
128
|
+
_decodeDuration(value: string): Duration<Integer | bigint | number>;
|
|
129
|
+
_decodeMap(value: Record<string, RawQueryValue>): Record<string, unknown>;
|
|
130
|
+
_decodePoint(value: PointShape): Point<Integer | bigint | number>;
|
|
131
|
+
_decodeBase64(value: string): Uint8Array;
|
|
132
|
+
_decodeList(value: RawQueryValue[]): unknown[];
|
|
133
|
+
_decodeNode(value: NodeShape): Node<bigint | number | Integer>;
|
|
134
|
+
_decodeRelationship(value: RelationshipShape): Relationship<bigint | number | Integer>;
|
|
135
|
+
_decodePath(value: PathShape): Path<bigint | number | Integer>;
|
|
136
|
+
_normalizeInteger(integer: Integer): Integer | number | bigint;
|
|
137
|
+
}
|
|
138
|
+
export declare class QueryRequestCodec {
|
|
139
|
+
private _auth;
|
|
140
|
+
private _query;
|
|
141
|
+
private _parameters?;
|
|
142
|
+
private _config?;
|
|
143
|
+
private _body?;
|
|
144
|
+
constructor(_auth: types.AuthToken, _query: string, _parameters?: Record<string, unknown> | undefined, _config?: RunQueryConfig | undefined);
|
|
145
|
+
get contentType(): string;
|
|
146
|
+
get accept(): string;
|
|
147
|
+
get authorization(): string;
|
|
148
|
+
get body(): Record<string, unknown>;
|
|
149
|
+
_encodeParameters(parameters: Record<string, unknown>): Record<string, RawQueryValue>;
|
|
150
|
+
_encodeValue(value: unknown): RawQueryValue;
|
|
151
|
+
}
|
|
152
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) "Neo4j"
|
|
3
|
+
* Neo4j Sweden AB [https://neo4j.com]
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { ResultObserver, internal } from "neo4j-driver-core";
|
|
18
|
+
export interface ResultStreamObserverConfig {
|
|
19
|
+
highRecordWatermark: number;
|
|
20
|
+
lowRecordWatermark: number;
|
|
21
|
+
beforeError?: (error: Error) => void;
|
|
22
|
+
afterComplete?: (metadata: unknown) => void;
|
|
23
|
+
server: internal.serverAddress.ServerAddress;
|
|
24
|
+
}
|
|
25
|
+
export declare class ResultStreamObserver implements internal.observer.ResultStreamObserver {
|
|
26
|
+
private _paused;
|
|
27
|
+
private _queuedRecords;
|
|
28
|
+
private _completed;
|
|
29
|
+
private _keys;
|
|
30
|
+
private _highRecordWatermark;
|
|
31
|
+
private _lowRecordWatermark;
|
|
32
|
+
private _resultObservers;
|
|
33
|
+
private _metadata?;
|
|
34
|
+
private _error?;
|
|
35
|
+
private _beforeError?;
|
|
36
|
+
private _afterComplete?;
|
|
37
|
+
private _server;
|
|
38
|
+
constructor(config: ResultStreamObserverConfig);
|
|
39
|
+
get completed(): boolean;
|
|
40
|
+
get paused(): boolean;
|
|
41
|
+
cancel(): void;
|
|
42
|
+
pause(): void;
|
|
43
|
+
resume(): void;
|
|
44
|
+
prepareToHandleSingleResponse: () => void;
|
|
45
|
+
markCompleted(): void;
|
|
46
|
+
subscribe(observer: ResultObserver): void;
|
|
47
|
+
onKeys(keys: any[]): void;
|
|
48
|
+
onNext(rawRecord: any[]): void;
|
|
49
|
+
onError(error: Error): void;
|
|
50
|
+
onCompleted(meta: any): void;
|
|
51
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) "Neo4j"
|
|
3
|
+
* Neo4j Sweden AB [https://neo4j.com]
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { auth, BookmarkManager, bookmarkManager, BookmarkManagerConfig, authTokenManagers, AuthTokenManager, AuthTokenManagers, AuthTokenAndExpiration, Connection, ConnectionProvider, Date, DateTime, Driver, Duration, error, int, Integer, internal, isDate, isDateTime, isDuration, isInt, isLocalDateTime, isLocalTime, isNode, isPath, isPathSegment, isPoint, isRelationship, isRetriableError, isTime, isUnboundRelationship, LocalDateTime, LocalTime, Neo4jError, Node, Notification, notificationCategory, NotificationCategory, NotificationPosition, notificationSeverityLevel, NotificationSeverityLevel, Path, PathSegment, Plan, Point, ProfiledPlan, QueryConfig, QueryResult, QueryStatistics, Record, RecordShape, Relationship, Result, ResultObserver, ResultSummary, ResultTransformer, resultTransformers, ServerInfo, Session, SessionConfig, Time, types as coreTypes, UnboundRelationship } from 'neo4j-driver-core';
|
|
18
|
+
import { logging } from './logging';
|
|
19
|
+
import { HttpUrl, Wrapper, WrapperSession, WrapperConfig, WrapperSessionConfig } from './types';
|
|
20
|
+
type AuthToken = coreTypes.AuthToken;
|
|
21
|
+
type Config = coreTypes.Config;
|
|
22
|
+
type TrustStrategy = coreTypes.TrustStrategy;
|
|
23
|
+
type EncryptionLevel = coreTypes.EncryptionLevel;
|
|
24
|
+
type SessionMode = coreTypes.SessionMode;
|
|
25
|
+
type Logger = internal.logger.Logger;
|
|
26
|
+
declare function wrapper(url: HttpUrl | string, authToken: AuthToken, config?: Config): Wrapper;
|
|
27
|
+
/**
|
|
28
|
+
* Object containing constructors for all neo4j types.
|
|
29
|
+
*/
|
|
30
|
+
declare const types: {
|
|
31
|
+
Node: typeof Node;
|
|
32
|
+
Relationship: typeof Relationship;
|
|
33
|
+
UnboundRelationship: typeof UnboundRelationship;
|
|
34
|
+
PathSegment: typeof PathSegment;
|
|
35
|
+
Path: typeof Path;
|
|
36
|
+
Result: typeof Result;
|
|
37
|
+
ResultSummary: typeof ResultSummary;
|
|
38
|
+
Record: typeof Record;
|
|
39
|
+
Point: typeof Point;
|
|
40
|
+
Date: typeof Date;
|
|
41
|
+
DateTime: typeof DateTime;
|
|
42
|
+
Duration: typeof Duration;
|
|
43
|
+
LocalDateTime: typeof LocalDateTime;
|
|
44
|
+
LocalTime: typeof LocalTime;
|
|
45
|
+
Time: typeof Time;
|
|
46
|
+
Integer: typeof Integer;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Object containing string constants representing session access modes.
|
|
50
|
+
*/
|
|
51
|
+
declare const session: {
|
|
52
|
+
READ: coreTypes.SessionMode;
|
|
53
|
+
WRITE: coreTypes.SessionMode;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Object containing functions to work with {@link Integer} objects.
|
|
57
|
+
*/
|
|
58
|
+
declare const integer: {
|
|
59
|
+
toNumber: typeof Integer.toNumber;
|
|
60
|
+
toString: typeof Integer.toString;
|
|
61
|
+
inSafeRange: typeof Integer.inSafeRange;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Object containing functions to work with spatial types, like {@link Point}.
|
|
65
|
+
*/
|
|
66
|
+
declare const spatial: {
|
|
67
|
+
isPoint: typeof isPoint;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Object containing functions to work with temporal types, like {@link Time} or {@link Duration}.
|
|
71
|
+
*/
|
|
72
|
+
declare const temporal: {
|
|
73
|
+
isDuration: typeof isDuration;
|
|
74
|
+
isLocalTime: typeof isLocalTime;
|
|
75
|
+
isTime: typeof isTime;
|
|
76
|
+
isDate: typeof isDate;
|
|
77
|
+
isLocalDateTime: typeof isLocalDateTime;
|
|
78
|
+
isDateTime: typeof isDateTime;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Object containing functions to work with graph types, like {@link Node} or {@link Relationship}.
|
|
82
|
+
*/
|
|
83
|
+
declare const graph: {
|
|
84
|
+
isNode: typeof isNode;
|
|
85
|
+
isPath: typeof isPath;
|
|
86
|
+
isPathSegment: typeof isPathSegment;
|
|
87
|
+
isRelationship: typeof isRelationship;
|
|
88
|
+
isUnboundRelationship: typeof isUnboundRelationship;
|
|
89
|
+
};
|
|
90
|
+
declare const forExport: {
|
|
91
|
+
authTokenManagers: AuthTokenManagers;
|
|
92
|
+
int: typeof Integer.fromValue;
|
|
93
|
+
isInt: typeof Integer.isInteger;
|
|
94
|
+
isPoint: typeof isPoint;
|
|
95
|
+
isDuration: typeof isDuration;
|
|
96
|
+
isLocalTime: typeof isLocalTime;
|
|
97
|
+
isTime: typeof isTime;
|
|
98
|
+
isDate: typeof isDate;
|
|
99
|
+
isLocalDateTime: typeof isLocalDateTime;
|
|
100
|
+
isDateTime: typeof isDateTime;
|
|
101
|
+
isNode: typeof isNode;
|
|
102
|
+
isPath: typeof isPath;
|
|
103
|
+
isPathSegment: typeof isPathSegment;
|
|
104
|
+
isRelationship: typeof isRelationship;
|
|
105
|
+
isUnboundRelationship: typeof isUnboundRelationship;
|
|
106
|
+
integer: {
|
|
107
|
+
toNumber: typeof Integer.toNumber;
|
|
108
|
+
toString: typeof Integer.toString;
|
|
109
|
+
inSafeRange: typeof Integer.inSafeRange;
|
|
110
|
+
};
|
|
111
|
+
Neo4jError: typeof Neo4jError;
|
|
112
|
+
isRetriableError: typeof Neo4jError.isRetriable;
|
|
113
|
+
auth: {
|
|
114
|
+
basic: (username: string, password: string, realm?: string | undefined) => {
|
|
115
|
+
scheme: string;
|
|
116
|
+
principal: string;
|
|
117
|
+
credentials: string;
|
|
118
|
+
realm: string;
|
|
119
|
+
} | {
|
|
120
|
+
scheme: string;
|
|
121
|
+
principal: string;
|
|
122
|
+
credentials: string;
|
|
123
|
+
realm?: undefined;
|
|
124
|
+
};
|
|
125
|
+
kerberos: (base64EncodedTicket: string) => {
|
|
126
|
+
scheme: string;
|
|
127
|
+
principal: string;
|
|
128
|
+
credentials: string;
|
|
129
|
+
};
|
|
130
|
+
bearer: (base64EncodedToken: string) => {
|
|
131
|
+
scheme: string;
|
|
132
|
+
credentials: string;
|
|
133
|
+
};
|
|
134
|
+
none: () => {
|
|
135
|
+
scheme: string;
|
|
136
|
+
};
|
|
137
|
+
custom: (principal: string, credentials: string, realm: string, scheme: string, parameters?: object | undefined) => any;
|
|
138
|
+
};
|
|
139
|
+
logging: {
|
|
140
|
+
console: (level: coreTypes.LogLevel) => {
|
|
141
|
+
level: coreTypes.LogLevel;
|
|
142
|
+
logger: (level: coreTypes.LogLevel, message: string) => void;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
types: {
|
|
146
|
+
Node: typeof Node;
|
|
147
|
+
Relationship: typeof Relationship;
|
|
148
|
+
UnboundRelationship: typeof UnboundRelationship;
|
|
149
|
+
PathSegment: typeof PathSegment;
|
|
150
|
+
Path: typeof Path;
|
|
151
|
+
Result: typeof Result;
|
|
152
|
+
ResultSummary: typeof ResultSummary;
|
|
153
|
+
Record: typeof Record;
|
|
154
|
+
Point: typeof Point;
|
|
155
|
+
Date: typeof Date;
|
|
156
|
+
DateTime: typeof DateTime;
|
|
157
|
+
Duration: typeof Duration;
|
|
158
|
+
LocalDateTime: typeof LocalDateTime;
|
|
159
|
+
LocalTime: typeof LocalTime;
|
|
160
|
+
Time: typeof Time;
|
|
161
|
+
Integer: typeof Integer;
|
|
162
|
+
};
|
|
163
|
+
session: {
|
|
164
|
+
READ: coreTypes.SessionMode;
|
|
165
|
+
WRITE: coreTypes.SessionMode;
|
|
166
|
+
};
|
|
167
|
+
error: {
|
|
168
|
+
SERVICE_UNAVAILABLE: string;
|
|
169
|
+
SESSION_EXPIRED: string;
|
|
170
|
+
PROTOCOL_ERROR: string;
|
|
171
|
+
};
|
|
172
|
+
graph: {
|
|
173
|
+
isNode: typeof isNode;
|
|
174
|
+
isPath: typeof isPath;
|
|
175
|
+
isPathSegment: typeof isPathSegment;
|
|
176
|
+
isRelationship: typeof isRelationship;
|
|
177
|
+
isUnboundRelationship: typeof isUnboundRelationship;
|
|
178
|
+
};
|
|
179
|
+
spatial: {
|
|
180
|
+
isPoint: typeof isPoint;
|
|
181
|
+
};
|
|
182
|
+
temporal: {
|
|
183
|
+
isDuration: typeof isDuration;
|
|
184
|
+
isLocalTime: typeof isLocalTime;
|
|
185
|
+
isTime: typeof isTime;
|
|
186
|
+
isDate: typeof isDate;
|
|
187
|
+
isLocalDateTime: typeof isLocalDateTime;
|
|
188
|
+
isDateTime: typeof isDateTime;
|
|
189
|
+
};
|
|
190
|
+
Driver: typeof Driver;
|
|
191
|
+
Result: typeof Result;
|
|
192
|
+
Record: typeof Record;
|
|
193
|
+
ResultSummary: typeof ResultSummary;
|
|
194
|
+
Node: typeof Node;
|
|
195
|
+
Relationship: typeof Relationship;
|
|
196
|
+
UnboundRelationship: typeof UnboundRelationship;
|
|
197
|
+
PathSegment: typeof PathSegment;
|
|
198
|
+
Path: typeof Path;
|
|
199
|
+
Integer: typeof Integer;
|
|
200
|
+
Plan: typeof Plan;
|
|
201
|
+
ProfiledPlan: typeof ProfiledPlan;
|
|
202
|
+
QueryStatistics: typeof QueryStatistics;
|
|
203
|
+
Notification: typeof Notification;
|
|
204
|
+
ServerInfo: typeof ServerInfo;
|
|
205
|
+
Session: typeof Session;
|
|
206
|
+
Point: typeof Point;
|
|
207
|
+
Duration: typeof Duration;
|
|
208
|
+
LocalTime: typeof LocalTime;
|
|
209
|
+
Time: typeof Time;
|
|
210
|
+
Date: typeof Date;
|
|
211
|
+
LocalDateTime: typeof LocalDateTime;
|
|
212
|
+
DateTime: typeof DateTime;
|
|
213
|
+
ConnectionProvider: typeof ConnectionProvider;
|
|
214
|
+
Connection: typeof Connection;
|
|
215
|
+
bookmarkManager: typeof bookmarkManager;
|
|
216
|
+
resultTransformers: {
|
|
217
|
+
eagerResultTransformer<Entries extends RecordShape<PropertyKey, any> = RecordShape<PropertyKey, any>>(): ResultTransformer<import("neo4j-driver-core").EagerResult<Entries>>;
|
|
218
|
+
mappedResultTransformer<R = Record<RecordShape<PropertyKey, any>, PropertyKey, RecordShape<PropertyKey, number>>, T = {
|
|
219
|
+
records: R[];
|
|
220
|
+
keys: string[];
|
|
221
|
+
summary: ResultSummary<Integer>;
|
|
222
|
+
}>(config: {
|
|
223
|
+
map?: ((rec: Record<RecordShape<PropertyKey, any>, PropertyKey, RecordShape<PropertyKey, number>>) => R | undefined) | undefined;
|
|
224
|
+
collect?: ((records: R[], summary: ResultSummary<Integer>, keys: string[]) => T) | undefined;
|
|
225
|
+
}): ResultTransformer<T>;
|
|
226
|
+
};
|
|
227
|
+
notificationCategory: {
|
|
228
|
+
UNKNOWN: "UNKNOWN";
|
|
229
|
+
HINT: "HINT";
|
|
230
|
+
UNRECOGNIZED: "UNRECOGNIZED";
|
|
231
|
+
UNSUPPORTED: "UNSUPPORTED";
|
|
232
|
+
PERFORMANCE: "PERFORMANCE";
|
|
233
|
+
TOPOLOGY: "TOPOLOGY";
|
|
234
|
+
SECURITY: "SECURITY";
|
|
235
|
+
DEPRECATION: "DEPRECATION";
|
|
236
|
+
GENERIC: "GENERIC";
|
|
237
|
+
};
|
|
238
|
+
notificationSeverityLevel: {
|
|
239
|
+
WARNING: "WARNING";
|
|
240
|
+
INFORMATION: "INFORMATION";
|
|
241
|
+
UNKNOWN: "UNKNOWN";
|
|
242
|
+
};
|
|
243
|
+
wrapper: typeof wrapper;
|
|
244
|
+
};
|
|
245
|
+
export { authTokenManagers, int, isInt, isPoint, isDuration, isLocalTime, isTime, isDate, isLocalDateTime, isDateTime, isNode, isPath, isPathSegment, isRelationship, isUnboundRelationship, integer, Neo4jError, isRetriableError, auth, logging, types, session, error, graph, spatial, temporal, Driver, Result, Record, ResultSummary, Node, Relationship, UnboundRelationship, PathSegment, Path, Integer, Plan, ProfiledPlan, QueryStatistics, Notification, ServerInfo, Session, Point, Duration, LocalTime, Time, Date, LocalDateTime, DateTime, ConnectionProvider, Connection, bookmarkManager, resultTransformers, notificationCategory, notificationSeverityLevel, wrapper };
|
|
246
|
+
export type { QueryResult, AuthToken, AuthTokenManager, AuthTokenManagers, AuthTokenAndExpiration, Config, EncryptionLevel, TrustStrategy, SessionMode, ResultObserver, NotificationPosition, BookmarkManager, BookmarkManagerConfig, SessionConfig, QueryConfig, RecordShape, ResultTransformer, NotificationCategory, NotificationSeverityLevel, Logger, HttpUrl, Wrapper, WrapperConfig, WrapperSession, WrapperSessionConfig };
|
|
247
|
+
export default forExport;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { types as coreTypes } from 'neo4j-driver-core';
|
|
2
|
+
type LogLevel = coreTypes.LogLevel;
|
|
3
|
+
/**
|
|
4
|
+
* Object containing predefined logging configurations. These are expected to be used as values of the driver config's `logging` property.
|
|
5
|
+
* @property {function(level: ?string): object} console the function to create a logging config that prints all messages to `console.log` with
|
|
6
|
+
* timestamp, level and message. It takes an optional `level` parameter which represents the maximum log level to be logged. Default value is 'info'.
|
|
7
|
+
*/
|
|
8
|
+
export declare const logging: {
|
|
9
|
+
console: (level: LogLevel) => {
|
|
10
|
+
level: coreTypes.LogLevel;
|
|
11
|
+
logger: (level: LogLevel, message: string) => void;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export {};
|
package/types/types.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) "Neo4j"
|
|
3
|
+
* Neo4j Sweden AB [https://neo4j.com]
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { Driver, Session, SessionConfig, Config, ServerInfo } from "neo4j-driver-core";
|
|
18
|
+
type Disposable = {
|
|
19
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
20
|
+
};
|
|
21
|
+
type VerifyConnectivity = {
|
|
22
|
+
verifyConnectivity(config: {
|
|
23
|
+
database: string | undefined;
|
|
24
|
+
} | undefined): Promise<ServerInfo>;
|
|
25
|
+
};
|
|
26
|
+
type HttpUrl = `http://${string}` | `https://${string}`;
|
|
27
|
+
type WrapperSession = Pick<Session, 'run' | 'lastBookmarks' | 'close'> & Disposable;
|
|
28
|
+
type WrapperSessionConfig = Pick<SessionConfig, 'bookmarks' | 'impersonatedUser' | 'bookmarkManager' | 'defaultAccessMode'> & {
|
|
29
|
+
database: string;
|
|
30
|
+
};
|
|
31
|
+
type Wrapper = Pick<Driver, 'close'> & Disposable & VerifyConnectivity & {
|
|
32
|
+
session(config: WrapperSessionConfig): WrapperSession;
|
|
33
|
+
};
|
|
34
|
+
type WrapperConfig = Pick<Config, 'encrypted' | 'useBigInt' | 'disableLosslessIntegers'>;
|
|
35
|
+
export type { HttpUrl, WrapperSession, WrapperSessionConfig, Wrapper, WrapperConfig };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) "Neo4j"
|
|
3
|
+
* Neo4j Sweden AB [https://neo4j.com]
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { RecordShape, TransactionConfig, Result, Session } from "neo4j-driver-core";
|
|
18
|
+
import { Query } from "neo4j-driver-core/types/types";
|
|
19
|
+
import { WrapperSession } from "./types";
|
|
20
|
+
export default class WrapperSessionImpl implements WrapperSession {
|
|
21
|
+
private readonly session;
|
|
22
|
+
constructor(session: Session);
|
|
23
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
24
|
+
run<R extends RecordShape = RecordShape>(query: Query, parameters?: any, transactionConfig?: TransactionConfig | undefined): Result<R>;
|
|
25
|
+
lastBookmarks(): string[];
|
|
26
|
+
close(): Promise<void>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) "Neo4j"
|
|
3
|
+
* Neo4j Sweden AB [https://neo4j.com]
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { Driver, ServerInfo } from "neo4j-driver-core";
|
|
18
|
+
import { Wrapper, WrapperSession, WrapperSessionConfig } from "./types";
|
|
19
|
+
export declare class WrapperImpl implements Wrapper {
|
|
20
|
+
private readonly driver;
|
|
21
|
+
constructor(driver: Driver);
|
|
22
|
+
close(): Promise<void>;
|
|
23
|
+
verifyConnectivity(config: {
|
|
24
|
+
database: string;
|
|
25
|
+
}): Promise<ServerInfo>;
|
|
26
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
27
|
+
session(config: WrapperSessionConfig): WrapperSession;
|
|
28
|
+
}
|