|
| 1 | +/** |
| 2 | + * Copyright (c) 2002-2017 "Neo Technology,"," |
| 3 | + * Network Engine for Objects in Lund AB [http://neotechnology.com] |
| 4 | + * |
| 5 | + * This file is part of Neo4j. |
| 6 | + * |
| 7 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | + * you may not use this file except in compliance with the License. |
| 9 | + * You may obtain a copy of the License at |
| 10 | + * |
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | + * |
| 13 | + * Unless required by applicable law or agreed to in writing, software |
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | + * See the License for the specific language governing permissions and |
| 17 | + * limitations under the License. |
| 18 | + */ |
| 19 | + |
| 20 | +import Driver, { |
| 21 | + AuthToken, |
| 22 | + Config, |
| 23 | + EncryptionLevel, |
| 24 | + READ, |
| 25 | + SessionMode, |
| 26 | + TrustStrategy, |
| 27 | + WRITE |
| 28 | +} from "../../../types/v1/driver"; |
| 29 | +import {Parameters} from "../../../types/v1/statement-runner"; |
| 30 | +import Session from "../../../types/v1/session"; |
| 31 | + |
| 32 | +const dummy: any = null; |
| 33 | + |
| 34 | +const authToken: AuthToken = dummy; |
| 35 | +const scheme: string = authToken.scheme; |
| 36 | +const principal: string = authToken.principal; |
| 37 | +const credentials: string = authToken.credentials; |
| 38 | +const realm1: undefined = <undefined>authToken.realm; |
| 39 | +const realm2: string = <string>authToken.realm; |
| 40 | +const parameters1: undefined = <undefined>authToken.parameters; |
| 41 | +const parameters2: { [key: string]: any } = <{ [key: string]: any }>authToken.parameters; |
| 42 | +const parameters3: Parameters = <Parameters>authToken.parameters; |
| 43 | + |
| 44 | +const encryptionLevel: EncryptionLevel = dummy; |
| 45 | +const encryptionLevelStr: string = encryptionLevel; |
| 46 | + |
| 47 | +const trustStrategy: TrustStrategy = dummy; |
| 48 | +const trustStrategyStr: string = trustStrategy; |
| 49 | + |
| 50 | +const config: Config = dummy; |
| 51 | +const encrypted: undefined | boolean | EncryptionLevel = config.encrypted; |
| 52 | +const trust: undefined | TrustStrategy = config.trust; |
| 53 | +const trustedCertificates: undefined | string[] = config.trustedCertificates; |
| 54 | +const knownHosts: undefined | string = config.knownHosts; |
| 55 | +const connectionPoolSize: undefined | number = config.connectionPoolSize; |
| 56 | +const maxTransactionRetryTime: undefined | number = config.maxTransactionRetryTime; |
| 57 | + |
| 58 | +const sessionMode: SessionMode = dummy; |
| 59 | +const sessionModeStr: string = sessionMode; |
| 60 | + |
| 61 | +const readMode1: SessionMode = READ; |
| 62 | +const readMode2: string = READ; |
| 63 | + |
| 64 | +const writeMode1: SessionMode = WRITE; |
| 65 | +const writeMode2: string = WRITE; |
| 66 | + |
| 67 | +const driver: Driver = dummy; |
| 68 | + |
| 69 | +const session1: Session = driver.session(); |
| 70 | +const session2: Session = driver.session("READ"); |
| 71 | +const session3: Session = driver.session(READ); |
| 72 | +const session4: Session = driver.session("WRITE"); |
| 73 | +const session5: Session = driver.session(WRITE); |
| 74 | +const session6: Session = driver.session(READ, "bookmark1"); |
| 75 | +const session7: Session = driver.session(WRITE, "bookmark2"); |
| 76 | + |
| 77 | +session1.run("RETURN 1").then(result => { |
| 78 | + session1.close(); |
| 79 | + result.records.forEach(record => { |
| 80 | + console.log(record); |
| 81 | + }); |
| 82 | +}); |
| 83 | + |
| 84 | +const close: void = driver.close(); |
0 commit comments