@ragestudio/scylla-odm 0.22.0 → 0.22.2
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 +19 -21
- package/batch/index.d.ts.map +1 -0
- package/batch/index.js +37 -1
- package/batch/index.js.map +1 -0
- package/client.d.ts +24 -27
- package/client.d.ts.map +1 -0
- package/client.js +190 -1
- package/client.js.map +1 -0
- package/cql_gen/create_keyspace.d.ts +8 -9
- package/cql_gen/create_keyspace.d.ts.map +1 -0
- package/cql_gen/create_keyspace.js +14 -1
- package/cql_gen/create_keyspace.js.map +1 -0
- package/cql_gen/create_table.d.ts +3 -6
- package/cql_gen/create_table.d.ts.map +1 -0
- package/cql_gen/create_table.js +51 -1
- package/cql_gen/create_table.js.map +1 -0
- package/document/index.d.ts +11 -14
- package/document/index.d.ts.map +1 -0
- package/document/index.js +76 -1
- package/document/index.js.map +1 -0
- package/global.d.ts +6 -0
- package/global.d.ts.map +1 -0
- package/global.js +2 -0
- package/global.js.map +1 -0
- package/index.d.ts +9 -7
- package/index.d.ts.map +1 -0
- package/index.js +9 -1
- package/index.js.map +1 -0
- package/logger/index.d.ts +7 -8
- package/logger/index.d.ts.map +1 -0
- package/logger/index.js +14 -1
- package/logger/index.js.map +1 -0
- package/migrate/index.d.ts +12 -14
- package/migrate/index.d.ts.map +1 -0
- package/migrate/index.js +254 -4
- package/migrate/index.js.map +1 -0
- package/model/index.d.ts +64 -67
- package/model/index.d.ts.map +1 -0
- package/model/index.js +71 -1
- package/model/index.js.map +1 -0
- package/operations/countAll.d.ts +3 -6
- package/operations/countAll.d.ts.map +1 -0
- package/operations/countAll.js +13 -1
- package/operations/countAll.js.map +1 -0
- package/operations/delete.d.ts +5 -8
- package/operations/delete.d.ts.map +1 -0
- package/operations/delete.js +23 -1
- package/operations/delete.js.map +1 -0
- package/operations/find.d.ts +4 -7
- package/operations/find.d.ts.map +1 -0
- package/operations/find.js +19 -1
- package/operations/find.js.map +1 -0
- package/operations/findOne.d.ts +4 -7
- package/operations/findOne.d.ts.map +1 -0
- package/operations/findOne.js +21 -1
- package/operations/findOne.js.map +1 -0
- package/operations/insert.d.ts +5 -8
- package/operations/insert.d.ts.map +1 -0
- package/operations/insert.js +24 -1
- package/operations/insert.js.map +1 -0
- package/operations/sync.d.ts +3 -6
- package/operations/sync.d.ts.map +1 -0
- package/operations/sync.js +16 -1
- package/operations/sync.js.map +1 -0
- package/operations/tableExists.d.ts +3 -6
- package/operations/tableExists.d.ts.map +1 -0
- package/operations/tableExists.js +15 -2
- package/operations/tableExists.js.map +1 -0
- package/operations/update.d.ts +5 -8
- package/operations/update.d.ts.map +1 -0
- package/operations/update.js +35 -1
- package/operations/update.js.map +1 -0
- package/package.json +13 -3
- package/schema/index.d.ts +13 -15
- package/schema/index.d.ts.map +1 -0
- package/schema/index.js +23 -1
- package/schema/index.js.map +1 -0
- package/types.d.ts +98 -84
- package/types.d.ts.map +1 -0
- package/types.js +33 -1
- package/types.js.map +1 -0
- package/utils/buildMapper.d.ts +12 -4
- package/utils/buildMapper.d.ts.map +1 -0
- package/utils/buildMapper.js +11 -1
- package/utils/buildMapper.js.map +1 -0
- package/utils/delay.d.ts +3 -4
- package/utils/delay.d.ts.map +1 -0
- package/utils/delay.js +5 -1
- package/utils/delay.js.map +1 -0
- package/utils/fillDefaults.d.ts +2 -4
- package/utils/fillDefaults.d.ts.map +1 -0
- package/utils/fillDefaults.js +24 -1
- package/utils/fillDefaults.js.map +1 -0
- package/utils/isPlainObject.d.ts +3 -4
- package/utils/isPlainObject.d.ts.map +1 -0
- package/utils/isPlainObject.js +11 -1
- package/utils/isPlainObject.js.map +1 -0
- package/utils/loadModels.d.ts +3 -4
- package/utils/loadModels.d.ts.map +1 -0
- package/utils/loadModels.js +29 -1
- package/utils/loadModels.js.map +1 -0
- package/utils/queryParser.d.ts +5 -8
- package/utils/queryParser.d.ts.map +1 -0
- package/utils/queryParser.js +102 -1
- package/utils/queryParser.js.map +1 -0
- package/utils/typeChecker.d.ts +3 -6
- package/utils/typeChecker.d.ts.map +1 -0
- package/utils/typeChecker.js +90 -1
- package/utils/typeChecker.js.map +1 -0
- package/driver/auth/index.d.ts +0 -34
- package/driver/auth/index.js +0 -1
- package/driver/auth/no-auth-provider.js +0 -1
- package/driver/auth/plain-text-auth-provider.js +0 -1
- package/driver/auth/provider.js +0 -1
- package/driver/client-options.js +0 -1
- package/driver/client.js +0 -1
- package/driver/concurrent/index.d.ts +0 -1
- package/driver/concurrent/index.js +0 -1
- package/driver/connection.js +0 -1
- package/driver/control-connection.js +0 -1
- package/driver/encoder.js +0 -1
- package/driver/errors.js +0 -1
- package/driver/execution-options.js +0 -1
- package/driver/execution-profile.js +0 -1
- package/driver/host-connection-pool.js +0 -1
- package/driver/host.js +0 -1
- package/driver/index.d.ts +0 -212
- package/driver/index.js +0 -1
- package/driver/mapping/cache.js +0 -1
- package/driver/mapping/doc-info-adapter.js +0 -1
- package/driver/mapping/index.d.ts +0 -142
- package/driver/mapping/index.js +0 -1
- package/driver/mapping/mapper.js +0 -1
- package/driver/mapping/mapping-handler.js +0 -1
- package/driver/mapping/model-batch-item.js +0 -1
- package/driver/mapping/model-batch-mapper.js +0 -1
- package/driver/mapping/model-mapper.js +0 -1
- package/driver/mapping/model-mapping-info.js +0 -1
- package/driver/mapping/object-selector.js +0 -1
- package/driver/mapping/q.js +0 -1
- package/driver/mapping/query-generator.js +0 -9
- package/driver/mapping/result-mapper.js +0 -4
- package/driver/mapping/result.js +0 -1
- package/driver/mapping/table-mappings.js +0 -1
- package/driver/mapping/tree.js +0 -1
- package/driver/metadata/aggregate.js +0 -1
- package/driver/metadata/client-state.js +0 -1
- package/driver/metadata/data-collection.js +0 -1
- package/driver/metadata/event-debouncer.js +0 -1
- package/driver/metadata/index.d.ts +0 -184
- package/driver/metadata/index.js +0 -1
- package/driver/metadata/materialized-view.js +0 -1
- package/driver/metadata/schema-function.js +0 -1
- package/driver/metadata/schema-index.js +0 -1
- package/driver/metadata/schema-parser.js +0 -1
- package/driver/metadata/table-metadata.js +0 -1
- package/driver/operation-state.js +0 -1
- package/driver/policies/address-resolution.js +0 -1
- package/driver/policies/index.d.ts +0 -135
- package/driver/policies/index.js +0 -1
- package/driver/policies/load-balancing.js +0 -1
- package/driver/policies/reconnection.js +0 -1
- package/driver/policies/retry.js +0 -1
- package/driver/policies/speculative-execution.js +0 -1
- package/driver/policies/timestamp-generation.js +0 -1
- package/driver/prepare-handler.js +0 -1
- package/driver/promise-utils.js +0 -1
- package/driver/readers.js +0 -1
- package/driver/request-execution.js +0 -1
- package/driver/request-handler.js +0 -1
- package/driver/requests.js +0 -1
- package/driver/stream-id-stack.js +0 -1
- package/driver/streams.js +0 -1
- package/driver/token.js +0 -1
- package/driver/tokenizer.js +0 -1
- package/driver/types/big-decimal.js +0 -1
- package/driver/types/duration.js +0 -1
- package/driver/types/index.d.ts +0 -320
- package/driver/types/index.js +0 -1
- package/driver/types/inet-address.js +0 -1
- package/driver/types/integer.js +0 -1
- package/driver/types/local-date.js +0 -1
- package/driver/types/local-time.js +0 -1
- package/driver/types/mutable-long.js +0 -1
- package/driver/types/protocol-version.js +0 -1
- package/driver/types/result-set.js +0 -1
- package/driver/types/result-stream.js +0 -1
- package/driver/types/row.js +0 -1
- package/driver/types/time-uuid.js +0 -1
- package/driver/types/tuple.js +0 -1
- package/driver/types/uuid.js +0 -1
- package/driver/types/vector.js +0 -1
- package/driver/types/version-number.js +0 -1
- package/driver/utils.js +0 -4
- package/driver/writers.js +0 -1
- package/package.js +0 -1
package/driver/types/index.d.ts
DELETED
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
import { ValueCallback } from "../index.js";
|
|
2
|
-
import _Long from "long";
|
|
3
|
-
import * as stream from "stream";
|
|
4
|
-
|
|
5
|
-
//#region src/driver/types/index.d.ts
|
|
6
|
-
declare namespace types {
|
|
7
|
-
class Long extends _Long {}
|
|
8
|
-
enum consistencies {
|
|
9
|
-
any = 0x00,
|
|
10
|
-
one = 0x01,
|
|
11
|
-
two = 0x02,
|
|
12
|
-
three = 0x03,
|
|
13
|
-
quorum = 0x04,
|
|
14
|
-
all = 0x05,
|
|
15
|
-
localQuorum = 0x06,
|
|
16
|
-
eachQuorum = 0x07,
|
|
17
|
-
serial = 0x08,
|
|
18
|
-
localSerial = 0x09,
|
|
19
|
-
localOne = 0x0a
|
|
20
|
-
}
|
|
21
|
-
enum dataTypes {
|
|
22
|
-
custom = 0x0000,
|
|
23
|
-
ascii = 0x0001,
|
|
24
|
-
bigint = 0x0002,
|
|
25
|
-
blob = 0x0003,
|
|
26
|
-
boolean = 0x0004,
|
|
27
|
-
counter = 0x0005,
|
|
28
|
-
decimal = 0x0006,
|
|
29
|
-
double = 0x0007,
|
|
30
|
-
float = 0x0008,
|
|
31
|
-
int = 0x0009,
|
|
32
|
-
text = 0x000a,
|
|
33
|
-
timestamp = 0x000b,
|
|
34
|
-
uuid = 0x000c,
|
|
35
|
-
varchar = 0x000d,
|
|
36
|
-
varint = 0x000e,
|
|
37
|
-
timeuuid = 0x000f,
|
|
38
|
-
inet = 0x0010,
|
|
39
|
-
date = 0x0011,
|
|
40
|
-
time = 0x0012,
|
|
41
|
-
smallint = 0x0013,
|
|
42
|
-
tinyint = 0x0014,
|
|
43
|
-
duration = 0x0015,
|
|
44
|
-
list = 0x0020,
|
|
45
|
-
map = 0x0021,
|
|
46
|
-
set = 0x0022,
|
|
47
|
-
udt = 0x0030,
|
|
48
|
-
tuple = 0x0031
|
|
49
|
-
}
|
|
50
|
-
enum distance {
|
|
51
|
-
local = 0,
|
|
52
|
-
remote,
|
|
53
|
-
ignored
|
|
54
|
-
}
|
|
55
|
-
enum responseErrorCodes {
|
|
56
|
-
serverError = 0x0000,
|
|
57
|
-
protocolError = 0x000a,
|
|
58
|
-
badCredentials = 0x0100,
|
|
59
|
-
unavailableException = 0x1000,
|
|
60
|
-
overloaded = 0x1001,
|
|
61
|
-
isBootstrapping = 0x1002,
|
|
62
|
-
truncateError = 0x1003,
|
|
63
|
-
writeTimeout = 0x1100,
|
|
64
|
-
readTimeout = 0x1200,
|
|
65
|
-
readFailure = 0x1300,
|
|
66
|
-
functionFailure = 0x1400,
|
|
67
|
-
writeFailure = 0x1500,
|
|
68
|
-
syntaxError = 0x2000,
|
|
69
|
-
unauthorized = 0x2100,
|
|
70
|
-
invalid = 0x2200,
|
|
71
|
-
configError = 0x2300,
|
|
72
|
-
alreadyExists = 0x2400,
|
|
73
|
-
unprepared = 0x2500,
|
|
74
|
-
clientWriteFailure = 0x8000
|
|
75
|
-
}
|
|
76
|
-
enum protocolVersion {
|
|
77
|
-
v1 = 0x01,
|
|
78
|
-
v2 = 0x02,
|
|
79
|
-
v3 = 0x03,
|
|
80
|
-
v4 = 0x04,
|
|
81
|
-
v5 = 0x05,
|
|
82
|
-
v6 = 0x06,
|
|
83
|
-
dseV1 = 0x41,
|
|
84
|
-
dseV2 = 0x42,
|
|
85
|
-
maxSupported = dseV2,
|
|
86
|
-
minSupported = v1
|
|
87
|
-
}
|
|
88
|
-
namespace protocolVersion {
|
|
89
|
-
function isSupported(version: protocolVersion): boolean;
|
|
90
|
-
}
|
|
91
|
-
const unset: object;
|
|
92
|
-
class BigDecimal {
|
|
93
|
-
constructor(unscaledValue: number, scale: number);
|
|
94
|
-
static fromBuffer(buf: Buffer): BigDecimal;
|
|
95
|
-
static fromString(value: string): BigDecimal;
|
|
96
|
-
static toBuffer(value: BigDecimal): Buffer;
|
|
97
|
-
static fromNumber(value: number): BigDecimal;
|
|
98
|
-
add(other: BigDecimal): BigDecimal;
|
|
99
|
-
compare(other: BigDecimal): number;
|
|
100
|
-
equals(other: BigDecimal): boolean;
|
|
101
|
-
greaterThan(other: BigDecimal): boolean;
|
|
102
|
-
isNegative(): boolean;
|
|
103
|
-
isZero(): boolean;
|
|
104
|
-
notEquals(other: BigDecimal): boolean;
|
|
105
|
-
subtract(other: BigDecimal): BigDecimal;
|
|
106
|
-
toNumber(): number;
|
|
107
|
-
toString(): string;
|
|
108
|
-
toJSON(): string;
|
|
109
|
-
}
|
|
110
|
-
class Duration {
|
|
111
|
-
constructor(month: number, days: number, nanoseconds: number | Long);
|
|
112
|
-
static fromBuffer(buffer: Buffer): Duration;
|
|
113
|
-
static fromString(input: string): Duration;
|
|
114
|
-
equals(other: Duration): boolean;
|
|
115
|
-
toBuffer(): Buffer;
|
|
116
|
-
toString(): string;
|
|
117
|
-
}
|
|
118
|
-
class InetAddress {
|
|
119
|
-
length: number;
|
|
120
|
-
version: number;
|
|
121
|
-
constructor(buffer: Buffer);
|
|
122
|
-
static fromString(value: string): InetAddress;
|
|
123
|
-
equals(other: InetAddress): boolean;
|
|
124
|
-
getBuffer(): Buffer;
|
|
125
|
-
toString(): string;
|
|
126
|
-
toJSON(): string;
|
|
127
|
-
}
|
|
128
|
-
class Integer {
|
|
129
|
-
static ONE: Integer;
|
|
130
|
-
static ZERO: Integer;
|
|
131
|
-
constructor(bits: Array<number>, sign: number);
|
|
132
|
-
static fromBits(bits: Array<number>): Integer;
|
|
133
|
-
static fromBuffer(bits: Buffer): Integer;
|
|
134
|
-
static fromInt(value: number): Integer;
|
|
135
|
-
static fromNumber(value: number): Integer;
|
|
136
|
-
static fromString(str: string, opt_radix?: number): Integer;
|
|
137
|
-
static toBuffer(value: Integer): Buffer;
|
|
138
|
-
abs(): Integer;
|
|
139
|
-
add(other: Integer): Integer;
|
|
140
|
-
compare(other: Integer): number;
|
|
141
|
-
divide(other: Integer): Integer;
|
|
142
|
-
equals(other: Integer): boolean;
|
|
143
|
-
getBits(index: number): number;
|
|
144
|
-
getBitsUnsigned(index: number): number;
|
|
145
|
-
getSign(): number;
|
|
146
|
-
greaterThan(other: Integer): boolean;
|
|
147
|
-
greaterThanOrEqual(other: Integer): boolean;
|
|
148
|
-
isNegative(): boolean;
|
|
149
|
-
isOdd(): boolean;
|
|
150
|
-
isZero(): boolean;
|
|
151
|
-
lessThan(other: Integer): boolean;
|
|
152
|
-
lessThanOrEqual(other: Integer): boolean;
|
|
153
|
-
modulo(other: Integer): Integer;
|
|
154
|
-
multiply(other: Integer): Integer;
|
|
155
|
-
negate(): Integer;
|
|
156
|
-
not(): Integer;
|
|
157
|
-
notEquals(other: Integer): boolean;
|
|
158
|
-
or(other: Integer): Integer;
|
|
159
|
-
shiftLeft(numBits: number): Integer;
|
|
160
|
-
shiftRight(numBits: number): Integer;
|
|
161
|
-
shorten(numBits: number): Integer;
|
|
162
|
-
subtract(other: Integer): Integer;
|
|
163
|
-
toInt(): number;
|
|
164
|
-
toJSON(): string;
|
|
165
|
-
toNumber(): number;
|
|
166
|
-
toString(opt_radix?: number): string;
|
|
167
|
-
xor(other: Integer): Integer;
|
|
168
|
-
}
|
|
169
|
-
class LocalDate {
|
|
170
|
-
year: number;
|
|
171
|
-
month: number;
|
|
172
|
-
day: number;
|
|
173
|
-
constructor(year: number, month: number, day: number);
|
|
174
|
-
static fromDate(date: Date): LocalDate;
|
|
175
|
-
static fromString(value: string): LocalDate;
|
|
176
|
-
static fromBuffer(buffer: Buffer): LocalDate;
|
|
177
|
-
static now(): LocalDate;
|
|
178
|
-
static utcNow(): LocalDate;
|
|
179
|
-
equals(other: LocalDate): boolean;
|
|
180
|
-
inspect(): string;
|
|
181
|
-
toBuffer(): Buffer;
|
|
182
|
-
toJSON(): string;
|
|
183
|
-
toString(): string;
|
|
184
|
-
}
|
|
185
|
-
class LocalTime {
|
|
186
|
-
hour: number;
|
|
187
|
-
minute: number;
|
|
188
|
-
nanosecond: number;
|
|
189
|
-
second: number;
|
|
190
|
-
constructor(totalNanoseconds: Long);
|
|
191
|
-
static fromBuffer(value: Buffer): LocalTime;
|
|
192
|
-
static fromDate(date: Date, nanoseconds: number): LocalTime;
|
|
193
|
-
static fromMilliseconds(milliseconds: number, nanoseconds?: number): LocalTime;
|
|
194
|
-
static fromString(value: string): LocalTime;
|
|
195
|
-
static now(nanoseconds?: number): LocalTime;
|
|
196
|
-
compare(other: LocalTime): boolean;
|
|
197
|
-
equals(other: LocalTime): boolean;
|
|
198
|
-
getTotalNanoseconds(): Long;
|
|
199
|
-
inspect(): string;
|
|
200
|
-
toBuffer(): Buffer;
|
|
201
|
-
toJSON(): string;
|
|
202
|
-
toString(): string;
|
|
203
|
-
}
|
|
204
|
-
interface ResultSet extends Iterable<Row>, AsyncIterable<Row> {
|
|
205
|
-
info: {
|
|
206
|
-
queriedHost: string;
|
|
207
|
-
triedHosts: {
|
|
208
|
-
[key: string]: any;
|
|
209
|
-
};
|
|
210
|
-
speculativeExecutions: number;
|
|
211
|
-
achievedConsistency: consistencies;
|
|
212
|
-
traceId: Uuid;
|
|
213
|
-
warnings: string[];
|
|
214
|
-
customPayload: any;
|
|
215
|
-
};
|
|
216
|
-
columns: Array<{
|
|
217
|
-
name: string;
|
|
218
|
-
type: {
|
|
219
|
-
code: dataTypes;
|
|
220
|
-
info: any;
|
|
221
|
-
};
|
|
222
|
-
}>;
|
|
223
|
-
nextPage: (() => void) | null;
|
|
224
|
-
pageState: string;
|
|
225
|
-
rowLength: number;
|
|
226
|
-
rows: Row[];
|
|
227
|
-
first(): Row;
|
|
228
|
-
wasApplied(): boolean;
|
|
229
|
-
}
|
|
230
|
-
interface ResultStream extends stream.Readable {
|
|
231
|
-
buffer: Buffer;
|
|
232
|
-
paused: boolean;
|
|
233
|
-
add(chunk: Buffer): void;
|
|
234
|
-
}
|
|
235
|
-
interface Row {
|
|
236
|
-
get(columnName: string | number): any;
|
|
237
|
-
keys(): string[];
|
|
238
|
-
forEach(callback: (row: Row) => void): void;
|
|
239
|
-
values(): any[];
|
|
240
|
-
[key: string]: any;
|
|
241
|
-
}
|
|
242
|
-
class TimeUuid extends Uuid {
|
|
243
|
-
static now(): TimeUuid;
|
|
244
|
-
static now(nodeId: string | Buffer, clockId?: string | Buffer): TimeUuid;
|
|
245
|
-
static now(nodeId: string | Buffer, clockId: string | Buffer, callback: ValueCallback<TimeUuid>): void;
|
|
246
|
-
static now(callback: ValueCallback<TimeUuid>): void;
|
|
247
|
-
static fromDate(date: Date, ticks?: number, nodeId?: string | Buffer, clockId?: string | Buffer): TimeUuid;
|
|
248
|
-
static fromDate(date: Date, ticks: number, nodeId: string | Buffer, clockId: string | Buffer, callback: ValueCallback<TimeUuid>): void;
|
|
249
|
-
static fromString(value: string): TimeUuid;
|
|
250
|
-
static max(date: Date, ticks: number): TimeUuid;
|
|
251
|
-
static min(date: Date, ticks: number): TimeUuid;
|
|
252
|
-
getDatePrecision(): {
|
|
253
|
-
date: Date;
|
|
254
|
-
ticks: number;
|
|
255
|
-
};
|
|
256
|
-
getDate(): Date;
|
|
257
|
-
}
|
|
258
|
-
class Tuple {
|
|
259
|
-
elements: any[];
|
|
260
|
-
length: number;
|
|
261
|
-
constructor(...args: any[]);
|
|
262
|
-
static fromArray(elements: any[]): Tuple;
|
|
263
|
-
get(index: number): any;
|
|
264
|
-
toString(): string;
|
|
265
|
-
toJSON(): string;
|
|
266
|
-
values(): any[];
|
|
267
|
-
}
|
|
268
|
-
class Uuid {
|
|
269
|
-
constructor(buffer: Buffer);
|
|
270
|
-
static fromString(value: string): Uuid;
|
|
271
|
-
static random(callback: ValueCallback<Uuid>): void;
|
|
272
|
-
static random(): Uuid;
|
|
273
|
-
equals(other: Uuid): boolean;
|
|
274
|
-
getBuffer(): Buffer;
|
|
275
|
-
toString(): string;
|
|
276
|
-
toJSON(): string;
|
|
277
|
-
}
|
|
278
|
-
class Vector {
|
|
279
|
-
static get [Symbol.species](): typeof Vector;
|
|
280
|
-
/**
|
|
281
|
-
*
|
|
282
|
-
* @param {Float32Array | Array<any>} elements
|
|
283
|
-
* @param {string?} subtype
|
|
284
|
-
*/
|
|
285
|
-
constructor(elements: Float32Array | Array<any>, subtype?: string | null);
|
|
286
|
-
elements: any[];
|
|
287
|
-
/**
|
|
288
|
-
* Returns the number of the elements.
|
|
289
|
-
* @type Number
|
|
290
|
-
*/
|
|
291
|
-
length: number;
|
|
292
|
-
subtype: string;
|
|
293
|
-
/**
|
|
294
|
-
* Returns the string representation of the vector.
|
|
295
|
-
* @returns {string}
|
|
296
|
-
*/
|
|
297
|
-
toString(): string;
|
|
298
|
-
/**
|
|
299
|
-
*
|
|
300
|
-
* @param {number} index
|
|
301
|
-
*/
|
|
302
|
-
at(index: number): any;
|
|
303
|
-
/**
|
|
304
|
-
*
|
|
305
|
-
* @param {(value: any, index: number, array: any[]) => void} callback
|
|
306
|
-
*/
|
|
307
|
-
forEach(callback: (value: any, index: number, array: any[]) => void): void;
|
|
308
|
-
/**
|
|
309
|
-
* @returns {string | null} get the subtype string, e.g., "float", but it's optional so it can return null
|
|
310
|
-
*/
|
|
311
|
-
getSubtype(): string | null;
|
|
312
|
-
/**
|
|
313
|
-
*
|
|
314
|
-
* @returns {IterableIterator<any>}
|
|
315
|
-
*/
|
|
316
|
-
[Symbol.iterator](): IterableIterator<any>;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
//#endregion
|
|
320
|
-
export { types };
|
package/driver/types/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"../errors.js";import t from"../utils.js";import n from"./uuid.js";import r from"./time-uuid.js";import i from"./protocol-version.js";import a from"./integer.js";import o from"./big-decimal.js";import s from"./duration.js";import c from"./inet-address.js";import l from"./local-date.js";import u from"./local-time.js";import d from"./result-set.js";import f from"./result-stream.js";import p from"./row.js";import m from"./tuple.js";import h from"./vector.js";import g from"util";import _ from"long";const v={any:0,one:1,two:2,three:3,quorum:4,all:5,localQuorum:6,eachQuorum:7,serial:8,localSerial:9,localOne:10},y={};y[v.any]=`ANY`,y[v.one]=`ONE`,y[v.two]=`TWO`,y[v.three]=`THREE`,y[v.quorum]=`QUORUM`,y[v.all]=`ALL`,y[v.localQuorum]=`LOCAL_QUORUM`,y[v.eachQuorum]=`EACH_QUORUM`,y[v.serial]=`SERIAL`,y[v.localSerial]=`LOCAL_SERIAL`,y[v.localOne]=`LOCAL_ONE`;const b={custom:0,ascii:1,bigint:2,blob:3,boolean:4,counter:5,decimal:6,double:7,float:8,int:9,text:10,timestamp:11,uuid:12,varchar:13,varint:14,timeuuid:15,inet:16,date:17,time:18,smallint:19,tinyint:20,duration:21,list:32,map:33,set:34,udt:48,tuple:49,getByName:function(e){if(e=e.toLowerCase(),e.indexOf(`<`)>0){let t=/^(list|set)<(.+)>$/.exec(e);if(t)return{code:this[t[1]],info:this.getByName(t[2])};let n=/^(map)< *(.+) *, *(.+)>$/.exec(e);if(n)return{code:this[n[1]],info:[this.getByName(n[2]),this.getByName(n[3])]};let r=/^(udt)<(.+)>$/.exec(e);if(r)return{code:this[r[1]],info:r[2]};let i=/^(tuple)<(.+)>$/.exec(e);if(i)return{code:this[i[1]],info:i[2].split(`,`).map(function(e){return this.getByName(e.trim())},this)};let a=/^vector<\s*(.+)\s*,\s*(\d+)\s*>$/.exec(e);if(a)return{code:this.custom,customTypeName:`vector`,info:[this.getByName(a[1]),parseInt(a[2],10)]}}let t={code:this[e]};if(typeof t.code!=`number`)throw TypeError(`Data type with name `+e+` not valid`);return t}},x=(function(){let e={};for(let t in b){if(!b.hasOwnProperty(t))continue;let n=b[t];typeof n==`number`&&(e[n]=t)}return e})(),S={local:0,remote:1,ignored:2},C={error:0,startup:1,ready:2,authenticate:3,credentials:4,options:5,supported:6,query:7,result:8,prepare:9,execute:10,register:11,event:12,batch:13,authChallenge:14,authResponse:15,authSuccess:16,cancel:255,isInRange:function(e){return e>this.error&&e>this.event}},w={topologyChange:`TOPOLOGY_CHANGE`,statusChange:`STATUS_CHANGE`,schemaChange:`SCHEMA_CHANGE`},T={serverError:0,protocolError:10,badCredentials:256,unavailableException:4096,overloaded:4097,isBootstrapping:4098,truncateError:4099,writeTimeout:4352,readTimeout:4608,readFailure:4864,functionFailure:5120,writeFailure:5376,syntaxError:8192,unauthorized:8448,invalid:8704,configError:8960,alreadyExists:9216,unprepared:9472,clientWriteFailure:32768},E={voidResult:1,rows:2,setKeyspace:3,prepared:4,schemaChange:5},D={compression:1,tracing:2,customPayload:4,warning:8},O=Object.freeze({unset:!0}),k=_.fromInt(1e3);let A=0;function timeuuid(e,n,i){let a,o,s,c;e&&(typeof e.msecs==`number`&&(a=new Date(e.msecs)),e.msecs instanceof Date&&(a=e.msecs),Array.isArray(e.node)&&(s=t.allocBufferFromArray(e.node)),typeof e.clockseq==`number`&&(c=t.allocBufferUnsafe(2),c.writeUInt16BE(e.clockseq,0)),typeof e.nsecs==`number`&&(o=e.nsecs));let l=new r(a,o,s,c);return n instanceof Buffer?(l.getBuffer().copy(n,i||0),n):l.toString()}function uuid(e,r,i){let a;return e&&Array.isArray(e.random)&&(a=new n(t.allocBufferFromArray(e.random))),a||=n.random(),r instanceof Buffer?(a.getBuffer().copy(r,i||0),r):a.toString()}function getDataTypeNameByCode(t){if(!t||typeof t.code!=`number`)throw new e.ArgumentError(`Invalid signature type definition`);let n=x[t.code];if(!n)throw new e.ArgumentError(g.format(`Type with code %d not found`,t.code));return!(`info`in t)||!t.info?n:t.code===b.custom&&`customTypeName`in t&&t.customTypeName===`vector`?`vector<`+getDataTypeNameByCode(t.info[0])+`, `+t.info[1]+`>`:Array.isArray(t.info)?n+`<`+t.info.map(function(e){return getDataTypeNameByCode(e)}).join(`, `)+`>`:typeof t.info.code==`number`?n+`<`+getDataTypeNameByCode(t.info)+`>`:t.code===b.udt?t.info.name:n}function FrameHeader(e,t,n,r,i){this.version=e,this.flags=t,this.streamId=n,this.opcode=r,this.bodyLength=i}FrameHeader.size=function(e){return i.uses2BytesStreamIds(e)?9:8},FrameHeader.getProtocolVersion=function(e){return e[0]&127},FrameHeader.fromBuffer=function(e,t){let n=0;t||=0;let r=e[t++]&127,a=e.readUInt8(t++);return i.uses2BytesStreamIds(r)?(n=e.readInt16BE(t),t+=2):n=e.readInt8(t++),new FrameHeader(r,a,n,e.readUInt8(t++),e.readUInt32BE(t))},FrameHeader.prototype.toBuffer=function(){let e=t.allocBufferUnsafe(FrameHeader.size(this.version));e.writeUInt8(this.version,0),e.writeUInt8(this.flags,1);let n=3;return i.uses2BytesStreamIds(this.version)?(e.writeInt16BE(this.streamId,2),n=4):e.writeInt8(this.streamId,2),e.writeUInt8(this.opcode,n++),e.writeUInt32BE(this.bodyLength,n),e},_.fromBuffer=function(e){if(!(e instanceof Buffer))throw TypeError(`Expected Buffer, obtained `+g.inspect(e));return new _(e.readInt32BE(4),e.readInt32BE(0))},_.toBuffer=function(e){if(!(e instanceof _))throw TypeError(`Expected Long, obtained `+g.inspect(e));let n=t.allocBufferUnsafe(8);return n.writeUInt32BE(e.getHighBitsUnsigned(),0),n.writeUInt32BE(e.getLowBitsUnsigned(),4),n},_.prototype.inspect=function(){return`Long: `+this.toString()},_.prototype.toJSON=function(){return this.toString()};function generateTimestamp(e,t){e||=new Date;let n=_.ZERO;return typeof t==`number`&&t>=0&&t<1e3?n=_.fromInt(t):(A>999&&(A=0),n=_.fromInt(A),A++),_.fromNumber(e.getTime()).multiply(k).add(n)}function QueryParserError(e){QueryParserError.super_.call(this,e.message,this.constructor),this.internalError=e}g.inherits(QueryParserError,e.DriverError);function TimeoutError(e){TimeoutError.super_.call(this,e,this.constructor),this.info=`Represents an error that happens when the maximum amount of time for an operation passed.`}g.inherits(TimeoutError,e.DriverError);var j={opcodes:C,consistencies:v,consistencyToString:y,dataTypes:b,getDataTypeNameByCode,distance:S,frameFlags:D,protocolEvents:w,protocolVersion:i,responseErrorCodes:T,resultKind:E,timeuuid,uuid,BigDecimal:o,Duration:s,FrameHeader,InetAddress:c,Integer:a,LocalDate:l,LocalTime:u,Long:_,ResultSet:d,ResultStream:f,Row:p,DriverError:e.DriverError,TimeoutError,TimeUuid:r,Tuple:m,Vector:h,Uuid:n,unset:O,generateTimestamp};export{_ as Long,j as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"../utils.js";function InetAddress(e){if(!(e instanceof Buffer)||e.length!==4&&e.length!==16)throw TypeError(`The ip address must contain 4 or 16 bytes`);this.buffer=e,this.length=e.length,this.version=e.length===4?4:6}InetAddress.fromString=function(t){if(!t)return new InetAddress(e.allocBufferFromArray([0,0,0,0]));let n=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,r=/^[\da-f:.]+$/i,i;if(n.test(t))return i=t.split(`.`),new InetAddress(e.allocBufferFromArray(i));if(!r.test(t)||(i=t.split(`:`),i.length<3))throw TypeError(`Value could not be parsed as InetAddress: `+t);let a=e.allocBufferUnsafe(16),o=8-i.length+1,s=!1,c=0,l=n.test(i[i.length-1]);l&&--o;function writeItem(e){a.writeUInt8(+e,c++)}for(let e=0;e<i.length;e++){let t=i[e];if(t){if(l&&e===i.length-1){t.split(`.`).forEach(writeItem);break}a.writeUInt16BE(parseInt(t,16),c),c+=2;continue}s&&(o=1),s=!0;for(let e=0;e<o;e++)a[c++]=0,a[c++]=0}if(l&&!isValidIPv4Mapped(a))throw TypeError(`Only IPv4-Mapped IPv6 addresses are allowed as IPv6 address with embedded IPv4 address`);return new InetAddress(a)},InetAddress.prototype.equals=function(e){return e instanceof InetAddress?this.buffer.length===e.buffer.length&&this.buffer.toString(`hex`)===e.buffer.toString(`hex`):!1},InetAddress.prototype.getBuffer=function(){return this.buffer},InetAddress.prototype.inspect=function(){return this.constructor.name+`: `+this.toString()},InetAddress.prototype.toString=function(e){if(e===`hex`)return this.buffer.toString(`hex`);if(this.buffer.length===4)return this.buffer[0]+`.`+this.buffer[1]+`.`+this.buffer[2]+`.`+this.buffer[3];let t=-1,n={length:0,start:-1};function checkLongest(e){if(t>=0){let r=e-t;r>n.length&&(n.length=r,n.start=t,t=-1)}}for(let e=0;e<this.buffer.length;e+=2){if(this.buffer[e]===0&&this.buffer[e+1]===0){t<0&&(t=e),e===this.buffer.length-2&&checkLongest(e+2);continue}checkLongest(e)}let r=``;for(let e=0;e<this.buffer.length;e+=2){if(e===n.start){r+=`:`;continue}e<n.start+n.length&&e>n.start||(r.length>0&&(r+=`:`),r+=(this.buffer[e]<<8|this.buffer[e+1]).toString(16))}return r.charAt(r.length-1)===`:`&&(r+=`:`),r},InetAddress.prototype.toJSON=function(){return this.toString()};function isValidIPv4Mapped(e){for(let t=0;t<e.length-6;t++)if(e[t]!==0)return!1;return!(e[10]!==255||e[11]!==255)}export{InetAddress as default};
|
package/driver/types/integer.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"../utils.js";function Integer(e,t){this.bits_=[],this.sign_=t;for(var n=!0,r=e.length-1;r>=0;r--){var i=e[r]|0;(!n||i!=t)&&(this.bits_[r]=i,n=!1)}}Integer.IntCache_={},Integer.fromInt=function(e){if(-128<=e&&e<128){var t=Integer.IntCache_[e];if(t)return t}var n=new Integer([e|0],e<0?-1:0);return-128<=e&&e<128&&(Integer.IntCache_[e]=n),n},Integer.fromNumber=function(e){if(isNaN(e)||!isFinite(e))return Integer.ZERO;if(e<0)return Integer.fromNumber(-e).negate();for(var t=[],n=1,r=0;e>=n;r++)t[r]=e/n|0,n*=Integer.TWO_PWR_32_DBL_;return new Integer(t,0)},Integer.fromBits=function(e){var t=e[e.length-1];return new Integer(e,t&1<<31?-1:0)},Integer.fromString=function(e,t){if(e.length==0)throw TypeError(`number format error: empty string`);var n=t||10;if(n<2||36<n)throw Error(`radix out of range: `+n);if(e.charAt(0)==`-`)return Integer.fromString(e.substring(1),n).negate();if(e.indexOf(`-`)>=0)throw TypeError(`number format error: interior "-" character`);for(var r=Integer.fromNumber(n**8),i=Integer.ZERO,a=0;a<e.length;a+=8){var o=Math.min(8,e.length-a),s=parseInt(e.substring(a,a+o),n);if(o<8){var c=Integer.fromNumber(n**+o);i=i.multiply(c).add(Integer.fromNumber(s))}else i=i.multiply(r),i=i.add(Integer.fromNumber(s))}return i},Integer.fromBuffer=function(e){for(var t=Array(Math.ceil(e.length/4)),n=e[0]&128?-1:0,r=0;r<t.length;r++){var i=e.length-(r+1)*4,a;if(i<0){i+=4,a=0;for(var o=0;o<i;o++){var s=e[o];n===-1&&(s=~s&255),a|=s<<(i-o-1)*8}n===-1&&(a=~a)}else a=e.readInt32BE(i);t[r]=a}return new Integer(t,n)},Integer.toBuffer=function(t){var n=t.sign_,r=t.bits_;if(r.length===0)return e.allocBufferFromArray([t.sign_]);var i=r[r.length-1];n===-1&&(i=~i);var a=[];i>>>24>0&&a.push(i>>24&255),i>>>16>0&&a.push(i>>16&255),i>>>8>0&&a.push(i>>8&255),a.push(i&255),a[0]>>7&&a.unshift(0);for(var o=e.allocBufferUnsafe(a.length+(r.length-1)*4),s=0;s<a.length;s++){var c=a[s];n===-1?o[s]=~c:o[s]=c}for(var l=0;l<r.length-1;l++){var u=r[r.length-2-l],d=a.length+l*4;o.writeInt32BE(u,d)}return o},Integer.TWO_PWR_32_DBL_=65536*65536,Integer.ZERO=Integer.fromInt(0),Integer.ONE=Integer.fromInt(1),Integer.TWO_PWR_24_=Integer.fromInt(1<<24),Integer.prototype.toInt=function(){return this.bits_.length>0?this.bits_[0]:this.sign_},Integer.prototype.toNumber=function(){if(this.isNegative())return-this.negate().toNumber();for(var e=0,t=1,n=0;n<this.bits_.length;n++)e+=this.getBitsUnsigned(n)*t,t*=Integer.TWO_PWR_32_DBL_;return e},Integer.prototype.toString=function(e){var t=e||10;if(t<2||36<t)throw Error(`radix out of range: `+t);if(this.isZero())return`0`;if(this.isNegative())return`-`+this.negate().toString(t);for(var n=Integer.fromNumber(t**6),r=this,i=``;;){var a=r.divide(n),o=r.subtract(a.multiply(n)).toInt().toString(t);if(r=a,r.isZero())return o+i;for(;o.length<6;)o=`0`+o;i=``+o+i}},Integer.prototype.getBits=function(e){return e<0?0:e<this.bits_.length?this.bits_[e]:this.sign_},Integer.prototype.getBitsUnsigned=function(e){var t=this.getBits(e);return t>=0?t:Integer.TWO_PWR_32_DBL_+t},Integer.prototype.getSign=function(){return this.sign_},Integer.prototype.isZero=function(){if(this.sign_!=0)return!1;for(var e=0;e<this.bits_.length;e++)if(this.bits_[e]!=0)return!1;return!0},Integer.prototype.isNegative=function(){return this.sign_==-1},Integer.prototype.isOdd=function(){return this.bits_.length==0&&this.sign_==-1||this.bits_.length>0&&(this.bits_[0]&1)!=0},Integer.prototype.equals=function(e){if(this.sign_!=e.sign_)return!1;for(var t=Math.max(this.bits_.length,e.bits_.length),n=0;n<t;n++)if(this.getBits(n)!=e.getBits(n))return!1;return!0},Integer.prototype.notEquals=function(e){return!this.equals(e)},Integer.prototype.greaterThan=function(e){return this.compare(e)>0},Integer.prototype.greaterThanOrEqual=function(e){return this.compare(e)>=0},Integer.prototype.lessThan=function(e){return this.compare(e)<0},Integer.prototype.lessThanOrEqual=function(e){return this.compare(e)<=0},Integer.prototype.compare=function(e){var t=this.subtract(e);return t.isNegative()?-1:+!t.isZero()},Integer.prototype.shorten=function(e){for(var t=e-1>>5,n=(e-1)%32,r=[],i=0;i<t;i++)r[i]=this.getBits(i);var a=n==31?4294967295:(1<<n+1)-1,o=this.getBits(t)&a;return o&1<<n?(o|=4294967295-a,r[t]=o,new Integer(r,-1)):(r[t]=o,new Integer(r,0))},Integer.prototype.negate=function(){return this.not().add(Integer.ONE)},Integer.prototype.add=function(e){for(var t=Math.max(this.bits_.length,e.bits_.length),n=[],r=0,i=0;i<=t;i++){var a=this.getBits(i)>>>16,o=this.getBits(i)&65535,s=e.getBits(i)>>>16,c=e.getBits(i)&65535,l=r+o+c,u=(l>>>16)+a+s;r=u>>>16,l&=65535,u&=65535,n[i]=u<<16|l}return Integer.fromBits(n)},Integer.prototype.subtract=function(e){return this.add(e.negate())},Integer.prototype.multiply=function(e){if(this.isZero()||e.isZero())return Integer.ZERO;if(this.isNegative())return e.isNegative()?this.negate().multiply(e.negate()):this.negate().multiply(e).negate();if(e.isNegative())return this.multiply(e.negate()).negate();if(this.lessThan(Integer.TWO_PWR_24_)&&e.lessThan(Integer.TWO_PWR_24_))return Integer.fromNumber(this.toNumber()*e.toNumber());for(var t=this.bits_.length+e.bits_.length,n=[],r=0;r<2*t;r++)n[r]=0;for(var r=0;r<this.bits_.length;r++)for(var i=0;i<e.bits_.length;i++){var a=this.getBits(r)>>>16,o=this.getBits(r)&65535,s=e.getBits(i)>>>16,c=e.getBits(i)&65535;n[2*r+2*i]+=o*c,Integer.carry16_(n,2*r+2*i),n[2*r+2*i+1]+=a*c,Integer.carry16_(n,2*r+2*i+1),n[2*r+2*i+1]+=o*s,Integer.carry16_(n,2*r+2*i+1),n[2*r+2*i+2]+=a*s,Integer.carry16_(n,2*r+2*i+2)}for(var r=0;r<t;r++)n[r]=n[2*r+1]<<16|n[2*r];for(var r=t;r<2*t;r++)n[r]=0;return new Integer(n,0)},Integer.carry16_=function(e,t){for(;(e[t]&65535)!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535},Integer.prototype.divide=function(e){if(e.isZero())throw Error(`division by zero`);if(this.isZero())return Integer.ZERO;if(this.isNegative())return e.isNegative()?this.negate().divide(e.negate()):this.negate().divide(e).negate();if(e.isNegative())return this.divide(e.negate()).negate();for(var t=Integer.ZERO,n=this;n.greaterThanOrEqual(e);){for(var r=Math.max(1,Math.floor(n.toNumber()/e.toNumber())),i=Math.ceil(Math.log(r)/Math.LN2),a=i<=48?1:2**(i-48),o=Integer.fromNumber(r),s=o.multiply(e);s.isNegative()||s.greaterThan(n);)r-=a,o=Integer.fromNumber(r),s=o.multiply(e);o.isZero()&&(o=Integer.ONE),t=t.add(o),n=n.subtract(s)}return t},Integer.prototype.modulo=function(e){return this.subtract(this.divide(e).multiply(e))},Integer.prototype.not=function(){for(var e=this.bits_.length,t=[],n=0;n<e;n++)t[n]=~this.bits_[n];return new Integer(t,~this.sign_)},Integer.prototype.and=function(e){for(var t=Math.max(this.bits_.length,e.bits_.length),n=[],r=0;r<t;r++)n[r]=this.getBits(r)&e.getBits(r);return new Integer(n,this.sign_&e.sign_)},Integer.prototype.or=function(e){for(var t=Math.max(this.bits_.length,e.bits_.length),n=[],r=0;r<t;r++)n[r]=this.getBits(r)|e.getBits(r);return new Integer(n,this.sign_|e.sign_)},Integer.prototype.xor=function(e){for(var t=Math.max(this.bits_.length,e.bits_.length),n=[],r=0;r<t;r++)n[r]=this.getBits(r)^e.getBits(r);return new Integer(n,this.sign_^e.sign_)},Integer.prototype.shiftLeft=function(e){for(var t=e>>5,n=e%32,r=this.bits_.length+t+ +(n>0),i=[],a=0;a<r;a++)n>0?i[a]=this.getBits(a-t)<<n|this.getBits(a-t-1)>>>32-n:i[a]=this.getBits(a-t);return new Integer(i,this.sign_)},Integer.prototype.shiftRight=function(e){for(var t=e>>5,n=e%32,r=this.bits_.length-t,i=[],a=0;a<r;a++)n>0?i[a]=this.getBits(a+t)>>>n|this.getBits(a+t+1)<<32-n:i[a]=this.getBits(a+t);return new Integer(i,this.sign_)},Integer.prototype.inspect=function(){return this.constructor.name+`: `+this.toString()},Integer.prototype.abs=function(){return this.sign_===0?this:this.negate()},Integer.prototype.toJSON=function(){return this.toString()};export{Integer as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"../utils.js";import t from"util";const n=864e5,r=2**31;function LocalDate(e,r,i){if(typeof e==`number`&&typeof r==`number`&&typeof i==`number`){if(this.date=new Date,this.date.setUTCHours(0,0,0,0),this.date.setUTCFullYear(e,r-1,i),isNaN(this.date.getTime()))throw Error(t.format(`%d-%d-%d does not form a valid ES5 date!`,e,r,i))}else if(r===void 0&&i===void 0&&typeof e==`number`){if(e<-2147483648||e>2147483647)throw Error(`You must provide a valid value for days since epoch (-2147483648 <= value <= 2147483647).`);this.date=new Date(e*n)}if(this.date===void 0)throw Error(`You must provide a valid year, month and day`);this._value=isNaN(this.date.getTime())?e:null,this.year=this.date.getUTCFullYear(),this.month=this.date.getUTCMonth()+1,this.day=this.date.getUTCDate()}LocalDate.now=function(){return LocalDate.fromDate(new Date)},LocalDate.utcNow=function(){return new LocalDate(Date.now())},LocalDate.fromDate=function(e){if(isNaN(e.getTime()))throw TypeError(`Invalid date: `+e);return new LocalDate(e.getFullYear(),e.getMonth()+1,e.getDate())},LocalDate.fromString=function(e){if((e.match(/-/g)||[]).length>=2){let t=1;e[0]===`-`&&(e=e.substring(1),t=-1);let n=e.split(`-`);return new LocalDate(t*parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10))}if(e.match(/^-?\d+$/))return new LocalDate(parseInt(e,10));throw Error(`Invalid input '`+e+`'.`)},LocalDate.fromBuffer=function(e){return new LocalDate(e.readUInt32BE(0)-r)},LocalDate.prototype.compare=function(e){let t=(isNaN(this.date.getTime())?this._value*n:this.date.getTime())-(isNaN(e.date.getTime())?e._value*n:e.date.getTime());return t<0?-1:+(t>0)},LocalDate.prototype.equals=function(e){return e instanceof LocalDate&&this.compare(e)===0},LocalDate.prototype.inspect=function(){return this.constructor.name+`: `+this.toString()},LocalDate.prototype.toBuffer=function(){let t=(isNaN(this.date.getTime())?this._value:Math.floor(this.date.getTime()/n))+r,i=e.allocBufferUnsafe(4);return i.writeUInt32BE(t,0),i},LocalDate.prototype.toString=function(){let e;return isNaN(this.date.getTime())?this._value.toString():(e=this.year<0?`-`+fillZeros((this.year*-1).toString(),4):fillZeros(this.year.toString(),4),e+=`-`+fillZeros(this.month.toString(),2)+`-`+fillZeros(this.day.toString(),2),e)},LocalDate.prototype.toJSON=function(){return this.toString()};function fillZeros(t,n){return t.length>=n?t:e.stringRepeat(`0`,n-t.length)+t}export{LocalDate as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"../utils.js";import t from"util";import n from"long";const r=n.fromString(`86399999999999`),i=n.fromNumber(1e9),a=n.fromNumber(1e6);function LocalTime(e){if(!(e instanceof n))throw Error(`You must specify a Long value as totalNanoseconds`);if(e.lessThan(n.ZERO)||e.greaterThan(r))throw Error(`Total nanoseconds out of range`);this.value=e,this.hour=this._getParts()[0],this.minute=this._getParts()[1],this.second=this._getParts()[2],this.nanosecond=this._getParts()[3]}LocalTime.fromString=function(n){if(typeof n!=`string`)throw Error(`Argument type invalid: `+t.inspect(n));let r=n.split(`:`),i=parseInt(r[0],10)*36e5+parseInt(r[1],10)*6e4,a;if(r.length===3){let t=r[2].split(`.`);i+=parseInt(t[0],10)*1e3,t.length===2&&(a=t[1],a+=e.stringRepeat(`0`,9-a.length))}return LocalTime.fromMilliseconds(i,parseInt(a,10)||0)},LocalTime.now=function(e){return LocalTime.fromDate(new Date,e)},LocalTime.fromDate=function(e,t){if(!(e instanceof Date))throw Error(`Not a valid date`);let n=(e.getTime()+e.getTimezoneOffset()*-6e4)%864e5;return LocalTime.fromMilliseconds(n,t)},LocalTime.fromMilliseconds=function(e,t){return typeof t!=`number`&&(t=0),new LocalTime(n.fromNumber(e).multiply(a).add(n.fromNumber(t)))},LocalTime.fromBuffer=function(e){if(!(e instanceof Buffer))throw TypeError(`Expected Buffer, obtained `+t.inspect(e));return new LocalTime(new n(e.readInt32BE(4),e.readInt32BE(0)))},LocalTime.prototype.compare=function(e){return this.value.compare(e.value)},LocalTime.prototype.equals=function(e){return e instanceof LocalTime&&this.compare(e)===0},LocalTime.prototype.getTotalNanoseconds=function(){return this.value},LocalTime.prototype.inspect=function(){return this.constructor.name+`: `+this.toString()},LocalTime.prototype.toBuffer=function(){let t=e.allocBufferUnsafe(8);return t.writeUInt32BE(this.value.getHighBitsUnsigned(),0),t.writeUInt32BE(this.value.getLowBitsUnsigned(),4),t},LocalTime.prototype.toString=function(){return formatTime(this._getParts())},LocalTime.prototype.toJSON=function(){return this.toString()},LocalTime.prototype._getParts=function(){if(!this._partsCache){let e=[0,0,0,0],t=this.value.div(i);e[3]=this.value.subtract(t.multiply(i)).toNumber(),e[2]=t.toNumber(),e[2]>=60&&(e[1]=Math.floor(e[2]/60),e[2]%=60),e[1]>=60&&(e[0]=Math.floor(e[1]/60),e[1]%=60),this._partsCache=e}return this._partsCache};function formatTime(t){let n;if(n=t[0]<10?`0`+t[0]+`:`:t[0]+`:`,t[1]<10?n+=`0`+t[1]+`:`:n+=t[1]+`:`,t[2]<10?n+=`0`+t[2]:n+=t[2],t[3]>0){let r=t[3].toString();r.length<9&&(r=e.stringRepeat(`0`,9-r.length)+r);let i;for(let e=r.length-1;e>0&&r[e]===`0`;e--)i=e;i&&(r=r.substring(0,i)),n+=`.`+r}return n}export{LocalTime as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"long";const t=65536,n=t*t;var r=class MutableLong{constructor(e,t,n,r){this._arr=[e&65535,t&65535,n&65535,r&65535]}toString(){return this.toImmutable().toString()}compare(e){let t=this.isNegative(),n=e.isNegative();return t&&!n?-1:!t&&n?1:this._compareBits(e)}_compareBits(e){for(let t=3;t>=0;t--){if(this._arr[t]>e._arr[t])return 1;if(this._arr[t]<e._arr[t])return-1}return 0}getUint16(e){return this._arr[e]}getLowBitsUnsigned(){return(this._arr[0]|(this._arr[1]&65535)<<16)>>>0}getHighBitsUnsigned(){return(this._arr[2]|this._arr[3]<<16)>>>0}toNumber(){return(this._arr[3]<<16|this._arr[2])*n+((this._arr[1]<<16|this._arr[0])>>>0)}not(){return this._arr[0]=~this._arr[0]&65535,this._arr[1]=~this._arr[1]&65535,this._arr[2]=~this._arr[2]&65535,this._arr[3]=~this._arr[3]&65535,this}add(e){let t=0,n=0,r=0,i=0;return i+=this._arr[0]+e._arr[0],this._arr[0]=i&65535,r+=i>>>16,r+=this._arr[1]+e._arr[1],this._arr[1]=r&65535,n+=r>>>16,n+=this._arr[2]+e._arr[2],this._arr[2]=n&65535,t+=n>>>16,t+=this._arr[3]+e._arr[3],this._arr[3]=t&65535,this}shiftLeft(e){if(e===0)return this;if(e>=64)return this.toZero();let t=e%16,n=Math.floor(e/16);return n>0&&(this._arr[3]=this._arr[3-n],this._arr[2]=n>2?0:this._arr[2-n],this._arr[1]=n>1?0:this._arr[0],this._arr[0]=0),t>0&&(this._arr[3]=(this._arr[3]<<t|this._arr[2]>>>16-t)&65535,this._arr[2]=(this._arr[2]<<t|this._arr[1]>>>16-t)&65535,this._arr[1]=(this._arr[1]<<t|this._arr[0]>>>16-t)&65535,this._arr[0]=this._arr[0]<<t&65535),this}shiftRightUnsigned(e){if(e===0)return this;if(e>=64)return this.toZero();let t=e%16,n=Math.floor(e/16);return n>0&&(this._arr[0]=this._arr[n],this._arr[1]=n>2?0:this._arr[1+n],this._arr[2]=n>1?0:this._arr[3],this._arr[3]=0),t>0&&(this._arr[0]=this._arr[0]>>>t|this._arr[1]<<16-t&65535,this._arr[1]=this._arr[1]>>>t|this._arr[2]<<16-t&65535,this._arr[2]=this._arr[2]>>>t|this._arr[3]<<16-t&65535,this._arr[3]=this._arr[3]>>>t),this}or(e){return this._arr[0]|=e._arr[0],this._arr[1]|=e._arr[1],this._arr[2]|=e._arr[2],this._arr[3]|=e._arr[3],this}xor(e){return this._arr[0]^=e._arr[0],this._arr[1]^=e._arr[1],this._arr[2]^=e._arr[2],this._arr[3]^=e._arr[3],this}clone(){return new MutableLong(this._arr[0],this._arr[1],this._arr[2],this._arr[3])}multiply(e){let t=!1;if(this.isZero()||e.isZero())return this.toZero();this.isNegative()&&(this.negate(),t=!t),e.isNegative()&&(e=e.clone().negate(),t=!t);let n=0,r=0,i=0,a=0;return a+=this._arr[0]*e._arr[0],i+=a>>>16,i+=this._arr[1]*e._arr[0],r+=i>>>16,i&=65535,i+=this._arr[0]*e._arr[1],r+=i>>>16,r+=this._arr[2]*e._arr[0],n+=r>>>16,r&=65535,r+=this._arr[1]*e._arr[1],n+=r>>>16,r&=65535,r+=this._arr[0]*e._arr[2],n+=r>>>16,n+=this._arr[3]*e._arr[0]+this._arr[2]*e._arr[1]+this._arr[1]*e._arr[2]+this._arr[0]*e._arr[3],this._arr[0]=a&65535,this._arr[1]=i&65535,this._arr[2]=r&65535,this._arr[3]=n&65535,t&&this.negate(),this}toZero(){return this._arr[3]=this._arr[2]=this._arr[1]=this._arr[0]=0,this}isZero(){return this._arr[3]===0&&this._arr[2]===0&&this._arr[1]===0&&this._arr[0]===0}isNegative(){return(this._arr[3]&32768)>0}negate(){return this.not().add(MutableLong.one)}equals(e){return e instanceof MutableLong?this._arr[0]===e._arr[0]&&this._arr[1]===e._arr[1]&&this._arr[2]===e._arr[2]&&this._arr[3]===e._arr[3]:!1}toImmutable(){return e.fromBits(this.getLowBitsUnsigned(),this.getHighBitsUnsigned(),!1)}static fromNumber(e){if(isNaN(e)||!isFinite(e))return new MutableLong;if(e<0)return MutableLong.fromNumber(-e).negate();let t=e%n,r=e/n;return MutableLong.fromBits(t,r)}static fromBits(e,t){return new MutableLong(e,e>>>16,t,t>>>16)}static fromString(e,t){if(typeof e!=`string`)throw Error(`String format is not valid: `+e);if(e.length===0)throw Error(`number format error: empty string`);if(e===`NaN`||e===`Infinity`||e===`+Infinity`||e===`-Infinity`)return new MutableLong;if(t||=10,t<2||t>36)throw Error(`radix out of range: `+t);let n;if((n=e.indexOf(`-`))>0)throw Error(`number format error: interior "-" character: `+e);if(n===0)return MutableLong.fromString(e.substring(1),t).negate();let r=MutableLong.fromNumber(t**8),i=new MutableLong;for(let n=0;n<e.length;n+=8){let a=Math.min(8,e.length-n),o=parseInt(e.substring(n,n+a),t);if(a<8){let e=MutableLong.fromNumber(t**+a);i.multiply(e).add(MutableLong.fromNumber(o));break}i.multiply(r),i.add(MutableLong.fromNumber(o))}return i}};r.one=new r(1,0,0,0);export{r as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"../utils.js";import t from"./version-number.js";const n=t.parse(`2.0.0`),r=t.parse(`2.1.0`),i=t.parse(`2.2.0`),a=t.parse(`3.0.0`),o=t.parse(`5.1.0`),s=t.parse(`6.0.0`),c={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,dseV1:65,dseV2:66,maxSupported:66,minSupported:1,isDse:function(e){return e>=this.dseV1&&e<=this.dseV2},isSupportedCassandra:function(e){return e<=4&&e>=1},isSupported:function(e){return this.isDse(e)||this.isSupportedCassandra(e)},supportsPrepareFlags:function(e){return e===this.dseV2},supportsKeyspaceInRequest:function(e){return e===this.dseV2},supportsResultMetadataId:function(e){return e===this.dseV2},supportsPreparedPartitionKey:function(e){return e>=this.v4},supportsSchemaChangeFullMetadata:function(e){return e>=this.v3},supportsContinuousPaging:function(e){return this.isDse(e)},supportsPaging:function(e){return e>=this.v2},supportsTimestamp:function(e){return e>=this.v3},supportsNamedParameters:function(e){return e>=this.v3},supportsUnset:function(e){return e>=this.v4},supportsFailureReasonMap:function(e){return e>=this.v5},uses2BytesStreamIds:function(e){return e>=this.v3},uses4BytesCollectionLength:function(e){return e>=this.v3},uses4BytesQueryFlags:function(e){return this.isDse(e)},canStartupResponseErrorBeWrapped:function(e){return e>=this.v4},getLowerSupported:function(e){return e>=this.v5?this.v4:e<=this.v1?0:e-1},getHighestCommon:function(c,l){let u=c.log?c.log.bind(c):e.noop,d=c.protocolVersion,f=!1,p=d;return l.forEach(e=>{let c=null;if(e.dseVersion&&(c=t.parse(e.dseVersion),u(`verbose`,`Encountered host ${e.address} with dse version ${c}`),c.compare(o)>=0)){f=!0,d=c.compare(s)>=0?Math.min(this.dseV2,d):Math.min(this.dseV1,d),p=d;return}if(!e.cassandraVersion||e.cassandraVersion.length===0){u(`warning`,`Encountered host `+e.address+` with no cassandra version, skipping as part of protocol version evaluation`);return}try{let o=t.parse(e.cassandraVersion);c||u(`verbose`,`Encountered host `+e.address+` with cassandra version `+o),o.compare(a)>=0?(f=!0,d=Math.min(this.v4,d),p=d):o.compare(i)>=0?(d=Math.min(this.v4,d),p=d):o.compare(r)>=0?(d=Math.min(this.v3,d),p=d):d=o.compare(n)>=0?Math.min(this.v2,d):this.v1}catch{u(`warning`,`Encountered host `+e.address+` with unparseable cassandra version `+e.cassandraVersion+` skipping as part of protocol version evaluation`)}}),f&&d<this.v3&&(p<this.v3?u(`error`,`Detected hosts that require at least protocol version 0x3, but currently connected to `+c.address+`:`+c.port+` using protocol version 0x`+p+`. Will not be able to connect to these hosts. This should not be possible as nodes within a cluster can't be separated by more than one major version`):u(`error`,`Detected hosts with maximum protocol version of 0x`+d.toString(16)+` but there are some hosts that require at least version 0x3. Will not be able to connect to these older hosts. This should not be possible as nodes within a cluster can't be separated by more than one major version`),d=p),u(`verbose`,`Resolved protocol version 0x`+d.toString(16)+` as the highest common protocol version among hosts`),d},isBeta:function(e){return e===this.v5}};export{c as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"../errors.js";import t from"../utils.js";const n=Symbol.asyncIterator||`@@asyncIterator`;function ResultSet(e,t,n,r,i,a){r===-1&&(r=0),this.info={queriedHost:t,triedHosts:n,speculativeExecutions:r,achievedConsistency:i,traceId:null,warnings:null,customPayload:null,isSchemaInAgreement:a},e.flags&&(this.info.traceId=e.flags.traceId,this.info.warnings=e.flags.warnings,this.info.customPayload=e.flags.customPayload),this.rows=e.rows,this.rowLength=this.rows?this.rows.length:e.rowLength,this.columns=null,this.pageState=null,this.nextPage=void 0,this.nextPageAsync=void 0;let o=e.meta;o&&(this.columns=o.columns,o.pageState&&(this.pageState=o.pageState.toString(`hex`),Object.defineProperty(this,`rawPageState`,{value:o.pageState,enumerable:!1})))}ResultSet.prototype.first=function(){return this.rows&&this.rows.length?this.rows[0]:null},ResultSet.prototype.getPageState=function(){return this.pageState},ResultSet.prototype.getColumns=function(){return this.columns},ResultSet.prototype.wasApplied=function(){if(!this.rows||this.rows.length===0)return!0;let e=this.rows[0][`[applied]`];return typeof e==`boolean`?e:!0},ResultSet.prototype[Symbol.iterator]=function(){return this.rows?this.rows[Symbol.iterator]():t.emptyArray[Symbol.iterator]()},ResultSet.prototype[n]=function(){let t=0,n=this.rawPageState,r=this.rows;if(!r||r.length===0)return{next:()=>Promise.resolve({done:!0})};let i=this;return{async next(){if(t>=r.length&&n){if(!i.nextPageAsync)throw new e.DriverInternalError(`Property nextPageAsync should be set when pageState is defined`);let a=await i.nextPageAsync(n);r=a.rows,t=0,n=a.rawPageState}return t<r.length?{done:!1,value:r[t++]}:{done:!0}}}},ResultSet.prototype.isPaged=function(){return!!this.rawPageState};export{ResultSet as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"../errors.js";import t from"../utils.js";import n from"../client-options.js";import{Readable as r}from"stream";var ResultStream=class extends r{constructor(e){super(e),this.buffer=[],this.paused=!0,this._cancelAllowed=!1,this._handlersObject=null,this._highWaterMarkRows=0}_read(){for(this.paused=!1,this.buffer.length===0&&(this._readableState.reading=!1);!this.paused&&this.buffer.length>0;)this.paused=!this.push(this.buffer.shift());this._checkBelowHighWaterMark(),!this.paused&&!this.buffer.length&&this._readNext&&(this._readNext(),this._readNext=null)}_valve(e){this._readNext=null,e&&(this.paused||this.buffer.length?this._readNext=e:e())}add(e){let t=this.buffer.push(e);return this.read(0),this._checkAboveHighWaterMark(),t}_checkAboveHighWaterMark(){!this._handlersObject||!this._handlersObject.resumeReadingHandler||this._highWaterMarkRows===0||this.buffer.length!==this._highWaterMarkRows||this._handlersObject.resumeReadingHandler(!1)}_checkBelowHighWaterMark(){!this._handlersObject||!this._handlersObject.resumeReadingHandler||this._highWaterMarkRows===0||this.buffer.length>=this._highWaterMarkRows||this._handlersObject.resumeReadingHandler(!0)}cancel(n){if(!this._cancelAllowed){let e=Error(`You can only cancel streaming executions when continuous paging is enabled`);if(!n)throw e;return n(e)}if(!this._handlersObject)throw new e.DriverInternalError(`ResultStream cancel is allowed but the cancel options were not set`);if(n||=t.noop,!this._handlersObject.cancelHandler){this._handlersObject.cancelHandler=n;return}this._handlersObject.cancelHandler(n)}setHandlers(e){e.continuousPaging&&(this._cancelAllowed=!0,this._handlersObject=e,this._highWaterMarkRows=e.continuousPaging.highWaterMarkRows||n.continuousPageDefaultHighWaterMark)}};export{ResultStream as default};
|
package/driver/types/row.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function Row(e){if(!e)throw Error(`Columns not defined`);Object.defineProperty(this,`__columns`,{value:e,enumerable:!1,writable:!1})}Row.prototype.get=function(e){return typeof e==`number`?this[this.__columns[e].name]:this[e]},Row.prototype.values=function(){let e=[];return this.forEach(function(t){e.push(t)}),e},Row.prototype.keys=function(){let e=[];return this.forEach(function(t,n){e.push(n)}),e},Row.prototype.forEach=function(e){for(let t in this)this.hasOwnProperty(t)&&e(this[t],t)};export{Row as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"../utils.js";import t from"./uuid.js";import n from"util";import r from"long";import i from"crypto";const a=0xb1d069b5400,o=1e4,s=e.allocBufferFromString(`808080808080`,`hex`),c=e.allocBufferFromString(`8080`,`hex`),l=e.allocBufferFromString(`7f7f7f7f7f7f`,`hex`),u=e.allocBufferFromString(`7f7f`,`hex`);let d=0,f=0,p=0;function TimeUuid(e,n,r,i){let a;if(e instanceof Buffer){if(e.length!==16)throw Error(`Buffer for v1 uuid not valid`);a=e}else a=generateBuffer(e,n,r,i);t.call(this,a)}n.inherits(TimeUuid,t),TimeUuid.fromDate=function(t,n,r,i,a){if(typeof n==`function`?(a=n,n=r=i=null):typeof r==`function`?(a=r,r=i=null):typeof i==`function`&&(a=i,i=null),!a)return new TimeUuid(t,n,r,i);e.parallel([e=>getOrGenerateRandom(r,6,(t,n)=>e(t,r=n)),e=>getOrGenerateRandom(i,2,(t,n)=>e(t,i=n))],e=>{if(e)return a(e);let o;try{o=new TimeUuid(t,n,r,i)}catch(e){return a(e)}a(null,o)})},TimeUuid.fromString=function(e){return new TimeUuid(t.fromString(e).getBuffer())},TimeUuid.min=function(e,t){return new TimeUuid(e,t,s,c)},TimeUuid.max=function(e,t){return new TimeUuid(e,t,l,u)},TimeUuid.now=function(e,t,n){return TimeUuid.fromDate(null,null,e,t,n)},TimeUuid.prototype.getDatePrecision=function(){let e=this.buffer.readUInt32BE(0),t=0;t|=(this.buffer[4]&255)<<8,t|=this.buffer[5]&255,t|=(this.buffer[6]&15)<<24,t|=(this.buffer[7]&255)<<16;let n=r.fromBits(e,t),i=r.fromNumber(o),s=n.modulo(i),c=n.div(i).subtract(r.fromNumber(a));return{date:new Date(c.toNumber()),ticks:s.toNumber()}},TimeUuid.prototype.getDate=function(){return this.getDatePrecision().date},TimeUuid.prototype.getNodeId=function(){return this.buffer.slice(10)},TimeUuid.prototype.getClockId=function(){return this.buffer.slice(8,10)},TimeUuid.prototype.getNodeIdString=function(){return this.buffer.slice(10).toString(`ascii`)};function writeTime(e,t,n){let i=r.fromNumber(t+a).multiply(r.fromNumber(1e4)).add(r.fromNumber(n)),o=i.getHighBitsUnsigned();e.writeUInt32BE(i.getLowBitsUnsigned(),0),e.writeUInt16BE(o&65535,4),e.writeUInt16BE(o>>>16&65535,6)}function getClockId(t){let n=t;if(typeof t==`string`&&(n=e.allocBufferFromString(t,`ascii`)),!(n instanceof Buffer))n=getRandomBytes(2);else if(n.length!==2)throw Error(`Clock identifier must have 2 bytes`);return n}function getNodeId(t){let n=t;if(typeof t==`string`&&(n=e.allocBufferFromString(t,`ascii`)),!(n instanceof Buffer))n=getRandomBytes(6);else if(n.length!==6)throw Error(`Node identifier must have 6 bytes`);return n}function getTicks(e){return(typeof e!=`number`||e>=o)&&(d++,d>=o&&(d=0),e=d),e}function getTimeWithTicks(e,t){if(!(e instanceof Date)||isNaN(e.getTime())){e=new Date;let n=e.getTime();f++,(f>o||n>p)&&(f=0,p=n),t=f}return{time:e.getTime(),ticks:getTicks(t)}}function getRandomBytes(e){return i.randomBytes(e)}function getOrGenerateRandom(e,t,n){if(e)return n(null,e);i.randomBytes(t,n)}function generateBuffer(t,n,r,i){let a=getTimeWithTicks(t,n);r=getNodeId(r),i=getClockId(i);let o=e.allocBufferUnsafe(16);return writeTime(o,a.time,a.ticks),i.copy(o,8,0),r.copy(o,10,0),o[6]&=15,o[6]|=16,o[8]&=63,o[8]|=128,o}export{TimeUuid as default};
|
package/driver/types/tuple.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function Tuple(...e){if(this.elements=e,this.elements.length===0)throw TypeError(`Tuple must contain at least one value`);this.length=this.elements.length}Tuple.fromArray=function(e){return new Tuple(...e)},Tuple.prototype.get=function(e){return this.elements[e||0]},Tuple.prototype.toString=function(){return`(`+this.elements.reduce(function(e,t,n){return e+(n>0?`,`:``)+t.toString()},``)+`)`},Tuple.prototype.toJSON=function(){return this.elements},Tuple.prototype.values=function(){return this.elements.slice(0)};export{Tuple as default};
|
package/driver/types/uuid.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"../utils.js";import t from"crypto";function Uuid(e){if(!e||e.length!==16)throw Error(`You must provide a buffer containing 16 bytes`);this.buffer=e}Uuid.fromString=function(t){if(typeof t!=`string`||t.length!==36)throw Error(`Invalid string representation of Uuid, it should be in the 00000000-0000-0000-0000-000000000000`);return new Uuid(e.allocBufferFromString(t.replace(/-/g,``),`hex`))},Uuid.random=function(e){if(e)getRandomBytes(function(t,n){return t?e(t):e(null,createUuidFromBuffer(n))});else return createUuidFromBuffer(getRandomBytes())},Uuid.prototype.getBuffer=function(){return this.buffer},Uuid.prototype.equals=function(e){return e instanceof Uuid&&this.buffer.equals(e.buffer)},Uuid.prototype.toString=function(){let e=getHex(this);return e.substr(0,8)+`-`+e.substr(8,4)+`-`+e.substr(12,4)+`-`+e.substr(16,4)+`-`+e.substr(20,12)},Uuid.prototype.inspect=function(){return this.constructor.name+`: `+this.toString()},Uuid.prototype.toJSON=function(){return this.toString()};function createUuidFromBuffer(e){return e[6]&=15,e[6]|=64,e[8]&=63,e[8]|=128,new Uuid(e)}function getHex(e){return e.buffer.toString(`hex`)}function getRandomBytes(e){return t.randomBytes(16,e)}export{Uuid as default};
|
package/driver/types/vector.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"node:util";var t=class Vector{constructor(e,t){if(e instanceof Float32Array)this.elements=Array.from(e);else if(Array.isArray(e))this.elements=e;else throw TypeError(`Vector must be constructed with a Float32Array or an Array`);if(this.elements.length===0)throw TypeError(`Vector must contain at least one value`);return this.length=this.elements.length,this.subtype=t,new Proxy(this,{get:function(e,t){return t===`IDENTITY`?`Vector`:typeof t==`string`&&Number.isInteger(Number(t))?e.elements[t]:e[t]},set:function(e,t,n){return typeof t==`string`&&Number.isInteger(Number(t))?e.elements[t]=n:e[t]=n},ownKeys:function(t){return Reflect.ownKeys(e)},getOwnPropertyDescriptor(e,t){return typeof t==`string`&&Number.isInteger(Number(t))?{enumerable:!0,configurable:!0}:Reflect.getOwnPropertyDescriptor(e,t)}})}toString(){return`[${this.elements.toString()}]`}at(e){return this.elements[e]}[Symbol.iterator](){return this.elements[Symbol.iterator]()}static get[Symbol.species](){return Vector}forEach(e){return this.elements.forEach(e)}getSubtype(){return this.subtype}};Object.defineProperty(t,Symbol.hasInstance,{value:function(t){return e.types.isProxy(t)&&t.IDENTITY===`Vector`||t instanceof Float32Array}});export{t as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=/(\d+)\.(\d+)(?:\.(\d+))?(?:\.(\d+)?)?(?:[-~]([\w+]*(?:-\w[.\w]*)*))?(?:\+([.\w]+))?/;var t=class VersionNumber{constructor(e,t,n,r,i,a){this.major=e,this.minor=t,this.patch=n,this.dsePatch=r,this.preReleases=i,this.build=a}toString(){let e=this.major+`.`+this.minor;return this.patch!==void 0&&(e+=`.`+this.patch),this.dsePatch!==void 0&&(e+=`.`+this.dsePatch),this.preReleases!==void 0&&this.preReleases.forEach(t=>{e+=`-`+t}),this.build&&(e+=`+`+this.build),e}compare(e){if(this.major<e.major)return-1;if(this.major>e.major)return 1;if(this.minor<e.minor)return-1;if(this.minor>e.minor)return 1;let t=this.patch||0,n=e.patch||0;if(t<n)return-1;if(t>n)return 1;if(this.dsePatch===void 0){if(e.dsePatch!==void 0)return-1}else if(e.dsePatch===void 0)return 1;else if(this.dsePatch<e.dsePatch)return-1;else if(this.dsePatch>e.dsePatch)return 1;if(this.preReleases===void 0){if(e.preReleases!==void 0)return 1}else if(e.preReleases===void 0)return-1;return 0}static parse(t){if(!t)return null;let n=t.match(e);if(n){let e=parseInt(n[1],10),t=parseInt(n[2],10),r=n[3]?parseInt(n[3],10):void 0,i=n[4]?parseInt(n[4],10):void 0,a=n[5]?n[5].split(`-`):void 0,o=n[6];return new VersionNumber(e,t,r,i,a,o)}throw TypeError(`Could not extract version from '`+t+`'`)}};export{t as default};
|
package/driver/utils.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import e from"./errors.js";import t from"./promise-utils.js";import n from"util";import r from"long";import i from"net";import{EventEmitter as a}from"events";const o=Object.freeze({}),s=Object.freeze([]);function noop(){}const c=Buffer.alloc||allocBufferFillDeprecated,l=Buffer.allocUnsafe||allocBufferDeprecated,u=Int8Array.from!==Buffer.from&&Buffer.from||allocBufferFromStringDeprecated,d=Int8Array.from!==Buffer.from&&Buffer.from||allocBufferFromArrayDeprecated;function allocBufferDeprecated(e){return new Buffer(e)}function allocBufferFillDeprecated(e){let t=allocBufferDeprecated(e);return t.fill(0),t}function allocBufferFromStringDeprecated(e,t){if(typeof e!=`string`)throw TypeError(`Expected string, obtained `+n.inspect(e));return new Buffer(e,t)}function allocBufferFromArrayDeprecated(e){if(!Array.isArray(e))throw TypeError(`Expected Array, obtained `+n.inspect(e));return new Buffer(e)}function callbackOnce(e){let t=e;return function(e,n){t(e,n),t=noop}}function copyBuffer(e){let t=l(e.length);return e.copy(t),t}function fixStack(e,t){return e&&(t.stack+=`
|
|
2
|
-
(event loop)
|
|
3
|
-
`+e.substr(e.indexOf(`
|
|
4
|
-
`)+1)),t}function log(e,t,n,r){if(!this.logEmitter){let e=r||this.options;if(!e||!e.logEmitter)throw Error(`Log emitter not defined`);this.logEmitter=e.logEmitter}this.logEmitter(`log`,e,this.constructor.name,t,n||``)}function totalLength(e){if(e.length===1)return e[0].length;let t=0;return e.forEach(function(e){let n=e.length;n||=0,t+=n}),t}function extend(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){if(!t)return;let n=Object.keys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];a!==void 0&&(e[i]=a)}}),e}function toLowerCaseProperties(e){let t=Object.keys(e),n={};for(let r=0;r<t.length;r++){let i=t[r];n[i.toLowerCase()]=e[i]}return n}function deepExtend(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){for(let n in t){if(!t.hasOwnProperty(n))continue;let r=e[n],i=typeof r;!r||i===`number`||i===`string`||Array.isArray(r)||r instanceof Date||r.constructor.name!==`Object`?e[n]=t[n]:e[n]=deepExtend({},r,t[n])}}),e}function propCompare(e){return function(t,n){return t[e]>n[e]?1:t[e]<n[e]?-1:0}}function funcCompare(e,t){return function(n,r){if(n[e]===void 0)return 0;let i=n[e].apply(n,t),a=r[e].apply(r,t);return i>a?1:i<a?-1:0}}function arrayIterator(e){return e[Symbol.iterator]()}function iteratorToArray(e){let t=[],n=e.next();for(;!n.done;)t.push(n.value),n=e.next();return t}function binarySearch(e,t,n){let r=0,i=e.length-1;for(;r<=i;){let a=r+i>>>1,o=e[a],s=n(o,t);if(s<0)r=a+1;else if(s>0)i=a-1;else return a}return~r}function insertSorted(e,t,n){if(e.length===0)return e.push(t);let r=binarySearch(e,t,n);r<0&&(r=~r),e.splice(r,0,t)}function validateFn(t,r){if(typeof t!=`function`)throw new e.ArgumentError(n.format(`%s is not a function`,r||`callback`));return t}function adaptNamedParamsPrepared(t,r){if(!t||Array.isArray(t)||!r||r.length===0)return t;let i=Array(r.length);t=toLowerCaseProperties(t);let a={};for(let o=0;o<r.length;o++){let s=r[o].name;if(!t.hasOwnProperty(s))throw new e.ArgumentError(n.format(`Parameter "%s" not defined`,s));i[o]=t[s],a[s]=o}return i}function adaptNamedParamsWithHints(e,t){if(!e||Array.isArray(e))return{params:e,namedParameters:!1,keyIndexes:null};let n=Object.keys(e),r=Array(n.length),i=Array(n.length),a=t.getHints()||o,s={};for(let t=0;t<n.length;t++){let o=n[t];r[t]={name:o.toLowerCase(),value:e[o]},i[t]=a[o],s[o]=t}return t.setHints(i),{params:r,namedParameters:!0,keyIndexes:s}}function stringRepeat(e,t){return!t||t<0?null:t===1?e:Array(t+1).join(e)}function objectValues(e){if(!e)return s;let t=Object.keys(e),n=Array(t.length);for(let r=0;r<t.length;r++)n[r]=e[t[r]];return n}function promiseWrapper(e,t,n){if(typeof t==`function`){n.call(this,t);return}let r=e.promiseFactory||defaultPromiseFactory,i=this;return r(function(e){n.call(i,e)})}function defaultPromiseFactory(e){return new Promise(function(t,n){e(function(e,r){if(e)return n(e);t(r)})})}function ifUndefined(e,t){return e===void 0?t:e}function ifUndefined3(e,t,n){return e===void 0?t===void 0?n:t:e}function shuffleArray(e){for(let t=e.length-1;t>0;t--){let n=Math.floor(Math.random()*(t+1)),r=e[t];e[t]=e[n],e[n]=r}return e}function HashSet(){this.length=0,this.items={}}HashSet.prototype.add=function(e){return this.contains(e)?!1:(this.items[e]=!0,this.length++,!0)},HashSet.prototype.contains=function(e){return this.length>0&&this.items[e]===!0},HashSet.prototype.remove=function(e){if(!this.contains(e))return!1;delete this.items[e],this.length--},HashSet.prototype.toArray=function(){return Object.keys(this.items)};var AddressResolver=class{constructor(e){if(!e||!e.nameOrIp||!e.dns)throw Error(`nameOrIp and dns lib must be provided as part of the options`);this._resolve4=n.promisify(e.dns.resolve4),this._nameOrIp=e.nameOrIp,this._isIp=i.isIP(e.nameOrIp),this._index=0,this._addresses=null,this._refreshing=null}async init(){this._isIp||await this._resolve()}async refresh(){if(!this._isIp){if(this._refreshing)return await t.fromEvent(this._refreshing,`finished`);this._refreshing=new a().setMaxListeners(0);try{await this._resolve()}catch{}this._refreshing.emit(`finished`),this._refreshing=null}}async _resolve(){let e=await this._resolve4(this._nameOrIp);if(!e||e.length===0)throw Error(`${this._nameOrIp} could not be resolved`);this._addresses=e}getIp(){if(this._isIp)return this._nameOrIp;let e=this._addresses[this._index%this._addresses.length];return this._index=this._index===2147483647?0:this._index+1,e}};function each(e,t,n){if(!Array.isArray(e))throw TypeError(`First parameter is not an Array`);n||=noop;let r=e.length;if(r===0)return n();let i=0;for(let n=0;n<r;n++)t(e[n],next);function next(e){if(e){let t=n;n=noop,t(e);return}++i===r&&n()}}function eachSeries(e,t,n){if(!Array.isArray(e))throw TypeError(`First parameter is not an Array`);n||=noop;let r=e.length;if(r===0)return n();let i,a=1;t(e[0],next),i===void 0&&(i=!1);function next(o){if(o)return n(o);if(a>=r)return n();if(i===void 0&&(i=!0),i)return process.nextTick(function(){t(e[a++],next)});t(e[a++],next)}}function forEachOf(e,t,n){return mapEach(e,t,!0,n)}function map(e,t,n){return mapEach(e,t,!1,n)}function mapEach(e,t,n,r){if(!Array.isArray(e))throw TypeError(`First parameter must be an Array`);r||=noop;let i=e.length;if(i===0)return r(null,[]);let a=Array(i),o=0,s=n?invokeWithIndex:invokeWithoutIndex;for(let e=0;e<i;e++)s(e);function invokeWithoutIndex(n){t(e[n],function(e,t){a[n]=t,next(e)})}function invokeWithIndex(n){t(e[n],n,function(e,t){a[n]=t,next(e)})}function next(e){if(e){let t=r;r=noop,t(e);return}++o===i&&r(null,a)}}function mapSeries(e,t,n){if(!Array.isArray(e))throw TypeError(`First parameter must be an Array`);n||=noop;let r=e.length;if(r===0)return n(null,[]);let i=Array(r),a=0,o;invoke(0),o===void 0&&(o=!1);function invoke(n){t(e[n],function(e,t){i[n]=t,next(e)})}function next(e){if(e)return n(e);if(++a===r)return n(null,i);o===void 0&&(o=!0);let t=a;if(o)return process.nextTick(function(){invoke(t)});invoke(a)}}function parallel(e,t){if(!Array.isArray(e))throw TypeError(`First parameter must be an Array`);t||=noop;let n=e.length,r=0;for(let t=0;t<n;t++)e[t](next);function next(e){if(e){let n=t;return t=noop,n(e)}++r===n&&t()}}function series(e,t){if(!Array.isArray(e))throw TypeError(`First parameter must be an Array`);t||=noop;let n=0,r;next();function next(i,a){if(i)return t(i);if(n===e.length)return t(null,a);if(r)return process.nextTick(function(){r=!0,e[n++](next),r=!1});r=!0,e[n++](next),r=!1}}function times(e,t,n){if(n||=noop,e=+e,isNaN(e)||e===0)return n();let r=0;for(let n=0;n<e;n++)t(n,next);function next(t){if(t){let e=n;return n=noop,e(t)}++r===e&&n()}}function timesLimit(e,t,n,r){let i;r||=noop,t=Math.min(t,e);let a=t-1,o,s=0;for(o=0;o<t;o++)n(o,next);o=-1;function next(t){if(t){let e=r;r=noop,e(t);return}if(++s===e)return r();if(a++,!(a>=e)){if(i===void 0&&(i=o>=0),i){let e=a;return process.nextTick(function(){n(e,next)})}n(a,next)}}}function timesSeries(e,t,n){if(e=+e,isNaN(e)||e<1)return n();let r=1,i;t(0,next),i===void 0&&(i=!1);function next(a){if(a)return n(a);if(r===e)return n();i===void 0&&(i=!0);let o=r++;if(i)return process.nextTick(function(){t(o,next)});t(o,next)}}function whilst(e,t,n){let r=0;next();function next(i){if(i)return n(i);if(!e())return n();if(r===0){r=1,t(function(e){r===1&&(r=4),next(e)}),r===1&&(r=2);return}if(r===4)return process.nextTick(function(){t(next)});t(next)}}var f={adaptNamedParamsPrepared,adaptNamedParamsWithHints,AddressResolver,allocBuffer:c,allocBufferUnsafe:l,allocBufferFromArray:d,allocBufferFromString:u,arrayIterator,binarySearch,callbackOnce,copyBuffer,deepExtend,each,eachSeries,emptyArray:s,emptyObject:o,extend,fixStack,forEachOf,funcCompare,HashSet,ifUndefined,ifUndefined3,insertSorted,iteratorToArray,log,map,mapSeries,maxInt:9007199254740992,noop,objectValues,parallel,promiseWrapper,propCompare,series,shuffleArray,stringRepeat,times,timesLimit,timesSeries,totalLength,validateFn,VIntCoding:(function(){function encodeZigZag64(e){return e.toUnsigned().shiftLeft(1).xor(e.shiftRight(63))}function decodeZigZag64(e){return e.shiftRightUnsigned(1).xor(e.and(r.ONE).negate())}function writeVInt(e,t){return writeUnsignedVInt(encodeZigZag64(e),t)}function writeUnsignedVInt(e,t){let n=computeUnsignedVIntSize(e);return n===1?(t[0]=e.getLowBits(),1):(encodeVInt(e,n,t),n)}function computeUnsignedVIntSize(e){return 639-numberOfLeadingZeros(e.or(r.ONE))*9>>6}function encodeVInt(e,t,n){let r=t-1,i=e.getLowBits(),a,o=4;for(a=r;a>=0&&o-- >0;a--)n[a]=255&i,i>>=8;for(i=e.getHighBits();a>=0;a--)n[a]=255&i,i>>=8;n[0]|=encodeExtraBytesToRead(r)}function numberOfLeadingZeros(e){if(e.equals(r.ZERO))return 64;let t=1,n=e.getHighBits();return n===0&&(t+=32,n=e.getLowBits()),n>>>16||(t+=16,n<<=16),n>>>24||(t+=8,n<<=8),n>>>28||(t+=4,n<<=4),n>>>30||(t+=2,n<<=2),t-=n>>>31,t}function encodeExtraBytesToRead(e){return~(255>>e)}function readVInt(e,t){return decodeZigZag64(readUnsignedVInt(e,t))}function readUnsignedVInt(e,t){let n=e[t.value++];if(!(n&128))return r.fromInt(n);let i=fromSignedByteToInt(n),a=numberOfExtraBytesToRead(i),o=r.fromInt(i&firstByteValueMask(a));for(let n=0;n<a;n++){let n=r.fromInt(e[t.value++]);o=o.shiftLeft(8).or(n)}return o}function fromSignedByteToInt(e){return e>127?e-256:e}function numberOfLeadingZerosInt32(e){if(e===0)return 32;let t=1;return e>>>16||(t+=16,e<<=16),e>>>24||(t+=8,e<<=8),e>>>28||(t+=4,e<<=4),e>>>30||(t+=2,e<<=2),t-=e>>>31,t}function numberOfExtraBytesToRead(e){return numberOfLeadingZerosInt32(~e)-24}function firstByteValueMask(e){return 255>>e}function uvintUnpack(e){let t=e[0];if(!(t&128))return[t,1];let n=8-(~t&255).toString(2).length,r=t&255>>n;for(let t=1;t<=n;t++){let n=e[t];r<<=8,r|=n&255}return[r,n+1]}function uvintPack(e){let t=[];if(e<128)t.push(e);else{let n=e,r=0,i=n.toString(2).length,a=r+1;for(;i>8-a;)r+=1,i-=8,a=Math.min(r+1,8),t.push(n&255),n>>=8;if(r>8)throw Error(`Value ${e} is too big and cannot be encoded as vint`);let o=8-r;n|=255>>o<<o,t.push(Math.abs(n))}return t.reverse(),Buffer.from(t)}return{readVInt,writeVInt,uvintPack,uvintUnpack}})(),whilst};export{f as default};
|
package/driver/writers.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"./utils.js";import t from"./types/index.js";import n from"events";const{FrameHeader:r}=t;var FrameWriter=class{constructor(e){if(!e)throw Error(`Opcode not provided`);this.buffers=[],this.opcode=e,this.bodyLength=0}add(e){this.buffers.push(e),this.bodyLength+=e.length}writeShort(t){let n=e.allocBufferUnsafe(2);n.writeUInt16BE(t,0),this.add(n)}writeInt(t){let n=e.allocBufferUnsafe(4);n.writeInt32BE(t,0),this.add(n)}writeLong(e){this.add(t.Long.toBuffer(e))}writeBytes(e){if(e===null){this.writeInt(-1);return}if(e===t.unset){this.writeInt(-2);return}this.writeInt(e.length),this.add(e)}writeShortBytes(e){if(e===null){this.writeShort(-1);return}this.writeShort(e.length),this.add(e)}writeByte(t){this.add(e.allocBufferFromArray([t]))}writeString(t){if(t===void 0)throw Error(`can not write undefined`);let n=Buffer.byteLength(t,`utf8`),r=e.allocBufferUnsafe(2+n);r.writeUInt16BE(n,0),r.write(t,2,r.length-2,`utf8`),this.add(r)}writeLString(t){let n=Buffer.byteLength(t,`utf8`),r=e.allocBufferUnsafe(4+n);r.writeInt32BE(n,0),r.write(t,4,r.length-4,`utf8`),this.add(r)}writeStringList(e){this.writeShort(e.length),e.forEach(this.writeString,this)}writeCustomPayload(e){let t=Object.keys(e);this.writeShort(t.length),t.forEach(t=>{this.writeString(t),this.writeBytes(e[t])})}writeStringMap(e){let t=[];for(let n in e)e.hasOwnProperty(n)&&t.push(n);this.writeShort(t.length);for(let n=0;n<t.length;n++){let r=t[n];this.writeString(r),this.writeString(e[r])}}write(t,n,i){let a=new r(t,i||0,n,this.opcode,this.bodyLength).toBuffer(),o=a.length+this.bodyLength,s=e.allocBufferUnsafe(o);a.copy(s,0);let c=a.length;for(let e=0;e<this.buffers.length;e++){let t=this.buffers[e];t.copy(s,c),c+=t.length}return this.buffers=[],this.bodyLength=0,s}},WriteQueue=class extends n.EventEmitter{constructor(e,t,n){super(),this.netClient=e,this.encoder=t,this.isRunning=!1,this.queue=[],this.coalescingThreshold=n.socketOptions.coalescingThreshold,this.error=null,this.canWrite=!0,e.on(`drain`,()=>{this.canWrite=!0,this.run()})}push(e,t){let n=this;if(this.error)return process.nextTick(function(){t(n.error)});this.queue.push({operation:e,callback:t}),this.run()}run(){!this.isRunning&&this.canWrite&&(this.isRunning=!0,process.nextTick(()=>this.process()))}process(){if(this.error)return;let t=[],n=[],r=0;for(;this.queue.length>0&&r<this.coalescingThreshold;){let e=this.queue.shift();if(!e.operation.canBeWritten()){e.callback(Error(`The operation was already cancelled or timeout elapsed`));continue}let i;try{i=e.operation.request.write(this.encoder,e.operation.streamId)}catch(t){e.callback(t);continue}r+=i.length,t.push(i),n.push(e.callback)}if(r===0){this.isRunning=!1;return}for(let e=0;e<n.length;e++)n[e]();let i=e.allocBufferUnsafe(r),a=0;for(let e=0;e<t.length;e++){let n=t[e];n.copy(i,a),a+=n.length}let o=this;this.canWrite=o.netClient.write(i,e=>{if(e){o.setWriteError(e);return}if(o.queue.length===0||!o.canWrite){o.isRunning=!1;return}setImmediate(()=>o.process())})}setWriteError(n){n.isSocketError=!0,this.error=new t.DriverError(`Socket was closed`),this.error.isSocketError=!0,this.error.requestNotWritten=!0,this.error.innerError=n;let r=this.queue;this.queue=e.emptyArray;for(let e=0;e<r.length;e++)r[e].callback(this.error)}};export{FrameWriter,WriteQueue};
|
package/package.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=`0.22.0`,t=`An ODM for ScyllaDB/Cassandra`;export{t as description,e as version};
|