UNPKG

1.46 kBTypeScriptView Raw
1/**
2 * Copyright (c) "Neo4j"
3 * Neo4j Sweden AB [http://neo4j.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 */
19import RxResult from './result-rx'
20import RxTransaction from './transaction-rx'
21import { TransactionConfig } from 'neo4j-driver-core'
22import { Parameters } from './query-runner'
23import { Observable } from 'rxjs'
24
25declare type RxTransactionWork<T> = (tx: RxTransaction) => Observable<T>
26
27declare interface RxSession {
28 run(
29 query: string,
30 parameters?: Parameters,
31 config?: TransactionConfig
32 ): RxResult
33
34 beginTransaction(config?: TransactionConfig): Observable<RxTransaction>
35
36 lastBookmark(): string | null
37
38 readTransaction<T>(
39 work: RxTransactionWork<T>,
40 config?: TransactionConfig
41 ): Observable<T>
42
43 writeTransaction<T>(
44 work: RxTransactionWork<T>,
45 config?: TransactionConfig
46 ): Observable<T>
47
48 close(): Observable<any>
49}
50
51export default RxSession