Skip to content

Commit 2ce5354

Browse files
committed
move FETCH_ALL to constants
1 parent 833ca1f commit 2ce5354

File tree

5 files changed

+21
-9
lines changed

5 files changed

+21
-9
lines changed

core/src/internal/constants.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* limitations under the License.
1818
*/
1919

20+
const FETCH_ALL = -1
21+
2022
const ACCESS_MODE_READ: string = 'READ'
2123
const ACCESS_MODE_WRITE: string = 'WRITE'
2224

@@ -29,6 +31,7 @@ const BOLT_PROTOCOL_V4_2: number = 4.2
2931
const BOLT_PROTOCOL_V4_3: number = 4.3
3032

3133
export {
34+
FETCH_ALL,
3235
ACCESS_MODE_READ,
3336
ACCESS_MODE_WRITE,
3437
BOLT_PROTOCOL_V1,

src/driver.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,18 @@ import ConnectionProvider from './internal/connection-provider'
2121
import Bookmark from './internal/bookmark'
2222
import DirectConnectionProvider from './internal/connection-provider-direct'
2323
import ConnectivityVerifier from './internal/connectivity-verifier'
24-
import { ACCESS_MODE_READ, ACCESS_MODE_WRITE } from './internal/constants'
24+
import {
25+
ACCESS_MODE_READ,
26+
ACCESS_MODE_WRITE,
27+
FETCH_ALL
28+
} from './internal/constants'
2529
import Logger from './internal/logger'
2630
import {
2731
DEFAULT_ACQUISITION_TIMEOUT,
2832
DEFAULT_MAX_SIZE
2933
} from './internal/pool-config'
3034
import { Session } from 'neo4j-driver-core'
3135
import RxSession from './session-rx'
32-
import { FETCH_ALL } from './internal/bolt'
3336
import { ENCRYPTION_ON, ENCRYPTION_OFF } from './internal/util'
3437

3538
const DEFAULT_MAX_CONNECTION_LIFETIME = 60 * 60 * 1000 // 1 hour

src/internal/bolt/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import _BoltProtocol from './bolt-protocol-v4x3'
2222
import _RawRoutingTable from './routing-table-raw'
2323

2424
export * from './stream-observers'
25-
export { ALL as FETCH_ALL } from './request-message'
2625

2726
export const BoltProtocol = _BoltProtocol
2827
export const RawRoutingTable = _RawRoutingTable

src/internal/bolt/request-message.js

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

20-
import { ACCESS_MODE_READ } from '../constants'
20+
import { ACCESS_MODE_READ, FETCH_ALL } from '../constants'
2121
import { int } from 'neo4j-driver-core'
2222
import { assertString } from '../util'
2323

@@ -44,7 +44,6 @@ const READ_MODE = 'r'
4444
/* eslint-enable no-unused-vars */
4545

4646
const NO_STATEMENT_ID = -1
47-
export const ALL = -1
4847

4948
export default class RequestMessage {
5049
constructor (signature, fields, toString) {
@@ -187,8 +186,11 @@ export default class RequestMessage {
187186
* @param {Integer|number} n
188187
* @return {RequestMessage} the PULL message.
189188
*/
190-
static pull ({ stmtId = NO_STATEMENT_ID, n = ALL } = {}) {
191-
const metadata = buildStreamMetadata(stmtId || NO_STATEMENT_ID, n || ALL)
189+
static pull ({ stmtId = NO_STATEMENT_ID, n = FETCH_ALL } = {}) {
190+
const metadata = buildStreamMetadata(
191+
stmtId || NO_STATEMENT_ID,
192+
n || FETCH_ALL
193+
)
192194
return new RequestMessage(
193195
PULL,
194196
[metadata],
@@ -202,8 +204,11 @@ export default class RequestMessage {
202204
* @param {Integer|number} n
203205
* @return {RequestMessage} the PULL message.
204206
*/
205-
static discard ({ stmtId = NO_STATEMENT_ID, n = ALL } = {}) {
206-
const metadata = buildStreamMetadata(stmtId || NO_STATEMENT_ID, n || ALL)
207+
static discard ({ stmtId = NO_STATEMENT_ID, n = FETCH_ALL } = {}) {
208+
const metadata = buildStreamMetadata(
209+
stmtId || NO_STATEMENT_ID,
210+
n || FETCH_ALL
211+
)
207212
return new RequestMessage(
208213
DISCARD,
209214
[metadata],

src/internal/constants.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { internal } from 'neo4j-driver-core'
2121

2222
const {
2323
constants: {
24+
FETCH_ALL,
2425
ACCESS_MODE_READ,
2526
ACCESS_MODE_WRITE,
2627
BOLT_PROTOCOL_V1,
@@ -34,6 +35,7 @@ const {
3435
} = internal
3536

3637
export {
38+
FETCH_ALL,
3739
ACCESS_MODE_READ,
3840
ACCESS_MODE_WRITE,
3941
BOLT_PROTOCOL_V1,

0 commit comments

Comments
 (0)