Skip to content

Commit 82af0d8

Browse files
authored
Merge pull request #280 from lutovich/1.4-ts-imports
Export all available types and interfaces
2 parents e06eb57 + 05cd759 commit 82af0d8

File tree

1 file changed

+65
-7
lines changed

1 file changed

+65
-7
lines changed

types/v1/index.d.ts

Lines changed: 65 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,21 @@
1717
* limitations under the License.
1818
*/
1919

20-
import {inSafeRange, int, isInt, toNumber, toString} from "./integer";
20+
import Integer, {inSafeRange, int, isInt, toNumber, toString} from "./integer";
2121
import {Node, Path, PathSegment, Relationship, UnboundRelationship} from "./graph-types";
2222
import {Neo4jError, PROTOCOL_ERROR, SERVICE_UNAVAILABLE, SESSION_EXPIRED} from "./error";
23-
import Result from "./result";
24-
import ResultSummary from "./result-summary";
23+
import Result, {Observer, StatementResult} from "./result";
24+
import ResultSummary, {
25+
Notification,
26+
NotificationPosition,
27+
Plan,
28+
ProfiledPlan,
29+
ServerInfo,
30+
StatementStatistic
31+
} from "./result-summary";
2532
import Record from "./record";
2633
import Session from "./session";
27-
import {AuthToken, Config, Driver, READ, WRITE} from "./driver";
34+
import {AuthToken, Config, Driver, EncryptionLevel, READ, SessionMode, TrustStrategy, WRITE} from "./driver";
2835
import Transaction from "./transaction";
2936
import {Parameters} from "./statement-runner";
3037

@@ -74,19 +81,48 @@ declare const integer: {
7481
inSafeRange: typeof inSafeRange;
7582
};
7683

84+
/*
85+
Both default and non-default exports declare all visible types so that they can be used in client code like this:
86+
87+
import neo4j from "neo4j-driver";
88+
const driver: neo4j.Driver = neo4j.driver("bolt://localhost");
89+
const session: neo4j.Session = driver.session();
90+
...
91+
*/
92+
7793
declare const forExport: {
7894
driver: typeof driver;
7995
int: typeof int;
8096
isInt: typeof isInt;
8197
integer: typeof integer;
82-
Neo4jError: typeof Neo4jError;
8398
auth: typeof auth;
8499
types: typeof types;
85100
session: typeof session;
86101
error: typeof error;
87102
Driver: Driver;
88103
AuthToken: AuthToken;
89104
Config: Config;
105+
EncryptionLevel: EncryptionLevel;
106+
TrustStrategy: TrustStrategy;
107+
SessionMode: SessionMode;
108+
Neo4jError: Neo4jError;
109+
Node: Node;
110+
Relationship: Relationship;
111+
UnboundRelationship: UnboundRelationship;
112+
PathSegment: PathSegment;
113+
Path: Path;
114+
Integer: Integer;
115+
Record: Record;
116+
Result: Result;
117+
StatementResult: StatementResult;
118+
Observer: Observer;
119+
ResultSummary: ResultSummary;
120+
Plan: Plan,
121+
ProfiledPlan: ProfiledPlan,
122+
StatementStatistic: StatementStatistic,
123+
Notification: Notification,
124+
ServerInfo: ServerInfo,
125+
NotificationPosition: NotificationPosition,
90126
Session: Session;
91127
Transaction: Transaction;
92128
};
@@ -96,14 +132,36 @@ export {
96132
int,
97133
isInt,
98134
integer,
99-
Neo4jError,
100135
auth,
101136
types,
102137
session,
103138
error,
139+
Driver,
104140
AuthToken,
105-
Session,
106141
Config,
142+
EncryptionLevel,
143+
TrustStrategy,
144+
SessionMode,
145+
Neo4jError,
146+
Node,
147+
Relationship,
148+
UnboundRelationship,
149+
PathSegment,
150+
Path,
151+
Integer,
152+
Record,
153+
Result,
154+
StatementResult,
155+
Observer,
156+
ResultSummary,
157+
Plan,
158+
ProfiledPlan,
159+
StatementStatistic,
160+
Notification,
161+
ServerInfo,
162+
NotificationPosition,
163+
Session,
164+
Transaction
107165
}
108166

109167
export default forExport;

0 commit comments

Comments
 (0)