@ragestudio/scylla-odm 0.22.2 → 0.22.4

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.
Files changed (153) hide show
  1. package/batch/index.d.ts +3 -3
  2. package/batch/index.d.ts.map +1 -1
  3. package/client.d.ts +6 -5
  4. package/client.d.ts.map +1 -1
  5. package/client.js +11 -12
  6. package/client.js.map +1 -1
  7. package/cql_gen/create_table.d.ts +1 -1
  8. package/cql_gen/create_table.d.ts.map +1 -1
  9. package/document/index.d.ts +3 -3
  10. package/document/index.d.ts.map +1 -1
  11. package/driver/LICENSE.txt +177 -0
  12. package/driver/NOTICE.txt +67 -0
  13. package/driver/auth/index.d.ts +37 -0
  14. package/driver/auth/index.js +37 -0
  15. package/driver/auth/no-auth-provider.js +73 -0
  16. package/driver/auth/plain-text-auth-provider.js +81 -0
  17. package/driver/auth/provider.js +77 -0
  18. package/driver/client-options.js +442 -0
  19. package/driver/client.js +1267 -0
  20. package/driver/concurrent/index.d.ts +49 -0
  21. package/driver/concurrent/index.js +366 -0
  22. package/driver/connection.js +1034 -0
  23. package/driver/control-connection.js +1282 -0
  24. package/driver/encoder.js +2316 -0
  25. package/driver/errors.js +223 -0
  26. package/driver/execution-options.js +612 -0
  27. package/driver/execution-profile.js +274 -0
  28. package/driver/host-connection-pool.js +587 -0
  29. package/driver/host.js +699 -0
  30. package/driver/index.d.ts +387 -0
  31. package/driver/index.js +81 -0
  32. package/driver/mapping/cache.js +214 -0
  33. package/driver/mapping/doc-info-adapter.js +171 -0
  34. package/driver/mapping/index.d.ts +219 -0
  35. package/driver/mapping/index.js +57 -0
  36. package/driver/mapping/mapper.js +225 -0
  37. package/driver/mapping/mapping-handler.js +641 -0
  38. package/driver/mapping/model-batch-item.js +215 -0
  39. package/driver/mapping/model-batch-mapper.js +141 -0
  40. package/driver/mapping/model-mapper.js +315 -0
  41. package/driver/mapping/model-mapping-info.js +225 -0
  42. package/driver/mapping/object-selector.js +417 -0
  43. package/driver/mapping/q.js +156 -0
  44. package/driver/mapping/query-generator.js +556 -0
  45. package/driver/mapping/result-mapper.js +123 -0
  46. package/driver/mapping/result.js +139 -0
  47. package/driver/mapping/table-mappings.js +133 -0
  48. package/driver/mapping/tree.js +160 -0
  49. package/driver/metadata/aggregate.js +79 -0
  50. package/driver/metadata/client-state.js +119 -0
  51. package/driver/metadata/data-collection.js +182 -0
  52. package/driver/metadata/event-debouncer.js +174 -0
  53. package/driver/metadata/index.d.ts +276 -0
  54. package/driver/metadata/index.js +1156 -0
  55. package/driver/metadata/materialized-view.js +49 -0
  56. package/driver/metadata/schema-function.js +98 -0
  57. package/driver/metadata/schema-index.js +166 -0
  58. package/driver/metadata/schema-parser.js +1399 -0
  59. package/driver/metadata/table-metadata.js +77 -0
  60. package/driver/operation-state.js +206 -0
  61. package/driver/policies/address-resolution.js +145 -0
  62. package/driver/policies/index.d.ts +241 -0
  63. package/driver/policies/index.js +110 -0
  64. package/driver/policies/load-balancing.js +970 -0
  65. package/driver/policies/reconnection.js +166 -0
  66. package/driver/policies/retry.js +326 -0
  67. package/driver/policies/speculative-execution.js +150 -0
  68. package/driver/policies/timestamp-generation.js +176 -0
  69. package/driver/prepare-handler.js +347 -0
  70. package/driver/promise-utils.js +191 -0
  71. package/driver/readers.js +624 -0
  72. package/driver/request-execution.js +644 -0
  73. package/driver/request-handler.js +332 -0
  74. package/driver/requests.js +618 -0
  75. package/driver/stream-id-stack.js +209 -0
  76. package/driver/streams.js +745 -0
  77. package/driver/token.js +325 -0
  78. package/driver/tokenizer.js +631 -0
  79. package/driver/types/big-decimal.js +282 -0
  80. package/driver/types/duration.js +576 -0
  81. package/driver/types/index.d.ts +486 -0
  82. package/driver/types/index.js +733 -0
  83. package/driver/types/inet-address.js +262 -0
  84. package/driver/types/integer.js +818 -0
  85. package/driver/types/local-date.js +280 -0
  86. package/driver/types/local-time.js +299 -0
  87. package/driver/types/mutable-long.js +385 -0
  88. package/driver/types/protocol-version.js +391 -0
  89. package/driver/types/result-set.js +287 -0
  90. package/driver/types/result-stream.js +164 -0
  91. package/driver/types/row.js +85 -0
  92. package/driver/types/time-uuid.js +414 -0
  93. package/driver/types/tuple.js +103 -0
  94. package/driver/types/uuid.js +160 -0
  95. package/driver/types/vector.js +130 -0
  96. package/driver/types/version-number.js +153 -0
  97. package/driver/utils.js +1485 -0
  98. package/driver/writers.js +350 -0
  99. package/global.d.ts +1 -1
  100. package/global.d.ts.map +1 -1
  101. package/index.d.ts +6 -6
  102. package/index.d.ts.map +1 -1
  103. package/index.js +6 -6
  104. package/index.js.map +1 -1
  105. package/migrate/index.d.ts +1 -1
  106. package/migrate/index.d.ts.map +1 -1
  107. package/migrate/index.js +1 -1
  108. package/migrate/index.js.map +1 -1
  109. package/model/index.d.ts +6 -6
  110. package/model/index.d.ts.map +1 -1
  111. package/model/index.js +10 -10
  112. package/model/index.js.map +1 -1
  113. package/operations/countAll.d.ts +1 -1
  114. package/operations/countAll.d.ts.map +1 -1
  115. package/operations/delete.d.ts +3 -4
  116. package/operations/delete.d.ts.map +1 -1
  117. package/operations/delete.js +1 -1
  118. package/operations/delete.js.map +1 -1
  119. package/operations/find.d.ts +2 -2
  120. package/operations/find.d.ts.map +1 -1
  121. package/operations/find.js +1 -1
  122. package/operations/find.js.map +1 -1
  123. package/operations/findOne.d.ts +2 -2
  124. package/operations/findOne.d.ts.map +1 -1
  125. package/operations/findOne.js +1 -1
  126. package/operations/findOne.js.map +1 -1
  127. package/operations/insert.d.ts +3 -3
  128. package/operations/insert.d.ts.map +1 -1
  129. package/operations/insert.js +2 -2
  130. package/operations/insert.js.map +1 -1
  131. package/operations/sync.d.ts +1 -1
  132. package/operations/sync.d.ts.map +1 -1
  133. package/operations/sync.js +1 -1
  134. package/operations/sync.js.map +1 -1
  135. package/operations/tableExists.d.ts +1 -1
  136. package/operations/tableExists.d.ts.map +1 -1
  137. package/operations/update.d.ts +3 -3
  138. package/operations/update.d.ts.map +1 -1
  139. package/operations/update.js +2 -2
  140. package/operations/update.js.map +1 -1
  141. package/package.json +4 -12
  142. package/schema/index.d.ts +1 -1
  143. package/schema/index.d.ts.map +1 -1
  144. package/types.d.ts +4 -4
  145. package/types.d.ts.map +1 -1
  146. package/utils/queryParser.d.ts +1 -1
  147. package/utils/queryParser.d.ts.map +1 -1
  148. package/utils/queryParser.js +1 -1
  149. package/utils/queryParser.js.map +1 -1
  150. package/utils/typeChecker.d.ts +1 -1
  151. package/utils/typeChecker.d.ts.map +1 -1
  152. package/utils/typeChecker.js +1 -1
  153. package/utils/typeChecker.js.map +1 -1
@@ -0,0 +1,77 @@
1
+ /*
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ /**
19
+ * @classdesc Provides [Authenticator]{@link module:auth~Authenticator} instances to be used when connecting to a host.
20
+ * @constructor
21
+ * @abstract
22
+ * @alias module:auth~AuthProvider
23
+ */
24
+ function AuthProvider() {}
25
+
26
+ /**
27
+ * Returns an [Authenticator]{@link module:auth~Authenticator} instance to be used when connecting to a host.
28
+ * @param {String} endpoint The ip address and port number in the format ip:port
29
+ * @param {String} name Authenticator name
30
+ * @abstract
31
+ * @returns {Authenticator}
32
+ */
33
+ AuthProvider.prototype.newAuthenticator = function (endpoint, name) {
34
+ throw new Error(
35
+ "This is an abstract class, you must implement newAuthenticator method or " +
36
+ "use another auth provider that inherits from this class",
37
+ )
38
+ }
39
+
40
+ /**
41
+ * @class
42
+ * @classdesc Handles SASL authentication with Cassandra servers.
43
+ * Each time a new connection is created and the server requires authentication,
44
+ * a new instance of this class will be created by the corresponding.
45
+ * @constructor
46
+ * @alias module:auth~Authenticator
47
+ */
48
+ function Authenticator() {}
49
+
50
+ /**
51
+ * Obtain an initial response token for initializing the SASL handshake.
52
+ * @param {Function} callback
53
+ */
54
+ Authenticator.prototype.initialResponse = function (callback) {
55
+ callback(new Error("Not implemented"))
56
+ }
57
+
58
+ /**
59
+ * Evaluates a challenge received from the Server. Generally, this method should callback with
60
+ * no error and no additional params when authentication is complete from the client perspective.
61
+ * @param {Buffer} challenge
62
+ * @param {Function} callback
63
+ */
64
+ Authenticator.prototype.evaluateChallenge = function (challenge, callback) {
65
+ callback(new Error("Not implemented"))
66
+ }
67
+
68
+ /**
69
+ * Called when authentication is successful with the last information
70
+ * optionally sent by the server.
71
+ * @param {Buffer} [token]
72
+ */
73
+ Authenticator.prototype.onAuthenticationSuccess = function (token) {}
74
+
75
+ export { AuthProvider, Authenticator }
76
+
77
+ export default { AuthProvider, Authenticator }
@@ -0,0 +1,442 @@
1
+ /*
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ import util from "util"
19
+ import policies from "./policies/index.js"
20
+ import types from "./types/index.js"
21
+ import utils from "./utils.js"
22
+ import auth from "./auth/index.js"
23
+
24
+ // no-op metrics stub (metrics module removed from this build)
25
+ const noopMetrics = {
26
+ onSuccessfulResponse() {},
27
+ onConnectionError() {},
28
+ onClientTimeoutError() {},
29
+ onOtherError() {},
30
+ onReadTimeoutError() {},
31
+ onUnavailableError() {},
32
+ onWriteTimeoutError() {},
33
+ onOtherErrorRetry() {},
34
+ onClientTimeoutRetry() {},
35
+ onReadTimeoutRetry() {},
36
+ onUnavailableRetry() {},
37
+ onWriteTimeoutRetry() {},
38
+ onResponse() {},
39
+ onIgnoreError() {},
40
+ onSpeculativeExecution() {},
41
+ onAuthenticationError() {},
42
+ }
43
+
44
+ /** Core connections per host for protocol versions 1 and 2 */
45
+ const coreConnectionsPerHostV2 = {
46
+ 0: 2,
47
+ 1: 1,
48
+ 2: 0,
49
+ }
50
+
51
+ /** Core connections per host for protocol version 3 and above */
52
+ const coreConnectionsPerHostV3 = {
53
+ 0: 1,
54
+ 1: 1,
55
+ 2: 0,
56
+ }
57
+
58
+ /** Default maxRequestsPerConnection value for protocol v1 and v2 */
59
+ const maxRequestsPerConnectionV2 = 128
60
+
61
+ /** Default maxRequestsPerConnection value for protocol v3+ */
62
+ const maxRequestsPerConnectionV3 = 2048
63
+
64
+ const continuousPageUnitBytes = "bytes"
65
+ const continuousPageDefaultSize = 5000
66
+ const continuousPageDefaultHighWaterMark = 10000
67
+
68
+ /**
69
+ * @returns {ClientOptions}
70
+ */
71
+ function defaultOptions() {
72
+ return {
73
+ policies: {
74
+ addressResolution: policies.defaultAddressTranslator(),
75
+ loadBalancing: policies.defaultLoadBalancingPolicy(),
76
+ reconnection: policies.defaultReconnectionPolicy(),
77
+ retry: policies.defaultRetryPolicy(),
78
+ speculativeExecution: policies.defaultSpeculativeExecutionPolicy(),
79
+ timestampGeneration: policies.defaultTimestampGenerator(),
80
+ },
81
+ queryOptions: {
82
+ fetchSize: 5000,
83
+ prepare: false,
84
+ captureStackTrace: false,
85
+ },
86
+ protocolOptions: {
87
+ port: 9042,
88
+ maxSchemaAgreementWaitSeconds: 10,
89
+ maxVersion: 0,
90
+ noCompact: false,
91
+ },
92
+ pooling: {
93
+ heartBeatInterval: 30000,
94
+ warmup: true,
95
+ },
96
+ socketOptions: {
97
+ connectTimeout: 5000,
98
+ defunctReadTimeoutThreshold: 64,
99
+ keepAlive: true,
100
+ keepAliveDelay: 0,
101
+ readTimeout: 12000,
102
+ tcpNoDelay: true,
103
+ coalescingThreshold: 65536,
104
+ },
105
+ authProvider: null,
106
+ requestTracker: null,
107
+ metrics: noopMetrics,
108
+ maxPrepared: 500,
109
+ refreshSchemaDelay: 1000,
110
+ isMetadataSyncEnabled: true,
111
+ prepareOnAllHosts: true,
112
+ rePrepareOnUp: true,
113
+ encoding: {
114
+ copyBuffer: true,
115
+ useUndefinedAsUnset: true,
116
+ },
117
+ monitorReporting: {
118
+ enabled: true,
119
+ },
120
+ }
121
+ }
122
+
123
+ /**
124
+ * Extends and validates the user options
125
+ * @param {Object} [baseOptions] The source object instance that will be overridden
126
+ * @param {Object} userOptions
127
+ * @returns {Object}
128
+ */
129
+ function extend(baseOptions, userOptions) {
130
+ if (arguments.length === 1) {
131
+ userOptions = arguments[0]
132
+ baseOptions = {}
133
+ }
134
+ const options = utils.deepExtend(baseOptions, defaultOptions(), userOptions)
135
+
136
+ if (
137
+ !Array.isArray(options.contactPoints) ||
138
+ options.contactPoints.length === 0
139
+ ) {
140
+ throw new TypeError("Contacts points are not defined.")
141
+ }
142
+
143
+ for (let i = 0; i < options.contactPoints.length; i++) {
144
+ const hostName = options.contactPoints[i]
145
+ if (!hostName) {
146
+ throw new TypeError(
147
+ util.format(
148
+ "Contact point %s (%s) is not a valid host name, " +
149
+ "the following values are valid contact points: ipAddress, hostName or ipAddress:port",
150
+ i,
151
+ hostName,
152
+ ),
153
+ )
154
+ }
155
+ }
156
+
157
+ options.sni = undefined
158
+
159
+ if (!options.logEmitter) {
160
+ options.logEmitter = function () {}
161
+ }
162
+ if (!options.queryOptions) {
163
+ throw new TypeError("queryOptions not defined in options")
164
+ }
165
+
166
+ validatePoliciesOptions(options.policies)
167
+
168
+ validateProtocolOptions(options.protocolOptions)
169
+
170
+ validateSocketOptions(options.socketOptions)
171
+
172
+ validateAuthenticationOptions(options)
173
+
174
+ options.encoding = options.encoding || {}
175
+
176
+ validateEncodingOptions(options.encoding)
177
+
178
+ if (options.profiles && !Array.isArray(options.profiles)) {
179
+ throw new TypeError(
180
+ "profiles must be an Array of ExecutionProfile instances",
181
+ )
182
+ }
183
+
184
+ validateApplicationInfo(options)
185
+
186
+ validateMonitorReporting(options)
187
+
188
+ return options
189
+ }
190
+
191
+ /**
192
+ * Validates the policies from the client options.
193
+ * @param {ClientOptions.policies} policiesOptions
194
+ * @private
195
+ */
196
+ function validatePoliciesOptions(policiesOptions) {
197
+ if (!policiesOptions) {
198
+ throw new TypeError("policies not defined in options")
199
+ }
200
+ if (
201
+ !(
202
+ policiesOptions.loadBalancing instanceof
203
+ policies.loadBalancing.LoadBalancingPolicy
204
+ )
205
+ ) {
206
+ throw new TypeError(
207
+ "Load balancing policy must be an instance of LoadBalancingPolicy",
208
+ )
209
+ }
210
+ if (
211
+ !(
212
+ policiesOptions.reconnection instanceof
213
+ policies.reconnection.ReconnectionPolicy
214
+ )
215
+ ) {
216
+ throw new TypeError(
217
+ "Reconnection policy must be an instance of ReconnectionPolicy",
218
+ )
219
+ }
220
+ if (!(policiesOptions.retry instanceof policies.retry.RetryPolicy)) {
221
+ throw new TypeError("Retry policy must be an instance of RetryPolicy")
222
+ }
223
+ if (
224
+ !(
225
+ policiesOptions.addressResolution instanceof
226
+ policies.addressResolution.AddressTranslator
227
+ )
228
+ ) {
229
+ throw new TypeError(
230
+ "Address resolution policy must be an instance of AddressTranslator",
231
+ )
232
+ }
233
+ if (
234
+ policiesOptions.timestampGeneration !== null &&
235
+ !(
236
+ policiesOptions.timestampGeneration instanceof
237
+ policies.timestampGeneration.TimestampGenerator
238
+ )
239
+ ) {
240
+ throw new TypeError(
241
+ "Timestamp generation policy must be an instance of TimestampGenerator",
242
+ )
243
+ }
244
+ }
245
+
246
+ /**
247
+ * Validates the protocol options.
248
+ * @param {ClientOptions.protocolOptions} protocolOptions
249
+ * @private
250
+ */
251
+ function validateProtocolOptions(protocolOptions) {
252
+ if (!protocolOptions) {
253
+ throw new TypeError("protocolOptions not defined in options")
254
+ }
255
+ const version = protocolOptions.maxVersion
256
+ if (
257
+ version &&
258
+ (typeof version !== "number" ||
259
+ !types.protocolVersion.isSupported(version))
260
+ ) {
261
+ throw new TypeError(
262
+ util.format(
263
+ "protocolOptions.maxVersion provided (%s) is invalid",
264
+ version,
265
+ ),
266
+ )
267
+ }
268
+ }
269
+
270
+ /**
271
+ * Validates the socket options.
272
+ * @param {ClientOptions.socketOptions} socketOptions
273
+ * @private
274
+ */
275
+ function validateSocketOptions(socketOptions) {
276
+ if (!socketOptions) {
277
+ throw new TypeError("socketOptions not defined in options")
278
+ }
279
+ if (typeof socketOptions.readTimeout !== "number") {
280
+ throw new TypeError("socketOptions.readTimeout must be a Number")
281
+ }
282
+ if (
283
+ typeof socketOptions.coalescingThreshold !== "number" ||
284
+ socketOptions.coalescingThreshold <= 0
285
+ ) {
286
+ throw new TypeError(
287
+ "socketOptions.coalescingThreshold must be a positive Number",
288
+ )
289
+ }
290
+ }
291
+
292
+ /**
293
+ * Validates authentication provider and credentials.
294
+ * @param {ClientOptions} options
295
+ * @private
296
+ */
297
+ function validateAuthenticationOptions(options) {
298
+ if (!options.authProvider) {
299
+ const credentials = options.credentials
300
+ if (credentials) {
301
+ if (
302
+ typeof credentials.username !== "string" ||
303
+ typeof credentials.password !== "string"
304
+ ) {
305
+ throw new TypeError(
306
+ "credentials username and password must be a string",
307
+ )
308
+ }
309
+
310
+ options.authProvider = new auth.PlainTextAuthProvider(
311
+ credentials.username,
312
+ credentials.password,
313
+ )
314
+ } else {
315
+ options.authProvider = new auth.NoAuthProvider()
316
+ }
317
+ } else if (!(options.authProvider instanceof auth.AuthProvider)) {
318
+ throw new TypeError(
319
+ "options.authProvider must be an instance of AuthProvider",
320
+ )
321
+ }
322
+ }
323
+
324
+ /**
325
+ * Validates the encoding options.
326
+ * @param {ClientOptions.encoding} encodingOptions
327
+ * @private
328
+ */
329
+ function validateEncodingOptions(encodingOptions) {
330
+ if (encodingOptions.map) {
331
+ const mapConstructor = encodingOptions.map
332
+ if (
333
+ typeof mapConstructor !== "function" ||
334
+ typeof mapConstructor.prototype.forEach !== "function" ||
335
+ typeof mapConstructor.prototype.set !== "function"
336
+ ) {
337
+ throw new TypeError("Map constructor not valid")
338
+ }
339
+ }
340
+
341
+ if (encodingOptions.set) {
342
+ const setConstructor = encodingOptions.set
343
+ if (
344
+ typeof setConstructor !== "function" ||
345
+ typeof setConstructor.prototype.forEach !== "function" ||
346
+ typeof setConstructor.prototype.add !== "function"
347
+ ) {
348
+ throw new TypeError("Set constructor not valid")
349
+ }
350
+ }
351
+
352
+ if (
353
+ (encodingOptions.useBigIntAsLong ||
354
+ encodingOptions.useBigIntAsVarint) &&
355
+ typeof BigInt === "undefined"
356
+ ) {
357
+ throw new TypeError("BigInt is not supported by the JavaScript engine")
358
+ }
359
+ }
360
+
361
+ function validateApplicationInfo(options) {
362
+ function validateString(key) {
363
+ const str = options[key]
364
+
365
+ if (str !== null && str !== undefined && typeof str !== "string") {
366
+ throw new TypeError(`${key} should be a String`)
367
+ }
368
+ }
369
+
370
+ validateString("applicationName")
371
+ validateString("applicationVersion")
372
+
373
+ if (
374
+ options.id !== null &&
375
+ options.id !== undefined &&
376
+ !(options.id instanceof types.Uuid)
377
+ ) {
378
+ throw new TypeError("Client id must be a Uuid")
379
+ }
380
+ }
381
+
382
+ function validateMonitorReporting(options) {
383
+ const o = options.monitorReporting
384
+ if (o === null || typeof o !== "object") {
385
+ throw new TypeError(
386
+ `Monitor reporting must be an object, obtained: ${o}`,
387
+ )
388
+ }
389
+ }
390
+
391
+ /**
392
+ * Sets the default options that depend on the protocol version and other metadata.
393
+ * @param {Client} client
394
+ */
395
+ function setMetadataDependent(client) {
396
+ const version = client.controlConnection.protocolVersion
397
+ let coreConnectionsPerHost = coreConnectionsPerHostV3
398
+ let maxRequestsPerConnection = maxRequestsPerConnectionV3
399
+
400
+ if (!types.protocolVersion.uses2BytesStreamIds(version)) {
401
+ coreConnectionsPerHost = coreConnectionsPerHostV2
402
+ maxRequestsPerConnection = maxRequestsPerConnectionV2
403
+ }
404
+
405
+ if (client.options.queryOptions.consistency === undefined) {
406
+ client.options.queryOptions.consistency = client.metadata.isDbaas()
407
+ ? types.consistencies.localQuorum
408
+ : types.consistencies.localOne
409
+ }
410
+
411
+ client.options.pooling = utils.deepExtend(
412
+ {},
413
+ { coreConnectionsPerHost, maxRequestsPerConnection },
414
+ client.options.pooling,
415
+ )
416
+ }
417
+
418
+ export {
419
+ extend,
420
+ defaultOptions,
421
+ coreConnectionsPerHostV2,
422
+ coreConnectionsPerHostV3,
423
+ maxRequestsPerConnectionV2,
424
+ maxRequestsPerConnectionV3,
425
+ setMetadataDependent,
426
+ continuousPageUnitBytes,
427
+ continuousPageDefaultSize,
428
+ continuousPageDefaultHighWaterMark,
429
+ }
430
+
431
+ export default {
432
+ extend,
433
+ defaultOptions,
434
+ coreConnectionsPerHostV2,
435
+ coreConnectionsPerHostV3,
436
+ maxRequestsPerConnectionV2,
437
+ maxRequestsPerConnectionV3,
438
+ setMetadataDependent,
439
+ continuousPageUnitBytes,
440
+ continuousPageDefaultSize,
441
+ continuousPageDefaultHighWaterMark,
442
+ }