@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.
- package/batch/index.d.ts +3 -3
- package/batch/index.d.ts.map +1 -1
- package/client.d.ts +6 -5
- package/client.d.ts.map +1 -1
- package/client.js +11 -12
- package/client.js.map +1 -1
- package/cql_gen/create_table.d.ts +1 -1
- package/cql_gen/create_table.d.ts.map +1 -1
- package/document/index.d.ts +3 -3
- package/document/index.d.ts.map +1 -1
- package/driver/LICENSE.txt +177 -0
- package/driver/NOTICE.txt +67 -0
- package/driver/auth/index.d.ts +37 -0
- package/driver/auth/index.js +37 -0
- package/driver/auth/no-auth-provider.js +73 -0
- package/driver/auth/plain-text-auth-provider.js +81 -0
- package/driver/auth/provider.js +77 -0
- package/driver/client-options.js +442 -0
- package/driver/client.js +1267 -0
- package/driver/concurrent/index.d.ts +49 -0
- package/driver/concurrent/index.js +366 -0
- package/driver/connection.js +1034 -0
- package/driver/control-connection.js +1282 -0
- package/driver/encoder.js +2316 -0
- package/driver/errors.js +223 -0
- package/driver/execution-options.js +612 -0
- package/driver/execution-profile.js +274 -0
- package/driver/host-connection-pool.js +587 -0
- package/driver/host.js +699 -0
- package/driver/index.d.ts +387 -0
- package/driver/index.js +81 -0
- package/driver/mapping/cache.js +214 -0
- package/driver/mapping/doc-info-adapter.js +171 -0
- package/driver/mapping/index.d.ts +219 -0
- package/driver/mapping/index.js +57 -0
- package/driver/mapping/mapper.js +225 -0
- package/driver/mapping/mapping-handler.js +641 -0
- package/driver/mapping/model-batch-item.js +215 -0
- package/driver/mapping/model-batch-mapper.js +141 -0
- package/driver/mapping/model-mapper.js +315 -0
- package/driver/mapping/model-mapping-info.js +225 -0
- package/driver/mapping/object-selector.js +417 -0
- package/driver/mapping/q.js +156 -0
- package/driver/mapping/query-generator.js +556 -0
- package/driver/mapping/result-mapper.js +123 -0
- package/driver/mapping/result.js +139 -0
- package/driver/mapping/table-mappings.js +133 -0
- package/driver/mapping/tree.js +160 -0
- package/driver/metadata/aggregate.js +79 -0
- package/driver/metadata/client-state.js +119 -0
- package/driver/metadata/data-collection.js +182 -0
- package/driver/metadata/event-debouncer.js +174 -0
- package/driver/metadata/index.d.ts +276 -0
- package/driver/metadata/index.js +1156 -0
- package/driver/metadata/materialized-view.js +49 -0
- package/driver/metadata/schema-function.js +98 -0
- package/driver/metadata/schema-index.js +166 -0
- package/driver/metadata/schema-parser.js +1399 -0
- package/driver/metadata/table-metadata.js +77 -0
- package/driver/operation-state.js +206 -0
- package/driver/policies/address-resolution.js +145 -0
- package/driver/policies/index.d.ts +241 -0
- package/driver/policies/index.js +110 -0
- package/driver/policies/load-balancing.js +970 -0
- package/driver/policies/reconnection.js +166 -0
- package/driver/policies/retry.js +326 -0
- package/driver/policies/speculative-execution.js +150 -0
- package/driver/policies/timestamp-generation.js +176 -0
- package/driver/prepare-handler.js +347 -0
- package/driver/promise-utils.js +191 -0
- package/driver/readers.js +624 -0
- package/driver/request-execution.js +644 -0
- package/driver/request-handler.js +332 -0
- package/driver/requests.js +618 -0
- package/driver/stream-id-stack.js +209 -0
- package/driver/streams.js +745 -0
- package/driver/token.js +325 -0
- package/driver/tokenizer.js +631 -0
- package/driver/types/big-decimal.js +282 -0
- package/driver/types/duration.js +576 -0
- package/driver/types/index.d.ts +486 -0
- package/driver/types/index.js +733 -0
- package/driver/types/inet-address.js +262 -0
- package/driver/types/integer.js +818 -0
- package/driver/types/local-date.js +280 -0
- package/driver/types/local-time.js +299 -0
- package/driver/types/mutable-long.js +385 -0
- package/driver/types/protocol-version.js +391 -0
- package/driver/types/result-set.js +287 -0
- package/driver/types/result-stream.js +164 -0
- package/driver/types/row.js +85 -0
- package/driver/types/time-uuid.js +414 -0
- package/driver/types/tuple.js +103 -0
- package/driver/types/uuid.js +160 -0
- package/driver/types/vector.js +130 -0
- package/driver/types/version-number.js +153 -0
- package/driver/utils.js +1485 -0
- package/driver/writers.js +350 -0
- package/global.d.ts +1 -1
- package/global.d.ts.map +1 -1
- package/index.d.ts +6 -6
- package/index.d.ts.map +1 -1
- package/index.js +6 -6
- package/index.js.map +1 -1
- package/migrate/index.d.ts +1 -1
- package/migrate/index.d.ts.map +1 -1
- package/migrate/index.js +1 -1
- package/migrate/index.js.map +1 -1
- package/model/index.d.ts +6 -6
- package/model/index.d.ts.map +1 -1
- package/model/index.js +10 -10
- package/model/index.js.map +1 -1
- package/operations/countAll.d.ts +1 -1
- package/operations/countAll.d.ts.map +1 -1
- package/operations/delete.d.ts +3 -4
- package/operations/delete.d.ts.map +1 -1
- package/operations/delete.js +1 -1
- package/operations/delete.js.map +1 -1
- package/operations/find.d.ts +2 -2
- package/operations/find.d.ts.map +1 -1
- package/operations/find.js +1 -1
- package/operations/find.js.map +1 -1
- package/operations/findOne.d.ts +2 -2
- package/operations/findOne.d.ts.map +1 -1
- package/operations/findOne.js +1 -1
- package/operations/findOne.js.map +1 -1
- package/operations/insert.d.ts +3 -3
- package/operations/insert.d.ts.map +1 -1
- package/operations/insert.js +2 -2
- package/operations/insert.js.map +1 -1
- package/operations/sync.d.ts +1 -1
- package/operations/sync.d.ts.map +1 -1
- package/operations/sync.js +1 -1
- package/operations/sync.js.map +1 -1
- package/operations/tableExists.d.ts +1 -1
- package/operations/tableExists.d.ts.map +1 -1
- package/operations/update.d.ts +3 -3
- package/operations/update.d.ts.map +1 -1
- package/operations/update.js +2 -2
- package/operations/update.js.map +1 -1
- package/package.json +4 -12
- package/schema/index.d.ts +1 -1
- package/schema/index.d.ts.map +1 -1
- package/types.d.ts +4 -4
- package/types.d.ts.map +1 -1
- package/utils/queryParser.d.ts +1 -1
- package/utils/queryParser.d.ts.map +1 -1
- package/utils/queryParser.js +1 -1
- package/utils/queryParser.js.map +1 -1
- package/utils/typeChecker.d.ts +1 -1
- package/utils/typeChecker.d.ts.map +1 -1
- package/utils/typeChecker.js +1 -1
- package/utils/typeChecker.js.map +1 -1
package/driver/errors.js
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
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
|
+
/**
|
|
20
|
+
* Contains the error classes exposed by the driver.
|
|
21
|
+
* @module errors
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Base Error
|
|
26
|
+
* @private
|
|
27
|
+
*/
|
|
28
|
+
function DriverError(message) {
|
|
29
|
+
Error.call(this, message)
|
|
30
|
+
Error.captureStackTrace(this, this.constructor)
|
|
31
|
+
this.name = this.constructor.name
|
|
32
|
+
this.info = "Cassandra Driver Error"
|
|
33
|
+
// Explicitly set the message property as the Error.call() doesn't set the property on v8
|
|
34
|
+
this.message = message
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
util.inherits(DriverError, Error)
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Represents an error when a query cannot be performed because no host is available or could be reached by the driver.
|
|
41
|
+
* @param {Object} innerErrors An object map containing the error per host tried
|
|
42
|
+
* @param {String} [message]
|
|
43
|
+
* @constructor
|
|
44
|
+
*/
|
|
45
|
+
function NoHostAvailableError(innerErrors, message) {
|
|
46
|
+
DriverError.call(this, message)
|
|
47
|
+
this.innerErrors = innerErrors
|
|
48
|
+
this.info =
|
|
49
|
+
"Represents an error when a query cannot be performed because no host is available or could be reached by the driver."
|
|
50
|
+
if (!message) {
|
|
51
|
+
this.message = "All host(s) tried for query failed."
|
|
52
|
+
if (innerErrors) {
|
|
53
|
+
const hostList = Object.keys(innerErrors)
|
|
54
|
+
if (hostList.length > 0) {
|
|
55
|
+
const host = hostList[0]
|
|
56
|
+
this.message += util.format(
|
|
57
|
+
" First host tried, %s: %s. See innerErrors.",
|
|
58
|
+
host,
|
|
59
|
+
innerErrors[host],
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
util.inherits(NoHostAvailableError, DriverError)
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Represents an error message from the server
|
|
70
|
+
* @param {Number} code Cassandra exception code
|
|
71
|
+
* @param {String} message
|
|
72
|
+
* @constructor
|
|
73
|
+
*/
|
|
74
|
+
function ResponseError(code, message) {
|
|
75
|
+
DriverError.call(this, message)
|
|
76
|
+
/**
|
|
77
|
+
* The error code as defined in [responseErrorCodes]{@link module:types~responseErrorCodes}.
|
|
78
|
+
* @type {Number}
|
|
79
|
+
*/
|
|
80
|
+
this.code = code
|
|
81
|
+
this.info = "Represents an error message from the server"
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
util.inherits(ResponseError, DriverError)
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Represents a bug inside the driver or in a Cassandra host.
|
|
88
|
+
* @param {String} message
|
|
89
|
+
* @constructor
|
|
90
|
+
*/
|
|
91
|
+
function DriverInternalError(message) {
|
|
92
|
+
DriverError.call(this, message)
|
|
93
|
+
this.info = "Represents a bug inside the driver or in a Cassandra host."
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
util.inherits(DriverInternalError, DriverError)
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Represents an error when trying to authenticate with auth-enabled host
|
|
100
|
+
* @param {String} message
|
|
101
|
+
* @constructor
|
|
102
|
+
*/
|
|
103
|
+
function AuthenticationError(message) {
|
|
104
|
+
DriverError.call(this, message)
|
|
105
|
+
this.info =
|
|
106
|
+
"Represents an authentication error from the driver or from a Cassandra node."
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
util.inherits(AuthenticationError, DriverError)
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Represents an error that is raised when one of the arguments provided to a method is not valid
|
|
113
|
+
* @param {String} message
|
|
114
|
+
* @constructor
|
|
115
|
+
*/
|
|
116
|
+
function ArgumentError(message) {
|
|
117
|
+
DriverError.call(this, message)
|
|
118
|
+
this.info =
|
|
119
|
+
"Represents an error that is raised when one of the arguments provided to a method is not valid."
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
util.inherits(ArgumentError, DriverError)
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Represents a client-side error that is raised when the client didn't hear back from the server within
|
|
126
|
+
* {@link ClientOptions.socketOptions.readTimeout}.
|
|
127
|
+
* @param {String} message The error message.
|
|
128
|
+
* @param {String} [host] Address of the server host that caused the operation to time out.
|
|
129
|
+
* @constructor
|
|
130
|
+
*/
|
|
131
|
+
function OperationTimedOutError(message, host) {
|
|
132
|
+
DriverError.call(this, message, this.constructor)
|
|
133
|
+
this.info =
|
|
134
|
+
"Represents a client-side error that is raised when the client did not hear back from the server " +
|
|
135
|
+
"within socketOptions.readTimeout"
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* When defined, it gets the address of the host that caused the operation to time out.
|
|
139
|
+
* @type {String|undefined}
|
|
140
|
+
*/
|
|
141
|
+
this.host = host
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
util.inherits(OperationTimedOutError, DriverError)
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Represents an error that is raised when a feature is not supported in the driver or in the current Cassandra version.
|
|
148
|
+
* @param message
|
|
149
|
+
* @constructor
|
|
150
|
+
*/
|
|
151
|
+
function NotSupportedError(message) {
|
|
152
|
+
DriverError.call(this, message, this.constructor)
|
|
153
|
+
this.info =
|
|
154
|
+
"Represents a feature that is not supported in the driver or in the Cassandra version."
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
util.inherits(NotSupportedError, DriverError)
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Represents a client-side error indicating that all connections to a certain host have reached
|
|
161
|
+
* the maximum amount of in-flight requests supported.
|
|
162
|
+
* @param {String} address
|
|
163
|
+
* @param {Number} maxRequestsPerConnection
|
|
164
|
+
* @param {Number} connectionLength
|
|
165
|
+
* @constructor
|
|
166
|
+
*/
|
|
167
|
+
function BusyConnectionError(
|
|
168
|
+
address,
|
|
169
|
+
maxRequestsPerConnection,
|
|
170
|
+
connectionLength,
|
|
171
|
+
) {
|
|
172
|
+
const message = util.format(
|
|
173
|
+
"All connections to host %s are busy, %d requests are in-flight on %s",
|
|
174
|
+
address,
|
|
175
|
+
maxRequestsPerConnection,
|
|
176
|
+
connectionLength === 1 ? "a single connection" : "each connection",
|
|
177
|
+
)
|
|
178
|
+
DriverError.call(this, message, this.constructor)
|
|
179
|
+
this.info =
|
|
180
|
+
"Represents a client-side error indicating that all connections to a certain host have reached " +
|
|
181
|
+
"the maximum amount of in-flight requests supported (pooling.maxRequestsPerConnection)"
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
util.inherits(BusyConnectionError, DriverError)
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
*
|
|
188
|
+
* @param {Long} long
|
|
189
|
+
*/
|
|
190
|
+
function VIntOutOfRangeException(long) {
|
|
191
|
+
const message = `Value ${long.toString} is out of range for a JavaScript Number`
|
|
192
|
+
DriverError.call(this, message, this.constructor)
|
|
193
|
+
this.info =
|
|
194
|
+
"Represents a run-time exception when attempting to decode a vint and the JavaScript Number doesn't have enough space to fit the value that was decoded"
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
util.inherits(VIntOutOfRangeException, DriverError)
|
|
198
|
+
|
|
199
|
+
export {
|
|
200
|
+
ArgumentError,
|
|
201
|
+
AuthenticationError,
|
|
202
|
+
BusyConnectionError,
|
|
203
|
+
DriverError,
|
|
204
|
+
OperationTimedOutError,
|
|
205
|
+
DriverInternalError,
|
|
206
|
+
NoHostAvailableError,
|
|
207
|
+
NotSupportedError,
|
|
208
|
+
ResponseError,
|
|
209
|
+
VIntOutOfRangeException,
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export default {
|
|
213
|
+
ArgumentError,
|
|
214
|
+
AuthenticationError,
|
|
215
|
+
BusyConnectionError,
|
|
216
|
+
DriverError,
|
|
217
|
+
OperationTimedOutError,
|
|
218
|
+
DriverInternalError,
|
|
219
|
+
NoHostAvailableError,
|
|
220
|
+
NotSupportedError,
|
|
221
|
+
ResponseError,
|
|
222
|
+
VIntOutOfRangeException,
|
|
223
|
+
}
|