cassandra-driver: update to 3.4.1

This commit is contained in:
Christian Düfel
2018-03-31 17:51:55 +02:00
parent def3d5d177
commit 9ee1f10be8

View File

@@ -1,6 +1,7 @@
// Type definitions for cassandra-driver v3.2.2
// Type definitions for cassandra-driver v3.4.1
// Project: https://github.com/datastax/nodejs-driver
// Definitions by: Marc Fisher <https://github.com/Svjard>
// Christian D <https://github.com/pc-jedi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -115,7 +116,11 @@ export namespace policies {
interface RetryPolicyStatic {
new (): RetryPolicy;
retryDecision: any;
retryDecision: {
rethrow: number,
retry: number,
ignore: number
};
}
interface RetryPolicy {
@@ -126,15 +131,55 @@ export namespace policies {
retryResult(): { decision: retryDecision, consistency: types.consistencies, useCurrentHost: boolean };
}
}
namespace speculativeExecution {
let NoSpeculativeExecutionPolicy: NoSpeculativeExecutionPolicyStatic
interface SpeculativeExecutionPolicy {
init(client: Client): void;
newPlan(keyspace: string, queryInfo: string | Array<string>): {
nextExecution: Function
}
}
interface NoSpeculativeExecutionPolicyStatic {
new (): NoSpeculativeExecutionPolicy
}
interface NoSpeculativeExecutionPolicy extends SpeculativeExecutionPolicy { }
interface ConstantSpeculativeExecutionPolicyStatic {
new (delay: number, maxSpeculativeExecutions: number): ConstantSpeculativeExecutionPolicy
}
interface ConstantSpeculativeExecutionPolicy extends SpeculativeExecutionPolicy { }
}
namespace timestampGeneration {
let MonotonicTimestampGenerator: MonotonicTimestampGeneratorStatic
interface TimestampGenerator {
next(client: Client): null | number | _Long
}
interface MonotonicTimestampGeneratorStatic {
new (warningThreshold?: number, minLogInterval?: number): MonotonicTimestampGeneratorStatic
}
interface MonotonicTimestampGenerator extends TimestampGenerator {
getDate(): number
}
}
}
export namespace types {
let BigDecimal: BigDecimalStatic;
let Duration: DurationStatic;
let Long: _Long;
let InetAddress: InetAddressStatic;
let Integer: IntegerStatic;
let LocalDate: LocalDateStatic;
let LocalTime: LocalTimeStatic;
let Long: _Long;
let ResultSet: ResultSetStatic;
// let ResultStream: ResultStreamStatic;
let Row: RowStatic;
@@ -221,6 +266,19 @@ export namespace types {
toJSON(): string;
}
interface DurationStatic {
new (month: number, days: number, nanoseconds: number | _Long): Duration;
fromBuffer(buffer: Buffer): Duration;
fromString(input: string): Duration;
}
interface Duration {
equals(other: Duration): boolean;
toBuffer(): Buffer;
toString(): string;
}
interface InetAddressStatic {
new (buffer: Buffer): InetAddress;
@@ -336,13 +394,14 @@ export namespace types {
}
interface ResultSetStatic {
new (response: any, host: string, triedHost: { [key: string]: any }, consistency: consistencies): ResultSet;
new (response: any, host: string, triedHost: { [key: string]: any }, speculativeExecutions: number, consistency: consistencies): ResultSet;
}
interface ResultSet {
info: {
queriedHost: Host,
triedHosts: { [key: string]: string; },
speculativeExecutions: number,
achievedConsistency: consistencies,
traceId: Uuid,
warnings: Array<string>,
@@ -352,11 +411,13 @@ export namespace types {
rowLength: number;
columns: Array<{ [key: string]: string; }>;
pageState: string;
nextPage: any; // function
nextPage: Function;
first(): Row;
getPageState(): string;
getColumns(): Array<{ [key: string]: string; }>;
wasApplied(): boolean;
[Symbol.iterator](): Iterator<Row>;
}
interface ResultStreamStatic {
@@ -442,40 +503,50 @@ export let Encoder: EncoderStatic;
export interface ClientOptions {
contactPoints: Array<string>,
keyspace?: string,
refreshSchemaDelay?: number,
isMetadataSyncEnabled?: boolean,
prepareOnAllHosts?: boolean,
rePrepareOnUp?: boolean,
maxPrepared?: number,
policies?: {
addressResolution?: policies.addressResolution.AddressTranslator,
loadBalancing?: policies.loadBalancing.LoadBalancingPolicy,
retry?: policies.retry.RetryPolicy,
reconnection?: policies.reconnection.ReconnectionPolicy,
retry?: policies.retry.RetryPolicy
addressResolution?: policies.addressResolution.AddressTranslator,
speculativeExecution?: policies.speculativeExecution.SpeculativeExecutionPolicy,
timestampGeneration?: policies.timestampGeneration.TimestampGenerator,
},
queryOptions?: QueryOptions,
pooling?: {
heartBeatInterval: number,
coreConnectionsPerHost: { [key: number]: number; },
warmup: boolean;
heartBeatInterval?: number,
coreConnectionsPerHost?: { [key: number]: number; },
maxRequestsPerConnection?: number,
warmup?: boolean;
},
protocolOptions?: {
port: number,
maxSchemaAgreementWaitSeconds: number,
maxVersion: number
port?: number,
maxSchemaAgreementWaitSeconds?: number,
maxVersion?: number
},
socketOptions?: {
connectTimeout: number,
defunctReadTimeoutThreshold: number,
keepAlive: boolean,
keepAliveDelay: number,
readTimeout: number,
tcpNoDelay: boolean,
coalescingThreshold: number
connectTimeout?: number,
defunctReadTimeoutThreshold?: number,
keepAlive?: boolean,
keepAliveDelay?: number,
readTimeout?: number,
tcpNoDelay?: boolean,
coalescingThreshold?: number
},
authProvider?: auth.AuthProvider,
sslOptions?: tls.ConnectionOptions,
encoding?: {
map: Function,
set: Function,
copyBuffer: boolean,
useUndefinedAsUnset: boolean
}
map?: Function,
set?: Function,
copyBuffer?: boolean,
useUndefinedAsUnset?: boolean
},
profiles?: Array<ExecutionProfile>,
promiseFactory?: Function,
}
export interface QueryOptions {
@@ -483,8 +554,11 @@ export interface QueryOptions {
captureStackTrace?: boolean;
consistency?: number;
customPayload?: any;
executionProfile?: string | ExecutionProfile;
fetchSize?: number;
hints?: Array<string> | Array<Array<string>>;
isIdempotent?: boolean;
keyspace?: string;
logged?: boolean;
pageState?: Buffer | string;
prepare?: boolean;
@@ -520,6 +594,7 @@ export interface Client extends events.EventEmitter {
execute(query: string, callback: ResultCallback): void;
execute(query: string, params?: any, options?: QueryOptions): Promise<types.ResultSet>;
getReplicas(keyspace: string, token: Buffer): Array<any>; // TODO: Should this be a more explicit return?
getState(): metadata.ClientState;
shutdown(callback?: Callback): void;
shutdown(): Promise<void>;
stream(query: string, params?: any, options?: QueryOptions, callback?: Callback): NodeJS.ReadableStream;
@@ -548,6 +623,7 @@ export interface HostMapStatic {
export interface HostMap extends events.EventEmitter {
length: number;
clear(): Array<Host>;
forEach(callback: Callback): void;
get(key: string): Host;
keys(): Array<string>;
@@ -566,6 +642,22 @@ export interface Encoder {
encode(value: any, typeInfo?: string | number | { code: number, info?: any }): Buffer;
}
interface ExecutionProfileOptions {
consistency: number,
loadBalancing: policies.loadBalancing.LoadBalancingPolicy,
name: string,
readTimeout: number,
retry: policies.retry.RetryPolicy,
serialConsistency: number
}
export interface ExecutionProfileStatic {
new (name: string, options: ExecutionProfileOptions): ExecutionProfile
}
export interface ExecutionProfile extends ExecutionProfileOptions {
}
export namespace auth {
let Authenticator: AuthenticatorStatic;
let PlainTextAuthProvider: PlainTextAuthProviderStatic;
@@ -649,6 +741,17 @@ export namespace metadata {
stateFunction: string;
stateType: string;
}
interface ClientStateStatic {
new (): ClientState;
}
interface ClientState {
getConnectedHosts(): Array<Host>;
getInFlightQueries(host: Host): number;
getOpenConnections(host: Host): number;
toString(): string;
}
interface DataTypeInfo {
code: number,