From a003557735962e12535efdc486abca2c2bebbfed Mon Sep 17 00:00:00 2001 From: Jane He Date: Thu, 16 Jan 2025 17:38:24 +0800 Subject: [PATCH 01/19] tsconfig --- tsconfig.json | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tsconfig.json diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..2ccd96fe --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es2015"], + "target": "es2015", + "sourceMap": true, + "strict": false, + "noImplicitAny": false, + "outDir": "out", + "declaration": true, + "allowJs": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "checkJs": true, + "declarationMap": true + }, + "include": [ + "lib/**/*.ts", + "index.js", + "indes.d.ts" + ], + "exclude": [ + "node_modules" + ] + } \ No newline at end of file From 8078d9028cc22338868c47051a3a5385c1692a65 Mon Sep 17 00:00:00 2001 From: Jane He Date: Tue, 21 Jan 2025 16:54:15 +0800 Subject: [PATCH 02/19] tests can run --- index.d.ts | 414 ------------------ index.js => index.ts | 0 ...enticator.js => base-dse-authenticator.ts} | 0 ...rovider.js => dse-gssapi-auth-provider.ts} | 0 ...der.js => dse-plain-text-auth-provider.ts} | 0 .../{gssapi-client.js => gssapi-client.ts} | 0 lib/auth/{index.js => index.ts} | 0 ...o-auth-provider.js => no-auth-provider.ts} | 0 ...rovider.js => plain-text-auth-provider.ts} | 0 lib/auth/{provider.js => provider.ts} | 0 lib/{client-options.js => client-options.ts} | 0 lib/{client.js => client.ts} | 0 lib/concurrent/{index.js => index.ts} | 0 lib/{connection.js => connection.ts} | 0 ...ol-connection.js => control-connection.ts} | 0 lib/datastax/cloud/{index.js => index.ts} | 0 ...-type-helper.js => complex-type-helper.ts} | 0 ...ializers.js => custom-type-serializers.ts} | 0 .../{graph-executor.js => graph-executor.ts} | 0 ...raph-serializer.js => graph-serializer.ts} | 0 lib/datastax/graph/{index.js => index.ts} | 0 lib/datastax/graph/{options.js => options.ts} | 0 .../graph/{result-set.js => result-set.ts} | 0 .../graph/{structure.js => structure.ts} | 0 ...ype-serializers.js => type-serializers.ts} | 0 .../graph/{wrappers.js => wrappers.ts} | 0 lib/datastax/{index.js => index.ts} | 0 .../search/{date-range.js => date-range.ts} | 0 lib/datastax/search/{index.js => index.ts} | 0 lib/{encoder.js => encoder.ts} | 0 lib/{errors.js => errors.ts} | 0 ...cution-options.js => execution-options.ts} | 0 ...cution-profile.js => execution-profile.ts} | 0 lib/geometry/{geometry.js => geometry.ts} | 0 lib/geometry/{index.js => index.ts} | 0 .../{line-string.js => line-string.ts} | 0 lib/geometry/{point.js => point.ts} | 0 lib/geometry/{polygon.js => polygon.ts} | 0 ...ection-pool.js => host-connection-pool.ts} | 0 lib/{host.js => host.ts} | 0 ...{insights-client.js => insights-client.ts} | 0 lib/mapping/{cache.js => cache.ts} | 0 ...oc-info-adapter.js => doc-info-adapter.ts} | 0 lib/mapping/{index.js => index.ts} | 0 lib/mapping/{mapper.js => mapper.ts} | 0 ...{mapping-handler.js => mapping-handler.ts} | 0 ...odel-batch-item.js => model-batch-item.ts} | 0 ...-batch-mapper.js => model-batch-mapper.ts} | 0 .../{model-mapper.js => model-mapper.ts} | 0 ...-mapping-info.js => model-mapping-info.ts} | 0 ...{object-selector.js => object-selector.ts} | 0 lib/mapping/{q.js => q.ts} | 0 ...{query-generator.js => query-generator.ts} | 0 .../{result-mapper.js => result-mapper.ts} | 0 lib/mapping/{result.js => result.ts} | 0 .../{table-mappings.js => table-mappings.ts} | 0 lib/mapping/{tree.js => tree.ts} | 0 lib/metadata/{aggregate.js => aggregate.ts} | 0 .../{client-state.js => client-state.ts} | 0 ...{data-collection.js => data-collection.ts} | 0 ...{event-debouncer.js => event-debouncer.ts} | 0 lib/metadata/{index.js => index.ts} | 0 ...erialized-view.js => materialized-view.ts} | 0 ...{schema-function.js => schema-function.ts} | 0 .../{schema-index.js => schema-index.ts} | 0 .../{schema-parser.js => schema-parser.ts} | 0 .../{table-metadata.js => table-metadata.ts} | 0 .../{client-metrics.js => client-metrics.ts} | 0 ...{default-metrics.js => default-metrics.ts} | 0 lib/metrics/{index.js => index.ts} | 0 ...{operation-state.js => operation-state.ts} | 0 ...ss-resolution.js => address-resolution.ts} | 0 lib/policies/{index.js => index.ts} | 0 .../{load-balancing.js => load-balancing.ts} | 0 .../{reconnection.js => reconnection.ts} | 0 lib/policies/{retry.js => retry.ts} | 0 ...-execution.js => speculative-execution.ts} | 0 ...-generation.js => timestamp-generation.ts} | 0 ...{prepare-handler.js => prepare-handler.ts} | 0 lib/{promise-utils.js => promise-utils.ts} | 0 lib/{readers.js => readers.ts} | 0 ...uest-execution.js => request-execution.ts} | 0 ...{request-handler.js => request-handler.ts} | 0 lib/{requests.js => requests.ts} | 0 ...{stream-id-stack.js => stream-id-stack.ts} | 0 lib/{streams.js => streams.ts} | 0 lib/{token.js => token.ts} | 0 lib/{tokenizer.js => tokenizer.ts} | 0 lib/tracker/{index.js => index.ts} | 0 .../{request-logger.js => request-logger.ts} | 0 ...{request-tracker.js => request-tracker.ts} | 0 lib/types/{big-decimal.js => big-decimal.ts} | 0 lib/types/{duration.js => duration.ts} | 0 lib/types/{index.js => index.ts} | 0 .../{inet-address.js => inet-address.ts} | 0 lib/types/{integer.js => integer.ts} | 0 lib/types/{local-date.js => local-date.ts} | 0 lib/types/{local-time.js => local-time.ts} | 0 .../{mutable-long.js => mutable-long.ts} | 0 ...rotocol-version.js => protocol-version.ts} | 0 lib/types/{result-set.js => result-set.ts} | 0 .../{result-stream.js => result-stream.ts} | 0 lib/types/{row.js => row.ts} | 0 lib/types/{time-uuid.js => time-uuid.ts} | 0 lib/types/{tuple.js => tuple.ts} | 0 lib/types/{uuid.js => uuid.ts} | 0 .../{version-number.js => version-number.ts} | 0 lib/{utils.js => utils.ts} | 0 lib/{writers.js => writers.ts} | 0 package.json | 1 - tsconfig.json | 12 +- 111 files changed, 5 insertions(+), 422 deletions(-) delete mode 100644 index.d.ts rename index.js => index.ts (100%) rename lib/auth/{base-dse-authenticator.js => base-dse-authenticator.ts} (100%) rename lib/auth/{dse-gssapi-auth-provider.js => dse-gssapi-auth-provider.ts} (100%) rename lib/auth/{dse-plain-text-auth-provider.js => dse-plain-text-auth-provider.ts} (100%) rename lib/auth/{gssapi-client.js => gssapi-client.ts} (100%) rename lib/auth/{index.js => index.ts} (100%) rename lib/auth/{no-auth-provider.js => no-auth-provider.ts} (100%) rename lib/auth/{plain-text-auth-provider.js => plain-text-auth-provider.ts} (100%) rename lib/auth/{provider.js => provider.ts} (100%) rename lib/{client-options.js => client-options.ts} (100%) rename lib/{client.js => client.ts} (100%) rename lib/concurrent/{index.js => index.ts} (100%) rename lib/{connection.js => connection.ts} (100%) rename lib/{control-connection.js => control-connection.ts} (100%) rename lib/datastax/cloud/{index.js => index.ts} (100%) rename lib/datastax/graph/{complex-type-helper.js => complex-type-helper.ts} (100%) rename lib/datastax/graph/{custom-type-serializers.js => custom-type-serializers.ts} (100%) rename lib/datastax/graph/{graph-executor.js => graph-executor.ts} (100%) rename lib/datastax/graph/{graph-serializer.js => graph-serializer.ts} (100%) rename lib/datastax/graph/{index.js => index.ts} (100%) rename lib/datastax/graph/{options.js => options.ts} (100%) rename lib/datastax/graph/{result-set.js => result-set.ts} (100%) rename lib/datastax/graph/{structure.js => structure.ts} (100%) rename lib/datastax/graph/{type-serializers.js => type-serializers.ts} (100%) rename lib/datastax/graph/{wrappers.js => wrappers.ts} (100%) rename lib/datastax/{index.js => index.ts} (100%) rename lib/datastax/search/{date-range.js => date-range.ts} (100%) rename lib/datastax/search/{index.js => index.ts} (100%) rename lib/{encoder.js => encoder.ts} (100%) rename lib/{errors.js => errors.ts} (100%) rename lib/{execution-options.js => execution-options.ts} (100%) rename lib/{execution-profile.js => execution-profile.ts} (100%) rename lib/geometry/{geometry.js => geometry.ts} (100%) rename lib/geometry/{index.js => index.ts} (100%) rename lib/geometry/{line-string.js => line-string.ts} (100%) rename lib/geometry/{point.js => point.ts} (100%) rename lib/geometry/{polygon.js => polygon.ts} (100%) rename lib/{host-connection-pool.js => host-connection-pool.ts} (100%) rename lib/{host.js => host.ts} (100%) rename lib/{insights-client.js => insights-client.ts} (100%) rename lib/mapping/{cache.js => cache.ts} (100%) rename lib/mapping/{doc-info-adapter.js => doc-info-adapter.ts} (100%) rename lib/mapping/{index.js => index.ts} (100%) rename lib/mapping/{mapper.js => mapper.ts} (100%) rename lib/mapping/{mapping-handler.js => mapping-handler.ts} (100%) rename lib/mapping/{model-batch-item.js => model-batch-item.ts} (100%) rename lib/mapping/{model-batch-mapper.js => model-batch-mapper.ts} (100%) rename lib/mapping/{model-mapper.js => model-mapper.ts} (100%) rename lib/mapping/{model-mapping-info.js => model-mapping-info.ts} (100%) rename lib/mapping/{object-selector.js => object-selector.ts} (100%) rename lib/mapping/{q.js => q.ts} (100%) rename lib/mapping/{query-generator.js => query-generator.ts} (100%) rename lib/mapping/{result-mapper.js => result-mapper.ts} (100%) rename lib/mapping/{result.js => result.ts} (100%) rename lib/mapping/{table-mappings.js => table-mappings.ts} (100%) rename lib/mapping/{tree.js => tree.ts} (100%) rename lib/metadata/{aggregate.js => aggregate.ts} (100%) rename lib/metadata/{client-state.js => client-state.ts} (100%) rename lib/metadata/{data-collection.js => data-collection.ts} (100%) rename lib/metadata/{event-debouncer.js => event-debouncer.ts} (100%) rename lib/metadata/{index.js => index.ts} (100%) rename lib/metadata/{materialized-view.js => materialized-view.ts} (100%) rename lib/metadata/{schema-function.js => schema-function.ts} (100%) rename lib/metadata/{schema-index.js => schema-index.ts} (100%) rename lib/metadata/{schema-parser.js => schema-parser.ts} (100%) rename lib/metadata/{table-metadata.js => table-metadata.ts} (100%) rename lib/metrics/{client-metrics.js => client-metrics.ts} (100%) rename lib/metrics/{default-metrics.js => default-metrics.ts} (100%) rename lib/metrics/{index.js => index.ts} (100%) rename lib/{operation-state.js => operation-state.ts} (100%) rename lib/policies/{address-resolution.js => address-resolution.ts} (100%) rename lib/policies/{index.js => index.ts} (100%) rename lib/policies/{load-balancing.js => load-balancing.ts} (100%) rename lib/policies/{reconnection.js => reconnection.ts} (100%) rename lib/policies/{retry.js => retry.ts} (100%) rename lib/policies/{speculative-execution.js => speculative-execution.ts} (100%) rename lib/policies/{timestamp-generation.js => timestamp-generation.ts} (100%) rename lib/{prepare-handler.js => prepare-handler.ts} (100%) rename lib/{promise-utils.js => promise-utils.ts} (100%) rename lib/{readers.js => readers.ts} (100%) rename lib/{request-execution.js => request-execution.ts} (100%) rename lib/{request-handler.js => request-handler.ts} (100%) rename lib/{requests.js => requests.ts} (100%) rename lib/{stream-id-stack.js => stream-id-stack.ts} (100%) rename lib/{streams.js => streams.ts} (100%) rename lib/{token.js => token.ts} (100%) rename lib/{tokenizer.js => tokenizer.ts} (100%) rename lib/tracker/{index.js => index.ts} (100%) rename lib/tracker/{request-logger.js => request-logger.ts} (100%) rename lib/tracker/{request-tracker.js => request-tracker.ts} (100%) rename lib/types/{big-decimal.js => big-decimal.ts} (100%) rename lib/types/{duration.js => duration.ts} (100%) rename lib/types/{index.js => index.ts} (100%) rename lib/types/{inet-address.js => inet-address.ts} (100%) rename lib/types/{integer.js => integer.ts} (100%) rename lib/types/{local-date.js => local-date.ts} (100%) rename lib/types/{local-time.js => local-time.ts} (100%) rename lib/types/{mutable-long.js => mutable-long.ts} (100%) rename lib/types/{protocol-version.js => protocol-version.ts} (100%) rename lib/types/{result-set.js => result-set.ts} (100%) rename lib/types/{result-stream.js => result-stream.ts} (100%) rename lib/types/{row.js => row.ts} (100%) rename lib/types/{time-uuid.js => time-uuid.ts} (100%) rename lib/types/{tuple.js => tuple.ts} (100%) rename lib/types/{uuid.js => uuid.ts} (100%) rename lib/types/{version-number.js => version-number.ts} (100%) rename lib/{utils.js => utils.ts} (100%) rename lib/{writers.js => writers.ts} (100%) diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index cf44d76e..00000000 --- a/index.d.ts +++ /dev/null @@ -1,414 +0,0 @@ -/* - * Copyright DataStax, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import * as events from 'events'; -import * as tls from 'tls'; -import { URL } from 'url'; -import { auth } from './lib/auth'; -import { policies } from './lib/policies'; -import { types } from './lib/types'; -import { metrics } from './lib/metrics'; -import { tracker } from './lib/tracker'; -import { metadata } from './lib/metadata'; -import { datastax } from './lib/datastax/'; -import Long = types.Long; -import Uuid = types.Uuid; -import graph = datastax.graph; - -// Export imported submodules -export { concurrent } from './lib/concurrent'; -export { mapping } from './lib/mapping'; -export { geometry } from './lib/geometry'; -export { auth, datastax, metadata, metrics, policies, tracker, types }; - -export const version: number; - -export function defaultOptions(): ClientOptions; - -export type ValueCallback = (err: Error, val: T) => void; -export type EmptyCallback = (err: Error) => void; -export type ArrayOrObject = any[]|{[key: string]: any}; - -export class Client extends events.EventEmitter { - hosts: HostMap; - keyspace: string; - metadata: metadata.Metadata; - metrics: metrics.ClientMetrics; - - constructor(options: DseClientOptions); - - connect(): Promise; - - connect(callback: EmptyCallback): void; - - execute(query: string, params?: ArrayOrObject, options?: QueryOptions): Promise; - - execute(query: string, params: ArrayOrObject, options: QueryOptions, callback: ValueCallback): void; - - execute(query: string, params: ArrayOrObject, callback: ValueCallback): void; - - execute(query: string, callback: ValueCallback): void; - - executeGraph( - traversal: string, - parameters: { [name: string]: any } | undefined, - options: GraphQueryOptions, - callback: ValueCallback): void; - - executeGraph( - traversal: string, - parameters: { [name: string]: any } | undefined, - callback: ValueCallback): void; - - executeGraph(traversal: string, callback: ValueCallback): void; - - executeGraph( - traversal: string, - parameters?: { [name: string]: any }, - options?: GraphQueryOptions): Promise; - - eachRow(query: string, - params: ArrayOrObject, - options: QueryOptions, - rowCallback: (n: number, row: types.Row) => void, - callback?: ValueCallback): void; - - eachRow(query: string, - params: ArrayOrObject, - rowCallback: (n: number, row: types.Row) => void, - callback?: ValueCallback): void; - - eachRow(query: string, - rowCallback: (n: number, row: types.Row) => void): void; - - stream(query: string, params?: ArrayOrObject, options?: QueryOptions, callback?: EmptyCallback): events.EventEmitter; - - batch( - queries: Array, - options?: QueryOptions): Promise; - - batch( - queries: Array, - options: QueryOptions, - callback: ValueCallback): void; - - batch( - queries: Array, - callback: ValueCallback): void; - - shutdown(): Promise; - - shutdown(callback: EmptyCallback): void; - - getReplicas(keyspace: string, token: Buffer): Host[]; - - getState(): metadata.ClientState; -} - -export interface HostMap extends events.EventEmitter { - length: number; - - forEach(callback: (value: Host, key: string) => void): void; - - get(key: string): Host; - - keys(): string[]; - - values(): Host[]; -} - -export interface Host extends events.EventEmitter { - address: string; - cassandraVersion: string; - datacenter: string; - rack: string; - tokens: string[]; - hostId: types.Uuid; - - canBeConsideredAsUp(): boolean; - - getCassandraVersion(): number[]; - - isUp(): boolean; -} - -export interface ExecutionOptions { - getCaptureStackTrace(): boolean; - - getConsistency(): types.consistencies; - - getCustomPayload(): { [key: string]: any }; - - getFetchSize(): number; - - getFixedHost(): Host; - - getHints(): string[] | string[][]; - - isAutoPage(): boolean; - - isBatchCounter(): boolean; - - isBatchLogged(): boolean; - - isIdempotent(): boolean; - - isPrepared(): boolean; - - isQueryTracing(): boolean; - - getKeyspace(): string; - - getLoadBalancingPolicy(): policies.loadBalancing.LoadBalancingPolicy; - - getPageState(): Buffer; - - getRawQueryOptions(): QueryOptions; - - getReadTimeout(): number; - - getRetryPolicy(): policies.retry.RetryPolicy; - - getRoutingKey(): Buffer | Buffer[]; - - getSerialConsistency(): types.consistencies; - - getTimestamp(): number | Long | undefined | null; - - setHints(hints: string[]): void; -} - -export interface ClientOptions { - contactPoints?: string[]; - localDataCenter?: string; - keyspace?: string; - authProvider?: auth.AuthProvider; - credentials?: { - username: string; - password: string; - } - - cloud?: { - secureConnectBundle: string | URL; - }; - - encoding?: { - map?: Function; - set?: Function; - copyBuffer?: boolean; - useUndefinedAsUnset?: boolean; - useBigIntAsLong?: boolean; - useBigIntAsVarint?: boolean; - }; - isMetadataSyncEnabled?: boolean; - maxPrepared?: number; - metrics?: metrics.ClientMetrics; - policies?: { - addressResolution?: policies.addressResolution.AddressTranslator; - loadBalancing?: policies.loadBalancing.LoadBalancingPolicy; - reconnection?: policies.reconnection.ReconnectionPolicy; - retry?: policies.retry.RetryPolicy; - speculativeExecution?: policies.speculativeExecution.SpeculativeExecutionPolicy; - timestampGeneration?: policies.timestampGeneration.TimestampGenerator; - }; - pooling?: { - coreConnectionsPerHost?: { [key: number]: number; }; - heartBeatInterval?: number; - maxRequestsPerConnection?: number; - warmup?: boolean; - }; - prepareOnAllHosts?: boolean; - profiles?: ExecutionProfile[]; - protocolOptions?: { - maxSchemaAgreementWaitSeconds?: number; - maxVersion?: number; - noCompact?: boolean; - port?: number; - }; - promiseFactory?: (handler: (callback: (err: Error, result?: any) => void) => void) => Promise; - queryOptions?: QueryOptions; - refreshSchemaDelay?: number; - rePrepareOnUp?: boolean; - requestTracker?: tracker.RequestTracker; - socketOptions?: { - coalescingThreshold?: number; - connectTimeout?: number; - defunctReadTimeoutThreshold?: number; - keepAlive?: boolean; - keepAliveDelay?: number; - readTimeout?: number; - tcpNoDelay?: boolean; - }; - sslOptions?: tls.ConnectionOptions; -} - -export interface QueryOptions { - autoPage?: boolean; - captureStackTrace?: boolean; - consistency?: number; - counter?: boolean; - customPayload?: any; - executionProfile?: string | ExecutionProfile; - fetchSize?: number; - hints?: string[] | string[][]; - host?: Host; - isIdempotent?: boolean; - keyspace?: string; - logged?: boolean; - pageState?: Buffer | string; - prepare?: boolean; - readTimeout?: number; - retry?: policies.retry.RetryPolicy; - routingIndexes?: number[]; - routingKey?: Buffer | Buffer[]; - routingNames?: string[]; - serialConsistency?: number; - timestamp?: number | Long; - traceQuery?: boolean; -} - -export interface DseClientOptions extends ClientOptions { - id?: Uuid; - applicationName?: string; - applicationVersion?: string; - monitorReporting?: { enabled?: boolean }; - graphOptions?: GraphOptions; -} - -export interface GraphQueryOptions extends QueryOptions { - graphLanguage?: string; - graphName?: string; - graphReadConsistency?: types.consistencies; - graphSource?: string; - graphWriteConsistency?: types.consistencies; -} - -export type GraphOptions = { - language?: string; - name?: string; - readConsistency?: types.consistencies; - readTimeout?: number; - source?: string; - writeConsistency?: types.consistencies; -}; - -export class ExecutionProfile { - consistency?: types.consistencies; - loadBalancing?: policies.loadBalancing.LoadBalancingPolicy; - name: string; - readTimeout?: number; - retry?: policies.retry.RetryPolicy; - serialConsistency?: types.consistencies; - graphOptions?: { - name?: string; - language?: string; - source?: string; - readConsistency?: types.consistencies; - writeConsistency?: types.consistencies; - }; - - constructor(name: string, options: { - consistency?: types.consistencies; - loadBalancing?: policies.loadBalancing.LoadBalancingPolicy; - readTimeout?: number; - retry?: policies.retry.RetryPolicy; - serialConsistency?: types.consistencies; - graphOptions?: { - name?: string; - language?: string; - source?: string; - readConsistency?: types.consistencies; - writeConsistency?: types.consistencies; - }; - }); -} - -export namespace errors { - class ArgumentError extends DriverError { - constructor(message: string); - } - - class AuthenticationError extends DriverError { - constructor(message: string); - } - - class BusyConnectionError extends DriverError { - constructor(address: string, maxRequestsPerConnection: number, connectionLength: number); - } - - abstract class DriverError extends Error { - info: string; - - constructor(message: string, constructor?: any); - } - - class DriverInternalError extends DriverError { - constructor(message: string); - } - - class NoHostAvailableError extends DriverError { - innerErrors: any; - - constructor(innerErrors: any, message?: string); - } - - class NotSupportedError extends DriverError { - constructor(message: string); - } - - class OperationTimedOutError extends DriverError { - host?: string; - - constructor(message: string, host?: string); - } - - class ResponseError extends DriverError { - code: number; - - constructor(code: number, message: string); - } -} - -export namespace token { - interface Token { - compare(other: Token): number; - - equals(other: Token): boolean; - - getType(): { code: types.dataTypes, info: any }; - - getValue(): any; - } - - interface TokenRange { - start: Token; - end: Token; - - compare(other: TokenRange): number; - - contains(token: Token): boolean; - - equals(other: TokenRange): boolean; - - isEmpty(): boolean; - - isWrappedAround(): boolean; - - splitEvenly(numberOfSplits: number): TokenRange[]; - - unwrap(): TokenRange[]; - } -} \ No newline at end of file diff --git a/index.js b/index.ts similarity index 100% rename from index.js rename to index.ts diff --git a/lib/auth/base-dse-authenticator.js b/lib/auth/base-dse-authenticator.ts similarity index 100% rename from lib/auth/base-dse-authenticator.js rename to lib/auth/base-dse-authenticator.ts diff --git a/lib/auth/dse-gssapi-auth-provider.js b/lib/auth/dse-gssapi-auth-provider.ts similarity index 100% rename from lib/auth/dse-gssapi-auth-provider.js rename to lib/auth/dse-gssapi-auth-provider.ts diff --git a/lib/auth/dse-plain-text-auth-provider.js b/lib/auth/dse-plain-text-auth-provider.ts similarity index 100% rename from lib/auth/dse-plain-text-auth-provider.js rename to lib/auth/dse-plain-text-auth-provider.ts diff --git a/lib/auth/gssapi-client.js b/lib/auth/gssapi-client.ts similarity index 100% rename from lib/auth/gssapi-client.js rename to lib/auth/gssapi-client.ts diff --git a/lib/auth/index.js b/lib/auth/index.ts similarity index 100% rename from lib/auth/index.js rename to lib/auth/index.ts diff --git a/lib/auth/no-auth-provider.js b/lib/auth/no-auth-provider.ts similarity index 100% rename from lib/auth/no-auth-provider.js rename to lib/auth/no-auth-provider.ts diff --git a/lib/auth/plain-text-auth-provider.js b/lib/auth/plain-text-auth-provider.ts similarity index 100% rename from lib/auth/plain-text-auth-provider.js rename to lib/auth/plain-text-auth-provider.ts diff --git a/lib/auth/provider.js b/lib/auth/provider.ts similarity index 100% rename from lib/auth/provider.js rename to lib/auth/provider.ts diff --git a/lib/client-options.js b/lib/client-options.ts similarity index 100% rename from lib/client-options.js rename to lib/client-options.ts diff --git a/lib/client.js b/lib/client.ts similarity index 100% rename from lib/client.js rename to lib/client.ts diff --git a/lib/concurrent/index.js b/lib/concurrent/index.ts similarity index 100% rename from lib/concurrent/index.js rename to lib/concurrent/index.ts diff --git a/lib/connection.js b/lib/connection.ts similarity index 100% rename from lib/connection.js rename to lib/connection.ts diff --git a/lib/control-connection.js b/lib/control-connection.ts similarity index 100% rename from lib/control-connection.js rename to lib/control-connection.ts diff --git a/lib/datastax/cloud/index.js b/lib/datastax/cloud/index.ts similarity index 100% rename from lib/datastax/cloud/index.js rename to lib/datastax/cloud/index.ts diff --git a/lib/datastax/graph/complex-type-helper.js b/lib/datastax/graph/complex-type-helper.ts similarity index 100% rename from lib/datastax/graph/complex-type-helper.js rename to lib/datastax/graph/complex-type-helper.ts diff --git a/lib/datastax/graph/custom-type-serializers.js b/lib/datastax/graph/custom-type-serializers.ts similarity index 100% rename from lib/datastax/graph/custom-type-serializers.js rename to lib/datastax/graph/custom-type-serializers.ts diff --git a/lib/datastax/graph/graph-executor.js b/lib/datastax/graph/graph-executor.ts similarity index 100% rename from lib/datastax/graph/graph-executor.js rename to lib/datastax/graph/graph-executor.ts diff --git a/lib/datastax/graph/graph-serializer.js b/lib/datastax/graph/graph-serializer.ts similarity index 100% rename from lib/datastax/graph/graph-serializer.js rename to lib/datastax/graph/graph-serializer.ts diff --git a/lib/datastax/graph/index.js b/lib/datastax/graph/index.ts similarity index 100% rename from lib/datastax/graph/index.js rename to lib/datastax/graph/index.ts diff --git a/lib/datastax/graph/options.js b/lib/datastax/graph/options.ts similarity index 100% rename from lib/datastax/graph/options.js rename to lib/datastax/graph/options.ts diff --git a/lib/datastax/graph/result-set.js b/lib/datastax/graph/result-set.ts similarity index 100% rename from lib/datastax/graph/result-set.js rename to lib/datastax/graph/result-set.ts diff --git a/lib/datastax/graph/structure.js b/lib/datastax/graph/structure.ts similarity index 100% rename from lib/datastax/graph/structure.js rename to lib/datastax/graph/structure.ts diff --git a/lib/datastax/graph/type-serializers.js b/lib/datastax/graph/type-serializers.ts similarity index 100% rename from lib/datastax/graph/type-serializers.js rename to lib/datastax/graph/type-serializers.ts diff --git a/lib/datastax/graph/wrappers.js b/lib/datastax/graph/wrappers.ts similarity index 100% rename from lib/datastax/graph/wrappers.js rename to lib/datastax/graph/wrappers.ts diff --git a/lib/datastax/index.js b/lib/datastax/index.ts similarity index 100% rename from lib/datastax/index.js rename to lib/datastax/index.ts diff --git a/lib/datastax/search/date-range.js b/lib/datastax/search/date-range.ts similarity index 100% rename from lib/datastax/search/date-range.js rename to lib/datastax/search/date-range.ts diff --git a/lib/datastax/search/index.js b/lib/datastax/search/index.ts similarity index 100% rename from lib/datastax/search/index.js rename to lib/datastax/search/index.ts diff --git a/lib/encoder.js b/lib/encoder.ts similarity index 100% rename from lib/encoder.js rename to lib/encoder.ts diff --git a/lib/errors.js b/lib/errors.ts similarity index 100% rename from lib/errors.js rename to lib/errors.ts diff --git a/lib/execution-options.js b/lib/execution-options.ts similarity index 100% rename from lib/execution-options.js rename to lib/execution-options.ts diff --git a/lib/execution-profile.js b/lib/execution-profile.ts similarity index 100% rename from lib/execution-profile.js rename to lib/execution-profile.ts diff --git a/lib/geometry/geometry.js b/lib/geometry/geometry.ts similarity index 100% rename from lib/geometry/geometry.js rename to lib/geometry/geometry.ts diff --git a/lib/geometry/index.js b/lib/geometry/index.ts similarity index 100% rename from lib/geometry/index.js rename to lib/geometry/index.ts diff --git a/lib/geometry/line-string.js b/lib/geometry/line-string.ts similarity index 100% rename from lib/geometry/line-string.js rename to lib/geometry/line-string.ts diff --git a/lib/geometry/point.js b/lib/geometry/point.ts similarity index 100% rename from lib/geometry/point.js rename to lib/geometry/point.ts diff --git a/lib/geometry/polygon.js b/lib/geometry/polygon.ts similarity index 100% rename from lib/geometry/polygon.js rename to lib/geometry/polygon.ts diff --git a/lib/host-connection-pool.js b/lib/host-connection-pool.ts similarity index 100% rename from lib/host-connection-pool.js rename to lib/host-connection-pool.ts diff --git a/lib/host.js b/lib/host.ts similarity index 100% rename from lib/host.js rename to lib/host.ts diff --git a/lib/insights-client.js b/lib/insights-client.ts similarity index 100% rename from lib/insights-client.js rename to lib/insights-client.ts diff --git a/lib/mapping/cache.js b/lib/mapping/cache.ts similarity index 100% rename from lib/mapping/cache.js rename to lib/mapping/cache.ts diff --git a/lib/mapping/doc-info-adapter.js b/lib/mapping/doc-info-adapter.ts similarity index 100% rename from lib/mapping/doc-info-adapter.js rename to lib/mapping/doc-info-adapter.ts diff --git a/lib/mapping/index.js b/lib/mapping/index.ts similarity index 100% rename from lib/mapping/index.js rename to lib/mapping/index.ts diff --git a/lib/mapping/mapper.js b/lib/mapping/mapper.ts similarity index 100% rename from lib/mapping/mapper.js rename to lib/mapping/mapper.ts diff --git a/lib/mapping/mapping-handler.js b/lib/mapping/mapping-handler.ts similarity index 100% rename from lib/mapping/mapping-handler.js rename to lib/mapping/mapping-handler.ts diff --git a/lib/mapping/model-batch-item.js b/lib/mapping/model-batch-item.ts similarity index 100% rename from lib/mapping/model-batch-item.js rename to lib/mapping/model-batch-item.ts diff --git a/lib/mapping/model-batch-mapper.js b/lib/mapping/model-batch-mapper.ts similarity index 100% rename from lib/mapping/model-batch-mapper.js rename to lib/mapping/model-batch-mapper.ts diff --git a/lib/mapping/model-mapper.js b/lib/mapping/model-mapper.ts similarity index 100% rename from lib/mapping/model-mapper.js rename to lib/mapping/model-mapper.ts diff --git a/lib/mapping/model-mapping-info.js b/lib/mapping/model-mapping-info.ts similarity index 100% rename from lib/mapping/model-mapping-info.js rename to lib/mapping/model-mapping-info.ts diff --git a/lib/mapping/object-selector.js b/lib/mapping/object-selector.ts similarity index 100% rename from lib/mapping/object-selector.js rename to lib/mapping/object-selector.ts diff --git a/lib/mapping/q.js b/lib/mapping/q.ts similarity index 100% rename from lib/mapping/q.js rename to lib/mapping/q.ts diff --git a/lib/mapping/query-generator.js b/lib/mapping/query-generator.ts similarity index 100% rename from lib/mapping/query-generator.js rename to lib/mapping/query-generator.ts diff --git a/lib/mapping/result-mapper.js b/lib/mapping/result-mapper.ts similarity index 100% rename from lib/mapping/result-mapper.js rename to lib/mapping/result-mapper.ts diff --git a/lib/mapping/result.js b/lib/mapping/result.ts similarity index 100% rename from lib/mapping/result.js rename to lib/mapping/result.ts diff --git a/lib/mapping/table-mappings.js b/lib/mapping/table-mappings.ts similarity index 100% rename from lib/mapping/table-mappings.js rename to lib/mapping/table-mappings.ts diff --git a/lib/mapping/tree.js b/lib/mapping/tree.ts similarity index 100% rename from lib/mapping/tree.js rename to lib/mapping/tree.ts diff --git a/lib/metadata/aggregate.js b/lib/metadata/aggregate.ts similarity index 100% rename from lib/metadata/aggregate.js rename to lib/metadata/aggregate.ts diff --git a/lib/metadata/client-state.js b/lib/metadata/client-state.ts similarity index 100% rename from lib/metadata/client-state.js rename to lib/metadata/client-state.ts diff --git a/lib/metadata/data-collection.js b/lib/metadata/data-collection.ts similarity index 100% rename from lib/metadata/data-collection.js rename to lib/metadata/data-collection.ts diff --git a/lib/metadata/event-debouncer.js b/lib/metadata/event-debouncer.ts similarity index 100% rename from lib/metadata/event-debouncer.js rename to lib/metadata/event-debouncer.ts diff --git a/lib/metadata/index.js b/lib/metadata/index.ts similarity index 100% rename from lib/metadata/index.js rename to lib/metadata/index.ts diff --git a/lib/metadata/materialized-view.js b/lib/metadata/materialized-view.ts similarity index 100% rename from lib/metadata/materialized-view.js rename to lib/metadata/materialized-view.ts diff --git a/lib/metadata/schema-function.js b/lib/metadata/schema-function.ts similarity index 100% rename from lib/metadata/schema-function.js rename to lib/metadata/schema-function.ts diff --git a/lib/metadata/schema-index.js b/lib/metadata/schema-index.ts similarity index 100% rename from lib/metadata/schema-index.js rename to lib/metadata/schema-index.ts diff --git a/lib/metadata/schema-parser.js b/lib/metadata/schema-parser.ts similarity index 100% rename from lib/metadata/schema-parser.js rename to lib/metadata/schema-parser.ts diff --git a/lib/metadata/table-metadata.js b/lib/metadata/table-metadata.ts similarity index 100% rename from lib/metadata/table-metadata.js rename to lib/metadata/table-metadata.ts diff --git a/lib/metrics/client-metrics.js b/lib/metrics/client-metrics.ts similarity index 100% rename from lib/metrics/client-metrics.js rename to lib/metrics/client-metrics.ts diff --git a/lib/metrics/default-metrics.js b/lib/metrics/default-metrics.ts similarity index 100% rename from lib/metrics/default-metrics.js rename to lib/metrics/default-metrics.ts diff --git a/lib/metrics/index.js b/lib/metrics/index.ts similarity index 100% rename from lib/metrics/index.js rename to lib/metrics/index.ts diff --git a/lib/operation-state.js b/lib/operation-state.ts similarity index 100% rename from lib/operation-state.js rename to lib/operation-state.ts diff --git a/lib/policies/address-resolution.js b/lib/policies/address-resolution.ts similarity index 100% rename from lib/policies/address-resolution.js rename to lib/policies/address-resolution.ts diff --git a/lib/policies/index.js b/lib/policies/index.ts similarity index 100% rename from lib/policies/index.js rename to lib/policies/index.ts diff --git a/lib/policies/load-balancing.js b/lib/policies/load-balancing.ts similarity index 100% rename from lib/policies/load-balancing.js rename to lib/policies/load-balancing.ts diff --git a/lib/policies/reconnection.js b/lib/policies/reconnection.ts similarity index 100% rename from lib/policies/reconnection.js rename to lib/policies/reconnection.ts diff --git a/lib/policies/retry.js b/lib/policies/retry.ts similarity index 100% rename from lib/policies/retry.js rename to lib/policies/retry.ts diff --git a/lib/policies/speculative-execution.js b/lib/policies/speculative-execution.ts similarity index 100% rename from lib/policies/speculative-execution.js rename to lib/policies/speculative-execution.ts diff --git a/lib/policies/timestamp-generation.js b/lib/policies/timestamp-generation.ts similarity index 100% rename from lib/policies/timestamp-generation.js rename to lib/policies/timestamp-generation.ts diff --git a/lib/prepare-handler.js b/lib/prepare-handler.ts similarity index 100% rename from lib/prepare-handler.js rename to lib/prepare-handler.ts diff --git a/lib/promise-utils.js b/lib/promise-utils.ts similarity index 100% rename from lib/promise-utils.js rename to lib/promise-utils.ts diff --git a/lib/readers.js b/lib/readers.ts similarity index 100% rename from lib/readers.js rename to lib/readers.ts diff --git a/lib/request-execution.js b/lib/request-execution.ts similarity index 100% rename from lib/request-execution.js rename to lib/request-execution.ts diff --git a/lib/request-handler.js b/lib/request-handler.ts similarity index 100% rename from lib/request-handler.js rename to lib/request-handler.ts diff --git a/lib/requests.js b/lib/requests.ts similarity index 100% rename from lib/requests.js rename to lib/requests.ts diff --git a/lib/stream-id-stack.js b/lib/stream-id-stack.ts similarity index 100% rename from lib/stream-id-stack.js rename to lib/stream-id-stack.ts diff --git a/lib/streams.js b/lib/streams.ts similarity index 100% rename from lib/streams.js rename to lib/streams.ts diff --git a/lib/token.js b/lib/token.ts similarity index 100% rename from lib/token.js rename to lib/token.ts diff --git a/lib/tokenizer.js b/lib/tokenizer.ts similarity index 100% rename from lib/tokenizer.js rename to lib/tokenizer.ts diff --git a/lib/tracker/index.js b/lib/tracker/index.ts similarity index 100% rename from lib/tracker/index.js rename to lib/tracker/index.ts diff --git a/lib/tracker/request-logger.js b/lib/tracker/request-logger.ts similarity index 100% rename from lib/tracker/request-logger.js rename to lib/tracker/request-logger.ts diff --git a/lib/tracker/request-tracker.js b/lib/tracker/request-tracker.ts similarity index 100% rename from lib/tracker/request-tracker.js rename to lib/tracker/request-tracker.ts diff --git a/lib/types/big-decimal.js b/lib/types/big-decimal.ts similarity index 100% rename from lib/types/big-decimal.js rename to lib/types/big-decimal.ts diff --git a/lib/types/duration.js b/lib/types/duration.ts similarity index 100% rename from lib/types/duration.js rename to lib/types/duration.ts diff --git a/lib/types/index.js b/lib/types/index.ts similarity index 100% rename from lib/types/index.js rename to lib/types/index.ts diff --git a/lib/types/inet-address.js b/lib/types/inet-address.ts similarity index 100% rename from lib/types/inet-address.js rename to lib/types/inet-address.ts diff --git a/lib/types/integer.js b/lib/types/integer.ts similarity index 100% rename from lib/types/integer.js rename to lib/types/integer.ts diff --git a/lib/types/local-date.js b/lib/types/local-date.ts similarity index 100% rename from lib/types/local-date.js rename to lib/types/local-date.ts diff --git a/lib/types/local-time.js b/lib/types/local-time.ts similarity index 100% rename from lib/types/local-time.js rename to lib/types/local-time.ts diff --git a/lib/types/mutable-long.js b/lib/types/mutable-long.ts similarity index 100% rename from lib/types/mutable-long.js rename to lib/types/mutable-long.ts diff --git a/lib/types/protocol-version.js b/lib/types/protocol-version.ts similarity index 100% rename from lib/types/protocol-version.js rename to lib/types/protocol-version.ts diff --git a/lib/types/result-set.js b/lib/types/result-set.ts similarity index 100% rename from lib/types/result-set.js rename to lib/types/result-set.ts diff --git a/lib/types/result-stream.js b/lib/types/result-stream.ts similarity index 100% rename from lib/types/result-stream.js rename to lib/types/result-stream.ts diff --git a/lib/types/row.js b/lib/types/row.ts similarity index 100% rename from lib/types/row.js rename to lib/types/row.ts diff --git a/lib/types/time-uuid.js b/lib/types/time-uuid.ts similarity index 100% rename from lib/types/time-uuid.js rename to lib/types/time-uuid.ts diff --git a/lib/types/tuple.js b/lib/types/tuple.ts similarity index 100% rename from lib/types/tuple.js rename to lib/types/tuple.ts diff --git a/lib/types/uuid.js b/lib/types/uuid.ts similarity index 100% rename from lib/types/uuid.js rename to lib/types/uuid.ts diff --git a/lib/types/version-number.js b/lib/types/version-number.ts similarity index 100% rename from lib/types/version-number.js rename to lib/types/version-number.ts diff --git a/lib/utils.js b/lib/utils.ts similarity index 100% rename from lib/utils.js rename to lib/utils.ts diff --git a/lib/writers.js b/lib/writers.ts similarity index 100% rename from lib/writers.js rename to lib/writers.ts diff --git a/package.json b/package.json index 3ec7eea5..75feaf8b 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ "graphdb" ], "license": "Apache-2.0", - "types": "./index.d.ts", "dependencies": { "@types/node": "^18.11.18", "adm-zip": "~0.5.10", diff --git a/tsconfig.json b/tsconfig.json index 2ccd96fe..c4608520 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,18 +7,16 @@ "strict": false, "noImplicitAny": false, "outDir": "out", - "declaration": true, - "allowJs": true, + // "declaration": true, + // "allowJs": true, "esModuleInterop": true, "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "checkJs": true, - "declarationMap": true + // "checkJs": true, + // "declarationMap": true }, "include": [ "lib/**/*.ts", - "index.js", - "indes.d.ts" + "index.ts" ], "exclude": [ "node_modules" From 9dc0a4cb9c01fc8e3dc9f03bde7af5227b72d8b2 Mon Sep 17 00:00:00 2001 From: Jane He Date: Tue, 21 Jan 2025 17:05:46 +0800 Subject: [PATCH 03/19] can run tests and emit files --- tsconfig.json | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index c4608520..bb23852c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,24 +1,26 @@ { - "compilerOptions": { - "module": "commonjs", - "lib": ["es2015"], - "target": "es2015", - "sourceMap": true, - "strict": false, - "noImplicitAny": false, - "outDir": "out", - // "declaration": true, - // "allowJs": true, - "esModuleInterop": true, - "skipLibCheck": true, - // "checkJs": true, - // "declarationMap": true - }, - "include": [ - "lib/**/*.ts", - "index.ts" - ], - "exclude": [ - "node_modules" - ] - } \ No newline at end of file + "compilerOptions": { + "module": "commonjs", + "lib": ["es2015"], + "target": "es2015", + "sourceMap": true, + "strict": false, + "noImplicitAny": false, + "outDir": "out", + "declaration": true, + "allowJs": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "checkJs": true, + "declarationMap": true, + "moduleDetection": "force" + }, + "include": [ + "lib/**/*.ts", + "index.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file From 2628567c85dc014fe3a29fa989d11a92dac78f67 Mon Sep 17 00:00:00 2001 From: Jane He Date: Tue, 21 Jan 2025 19:31:56 +0800 Subject: [PATCH 04/19] auth folder migrated to es6 export, tests break --- api-extractor.json | 454 +++++ dist/cassandra-driver.d.ts | 1653 ++++++++++++++++ etc/cassandra-driver.api.md | 2221 ++++++++++++++++++++++ index.d.ts | 414 ++++ lib/auth/base-dse-authenticator.ts | 2 +- lib/auth/dse-gssapi-auth-provider.ts | 2 +- lib/auth/dse-plain-text-auth-provider.ts | 2 +- lib/auth/gssapi-client.ts | 2 +- lib/auth/index.ts | 14 +- lib/auth/no-auth-provider.ts | 2 +- lib/auth/plain-text-auth-provider.ts | 2 +- lib/auth/provider.ts | 6 +- package-lock.json | 154 +- package.json | 6 +- tsconfig.json | 1 - tsdoc-metadata.json | 11 + 16 files changed, 4928 insertions(+), 18 deletions(-) create mode 100644 api-extractor.json create mode 100644 dist/cassandra-driver.d.ts create mode 100644 etc/cassandra-driver.api.md create mode 100644 index.d.ts create mode 100644 tsdoc-metadata.json diff --git a/api-extractor.json b/api-extractor.json new file mode 100644 index 00000000..3f09edda --- /dev/null +++ b/api-extractor.json @@ -0,0 +1,454 @@ +/** + * Config file for API Extractor. For more info, please visit: https://api-extractor.com + */ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + + /** + * Optionally specifies another JSON config file that this file extends from. This provides a way for + * standard settings to be shared across multiple projects. + * + * If the path starts with "./" or "../", the path is resolved relative to the folder of the file that contains + * the "extends" field. Otherwise, the first path segment is interpreted as an NPM package name, and will be + * resolved using NodeJS require(). + * + * SUPPORTED TOKENS: none + * DEFAULT VALUE: "" + */ + // "extends": "./shared/api-extractor-base.json" + // "extends": "my-package/include/api-extractor-base.json" + + /** + * Determines the "" token that can be used with other config file settings. The project folder + * typically contains the tsconfig.json and package.json config files, but the path is user-defined. + * + * The path is resolved relative to the folder of the config file that contains the setting. + * + * The default value for "projectFolder" is the token "", which means the folder is determined by traversing + * parent folders, starting from the folder containing api-extractor.json, and stopping at the first folder + * that contains a tsconfig.json file. If a tsconfig.json file cannot be found in this way, then an error + * will be reported. + * + * SUPPORTED TOKENS: + * DEFAULT VALUE: "" + */ + // "projectFolder": "..", + + /** + * (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor + * analyzes the symbols exported by this module. + * + * The file extension must be ".d.ts" and not ".ts". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + */ + "mainEntryPointFilePath": "/out/index.d.ts", + + /** + * A list of NPM package names whose exports should be treated as part of this package. + * + * For example, suppose that Webpack is used to generate a distributed bundle for the project "library1", + * and another NPM package "library2" is embedded in this bundle. Some types from library2 may become part + * of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly + * imports library2. To avoid this, we might specify: + * + * "bundledPackages": [ "library2" ], + * + * This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been + * local files for library1. + * + * The "bundledPackages" elements may specify glob patterns using minimatch syntax. To ensure deterministic + * output, globs are expanded by matching explicitly declared top-level dependencies only. For example, + * the pattern below will NOT match "@my-company/example" unless it appears in a field such as "dependencies" + * or "devDependencies" of the project's package.json file: + * + * "bundledPackages": [ "@my-company/*" ], + */ + "bundledPackages": [], + + /** + * Specifies what type of newlines API Extractor should use when writing output files. By default, the output files + * will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead. + * To use the OS's default newline kind, specify "os". + * + * DEFAULT VALUE: "crlf" + */ + // "newlineKind": "crlf", + + /** + * Specifies how API Extractor sorts members of an enum when generating the .api.json file. By default, the output + * files will be sorted alphabetically, which is "by-name". To keep the ordering in the source code, specify + * "preserve". + * + * DEFAULT VALUE: "by-name" + */ + // "enumMemberOrder": "by-name", + + /** + * Set to true when invoking API Extractor's test harness. When `testMode` is true, the `toolVersion` field in the + * .api.json file is assigned an empty string to prevent spurious diffs in output files tracked for tests. + * + * DEFAULT VALUE: "false" + */ + // "testMode": false, + + /** + * Determines how the TypeScript compiler engine will be invoked by API Extractor. + */ + "compiler": { + /** + * Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * Note: This setting will be ignored if "overrideTsconfig" is used. + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/tsconfig.json" + */ + // "tsconfigFilePath": "/tsconfig.json", + /** + * Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk. + * The object must conform to the TypeScript tsconfig schema: + * + * http://json.schemastore.org/tsconfig + * + * If omitted, then the tsconfig.json file will be read from the "projectFolder". + * + * DEFAULT VALUE: no overrideTsconfig section + */ + // "overrideTsconfig": { + // . . . + // } + /** + * This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended + * and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when + * dependencies contain declarations that are incompatible with the TypeScript engine that API Extractor uses + * for its analysis. Where possible, the underlying issue should be fixed rather than relying on skipLibCheck. + * + * DEFAULT VALUE: false + */ + // "skipLibCheck": true, + }, + + /** + * Configures how the API report file (*.api.md) will be generated. + */ + "apiReport": { + /** + * (REQUIRED) Whether to generate an API report. + */ + "enabled": true + + /** + * The base filename for the API report files, to be combined with "reportFolder" or "reportTempFolder" + * to produce the full file path. The "reportFileName" should not include any path separators such as + * "\" or "/". The "reportFileName" should not include a file extension, since API Extractor will automatically + * append an appropriate file extension such as ".api.md". If the "reportVariants" setting is used, then the + * file extension includes the variant name, for example "my-report.public.api.md" or "my-report.beta.api.md". + * The "complete" variant always uses the simple extension "my-report.api.md". + * + * Previous versions of API Extractor required "reportFileName" to include the ".api.md" extension explicitly; + * for backwards compatibility, that is still accepted but will be discarded before applying the above rules. + * + * SUPPORTED TOKENS: , + * DEFAULT VALUE: "" + */ + // "reportFileName": "", + + /** + * To support different approval requirements for different API levels, multiple "variants" of the API report can + * be generated. The "reportVariants" setting specifies a list of variants to be generated. If omitted, + * by default only the "complete" variant will be generated, which includes all @internal, @alpha, @beta, + * and @public items. Other possible variants are "alpha" (@alpha + @beta + @public), "beta" (@beta + @public), + * and "public" (@public only). + * + * DEFAULT VALUE: [ "complete" ] + */ + // "reportVariants": ["public", "beta"], + + /** + * Specifies the folder where the API report file is written. The file name portion is determined by + * the "reportFileName" setting. + * + * The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy, + * e.g. for an API review. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/etc/" + */ + // "reportFolder": "/etc/", + + /** + * Specifies the folder where the temporary report file is written. The file name portion is determined by + * the "reportFileName" setting. + * + * After the temporary file is written to disk, it is compared with the file in the "reportFolder". + * If they are different, a production build will fail. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/temp/" + */ + // "reportTempFolder": "/temp/", + + /** + * Whether "forgotten exports" should be included in the API report file. Forgotten exports are declarations + * flagged with `ae-forgotten-export` warnings. See https://api-extractor.com/pages/messages/ae-forgotten-export/ to + * learn more. + * + * DEFAULT VALUE: "false" + */ + // "includeForgottenExports": false + }, + + /** + * Configures how the doc model file (*.api.json) will be generated. + */ + "docModel": { + /** + * (REQUIRED) Whether to generate a doc model file. + */ + "enabled": true + + /** + * The output path for the doc model file. The file extension should be ".api.json". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/temp/.api.json" + */ + // "apiJsonFilePath": "/temp/.api.json", + + /** + * Whether "forgotten exports" should be included in the doc model file. Forgotten exports are declarations + * flagged with `ae-forgotten-export` warnings. See https://api-extractor.com/pages/messages/ae-forgotten-export/ to + * learn more. + * + * DEFAULT VALUE: "false" + */ + // "includeForgottenExports": false, + + /** + * The base URL where the project's source code can be viewed on a website such as GitHub or + * Azure DevOps. This URL path corresponds to the `` path on disk. + * + * This URL is concatenated with the file paths serialized to the doc model to produce URL file paths to individual API items. + * For example, if the `projectFolderUrl` is "https://github.com/microsoft/rushstack/tree/main/apps/api-extractor" and an API + * item's file path is "api/ExtractorConfig.ts", the full URL file path would be + * "https://github.com/microsoft/rushstack/tree/main/apps/api-extractor/api/ExtractorConfig.js". + * + * This setting can be omitted if you don't need source code links in your API documentation reference. + * + * SUPPORTED TOKENS: none + * DEFAULT VALUE: "" + */ + // "projectFolderUrl": "http://github.com/path/to/your/projectFolder" + }, + + /** + * Configures how the .d.ts rollup file will be generated. + */ + "dtsRollup": { + /** + * (REQUIRED) Whether to generate the .d.ts rollup file. + */ + "enabled": true + + /** + * Specifies the output path for a .d.ts rollup file to be generated without any trimming. + * This file will include all declarations that are exported by the main entry point. + * + * If the path is an empty string, then this file will not be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/dist/.d.ts" + */ + // "untrimmedFilePath": "/dist/.d.ts", + + /** + * Specifies the output path for a .d.ts rollup file to be generated with trimming for an "alpha" release. + * This file will include only declarations that are marked as "@public", "@beta", or "@alpha". + * + * If the path is an empty string, then this file will not be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "alphaTrimmedFilePath": "/dist/-alpha.d.ts", + + /** + * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release. + * This file will include only declarations that are marked as "@public" or "@beta". + * + * If the path is an empty string, then this file will not be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "betaTrimmedFilePath": "/dist/-beta.d.ts", + + /** + * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release. + * This file will include only declarations that are marked as "@public". + * + * If the path is an empty string, then this file will not be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "publicTrimmedFilePath": "/dist/-public.d.ts", + + /** + * When a declaration is trimmed, by default it will be replaced by a code comment such as + * "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the + * declaration completely. + * + * DEFAULT VALUE: false + */ + // "omitTrimmingComments": true + }, + + /** + * Configures how the tsdoc-metadata.json file will be generated. + */ + "tsdocMetadata": { + /** + * Whether to generate the tsdoc-metadata.json file. + * + * DEFAULT VALUE: true + */ + // "enabled": true, + /** + * Specifies where the TSDoc metadata file should be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * The default value is "", which causes the path to be automatically inferred from the "tsdocMetadata", + * "typings" or "main" fields of the project's package.json. If none of these fields are set, the lookup + * falls back to "tsdoc-metadata.json" in the package folder. + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "tsdocMetadataFilePath": "/dist/tsdoc-metadata.json" + }, + + /** + * Configures how API Extractor reports error and warning messages produced during analysis. + * + * There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages. + */ + "messages": { + /** + * Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing + * the input .d.ts files. + * + * TypeScript message identifiers start with "TS" followed by an integer. For example: "TS2551" + * + * DEFAULT VALUE: A single "default" entry with logLevel=warning. + */ + "compilerMessageReporting": { + /** + * Configures the default routing for messages that don't match an explicit rule in this table. + */ + "default": { + /** + * Specifies whether the message should be written to the the tool's output log. Note that + * the "addToApiReportFile" property may supersede this option. + * + * Possible values: "error", "warning", "none" + * + * Errors cause the build to fail and return a nonzero exit code. Warnings cause a production build fail + * and return a nonzero exit code. For a non-production build (e.g. when "api-extractor run" includes + * the "--local" option), the warning is displayed but the build will not fail. + * + * DEFAULT VALUE: "warning" + */ + "logLevel": "warning" + + /** + * When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md), + * then the message will be written inside that file; otherwise, the message is instead logged according to + * the "logLevel" option. + * + * DEFAULT VALUE: false + */ + // "addToApiReportFile": false + } + + // "TS2551": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + }, + + /** + * Configures handling of messages reported by API Extractor during its analysis. + * + * API Extractor message identifiers start with "ae-". For example: "ae-extra-release-tag" + * + * DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings + */ + "extractorMessageReporting": { + "default": { + "logLevel": "warning" + // "addToApiReportFile": false + } + + // "ae-extra-release-tag": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + }, + + /** + * Configures handling of messages reported by the TSDoc parser when analyzing code comments. + * + * TSDoc message identifiers start with "tsdoc-". For example: "tsdoc-link-tag-unescaped-text" + * + * DEFAULT VALUE: A single "default" entry with logLevel=warning. + */ + "tsdocMessageReporting": { + "default": { + "logLevel": "warning" + // "addToApiReportFile": false + } + + // "tsdoc-link-tag-unescaped-text": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + } + } +} diff --git a/dist/cassandra-driver.d.ts b/dist/cassandra-driver.d.ts new file mode 100644 index 00000000..6ed51dc6 --- /dev/null +++ b/dist/cassandra-driver.d.ts @@ -0,0 +1,1653 @@ +import * as events from 'events'; +import _Long = require('long'); +import { Readable } from 'stream'; +import * as stream from 'stream'; +import * as tls from 'tls'; +import { URL as URL_2 } from 'url'; + +export declare type ArrayOrObject = any[]|{[key: string]: any}; + +export declare namespace auth { + export interface Authenticator { + initialResponse(callback: Function): void; + + evaluateChallenge(challenge: Buffer, callback: Function): void; + + onAuthenticationSuccess(token?: Buffer): void; + } + + export interface AuthProvider { + newAuthenticator(endpoint: string, name: string): Authenticator; + } + + export class PlainTextAuthProvider implements AuthProvider { + constructor(username: string, password: string); + + newAuthenticator(endpoint: string, name: string): Authenticator; + } + + export class DsePlainTextAuthProvider implements AuthProvider { + constructor(username: string, password: string, authorizationId?: string); + + newAuthenticator(endpoint: string, name: string): Authenticator; + } + + export class DseGssapiAuthProvider implements AuthProvider { + constructor(gssOptions?: { authorizationId?: string, service?: string, hostNameResolver?: Function }); + + newAuthenticator(endpoint: string, name: string): Authenticator; + } +} + +export declare class Client extends events.EventEmitter { + hosts: HostMap; + keyspace: string; + metadata: metadata.Metadata; + metrics: metrics.ClientMetrics; + + constructor(options: DseClientOptions); + + connect(): Promise; + + connect(callback: EmptyCallback): void; + + execute(query: string, params?: ArrayOrObject, options?: QueryOptions): Promise; + + execute(query: string, params: ArrayOrObject, options: QueryOptions, callback: ValueCallback): void; + + execute(query: string, params: ArrayOrObject, callback: ValueCallback): void; + + execute(query: string, callback: ValueCallback): void; + + executeGraph( + traversal: string, + parameters: { [name: string]: any } | undefined, + options: GraphQueryOptions, + callback: ValueCallback): void; + + executeGraph( + traversal: string, + parameters: { [name: string]: any } | undefined, + callback: ValueCallback): void; + + executeGraph(traversal: string, callback: ValueCallback): void; + + executeGraph( + traversal: string, + parameters?: { [name: string]: any }, + options?: GraphQueryOptions): Promise; + + eachRow(query: string, + params: ArrayOrObject, + options: QueryOptions, + rowCallback: (n: number, row: types.Row) => void, + callback?: ValueCallback): void; + + eachRow(query: string, + params: ArrayOrObject, + rowCallback: (n: number, row: types.Row) => void, + callback?: ValueCallback): void; + + eachRow(query: string, + rowCallback: (n: number, row: types.Row) => void): void; + + stream(query: string, params?: ArrayOrObject, options?: QueryOptions, callback?: EmptyCallback): events.EventEmitter; + + batch( + queries: Array, + options?: QueryOptions): Promise; + + batch( + queries: Array, + options: QueryOptions, + callback: ValueCallback): void; + + batch( + queries: Array, + callback: ValueCallback): void; + + shutdown(): Promise; + + shutdown(callback: EmptyCallback): void; + + getReplicas(keyspace: string, token: Buffer): Host[]; + + getState(): metadata.ClientState; +} + +export declare interface ClientOptions { + contactPoints?: string[]; + localDataCenter?: string; + keyspace?: string; + authProvider?: auth.AuthProvider; + credentials?: { + username: string; + password: string; + } + + cloud?: { + secureConnectBundle: string | URL_2; + }; + + encoding?: { + map?: Function; + set?: Function; + copyBuffer?: boolean; + useUndefinedAsUnset?: boolean; + useBigIntAsLong?: boolean; + useBigIntAsVarint?: boolean; + }; + isMetadataSyncEnabled?: boolean; + maxPrepared?: number; + metrics?: metrics.ClientMetrics; + policies?: { + addressResolution?: policies.addressResolution.AddressTranslator; + loadBalancing?: policies.loadBalancing.LoadBalancingPolicy; + reconnection?: policies.reconnection.ReconnectionPolicy; + retry?: policies.retry.RetryPolicy; + speculativeExecution?: policies.speculativeExecution.SpeculativeExecutionPolicy; + timestampGeneration?: policies.timestampGeneration.TimestampGenerator; + }; + pooling?: { + coreConnectionsPerHost?: { [key: number]: number; }; + heartBeatInterval?: number; + maxRequestsPerConnection?: number; + warmup?: boolean; + }; + prepareOnAllHosts?: boolean; + profiles?: ExecutionProfile[]; + protocolOptions?: { + maxSchemaAgreementWaitSeconds?: number; + maxVersion?: number; + noCompact?: boolean; + port?: number; + }; + promiseFactory?: (handler: (callback: (err: Error, result?: any) => void) => void) => Promise; + queryOptions?: QueryOptions; + refreshSchemaDelay?: number; + rePrepareOnUp?: boolean; + requestTracker?: tracker.RequestTracker; + socketOptions?: { + coalescingThreshold?: number; + connectTimeout?: number; + defunctReadTimeoutThreshold?: number; + keepAlive?: boolean; + keepAliveDelay?: number; + readTimeout?: number; + tcpNoDelay?: boolean; + }; + sslOptions?: tls.ConnectionOptions; +} + +export declare namespace concurrent { + export interface ResultSetGroup { + errors: Error[]; + resultItems: any[]; + totalExecuted: number; + } + + export type Options = { + collectResults?: boolean; + concurrencyLevel?: number; + executionProfile?: string; + maxErrors?: number; + raiseOnFirstError?: boolean; + } + + export function executeConcurrent( + client: Client, + query: string, + parameters: any[][]|Readable, + options?: Options): Promise; + + export function executeConcurrent( + client: Client, + queries: Array<{query: string, params: any[]}>, + options?: Options): Promise; +} + +export declare namespace datastax { + import graph = graphModule.graph; + + import search = searchModule.search; +} + +export declare function defaultOptions(): ClientOptions; + +export declare interface DseClientOptions extends ClientOptions { + id?: Uuid; + applicationName?: string; + applicationVersion?: string; + monitorReporting?: { enabled?: boolean }; + graphOptions?: GraphOptions; +} + +export declare type EmptyCallback = (err: Error) => void; + +export declare namespace errors { + export class ArgumentError extends DriverError { + constructor(message: string); + } + + export class AuthenticationError extends DriverError { + constructor(message: string); + } + + export class BusyConnectionError extends DriverError { + constructor(address: string, maxRequestsPerConnection: number, connectionLength: number); + } + + export abstract class DriverError extends Error { + info: string; + + constructor(message: string, constructor?: any); + } + + export class DriverInternalError extends DriverError { + constructor(message: string); + } + + export class NoHostAvailableError extends DriverError { + innerErrors: any; + + constructor(innerErrors: any, message?: string); + } + + export class NotSupportedError extends DriverError { + constructor(message: string); + } + + export class OperationTimedOutError extends DriverError { + host?: string; + + constructor(message: string, host?: string); + } + + export class ResponseError extends DriverError { + code: number; + + constructor(code: number, message: string); + } +} + +export declare interface ExecutionOptions { + getCaptureStackTrace(): boolean; + + getConsistency(): types.consistencies; + + getCustomPayload(): { [key: string]: any }; + + getFetchSize(): number; + + getFixedHost(): Host; + + getHints(): string[] | string[][]; + + isAutoPage(): boolean; + + isBatchCounter(): boolean; + + isBatchLogged(): boolean; + + isIdempotent(): boolean; + + isPrepared(): boolean; + + isQueryTracing(): boolean; + + getKeyspace(): string; + + getLoadBalancingPolicy(): policies.loadBalancing.LoadBalancingPolicy; + + getPageState(): Buffer; + + getRawQueryOptions(): QueryOptions; + + getReadTimeout(): number; + + getRetryPolicy(): policies.retry.RetryPolicy; + + getRoutingKey(): Buffer | Buffer[]; + + getSerialConsistency(): types.consistencies; + + getTimestamp(): number | Long | undefined | null; + + setHints(hints: string[]): void; +} + +export declare class ExecutionProfile { + consistency?: types.consistencies; + loadBalancing?: policies.loadBalancing.LoadBalancingPolicy; + name: string; + readTimeout?: number; + retry?: policies.retry.RetryPolicy; + serialConsistency?: types.consistencies; + graphOptions?: { + name?: string; + language?: string; + source?: string; + readConsistency?: types.consistencies; + writeConsistency?: types.consistencies; + }; + + constructor(name: string, options: { + consistency?: types.consistencies; + loadBalancing?: policies.loadBalancing.LoadBalancingPolicy; + readTimeout?: number; + retry?: policies.retry.RetryPolicy; + serialConsistency?: types.consistencies; + graphOptions?: { + name?: string; + language?: string; + source?: string; + readConsistency?: types.consistencies; + writeConsistency?: types.consistencies; + }; + }); +} + +export declare namespace geometry { + export class LineString { + constructor(...args: Point[]); + + static fromBuffer(buffer: Buffer): LineString; + + static fromString(textValue: string): LineString; + + equals(other: LineString): boolean; + + toBuffer(): Buffer; + + toJSON(): string; + + toString(): string; + + } + + export class Point { + constructor(x: number, y: number); + + static fromBuffer(buffer: Buffer): Point; + + static fromString(textValue: string): Point; + + equals(other: Point): boolean; + + toBuffer(): Buffer; + + toJSON(): string; + + toString(): string; + + } + + export class Polygon { + constructor(...args: Point[]); + + static fromBuffer(buffer: Buffer): Polygon; + + static fromString(textValue: string): Polygon; + + equals(other: Polygon): boolean; + + toBuffer(): Buffer; + + toJSON(): string; + + toString(): string; + } +} + +declare namespace graph { + interface Edge extends Element { + outV?: Vertex; + outVLabel?: string; + inV?: Vertex; + inVLabel?: string; + properties?: object; + } + + interface Element { + id: any; + label: string; + } + + class GraphResultSet implements Iterator { + constructor(rs: types.ResultSet); + + first(): any; + + toArray(): any[]; + + values(): Iterator; + + next(value?: any): IteratorResult; + } + + interface Path { + labels: any[]; + objects: any[]; + } + + interface Property { + value: any + key: any + } + + interface Vertex extends Element { + properties?: { [key: string]: any[] } + } + + interface VertexProperty extends Element { + value: any + key: string + properties?: any + } + + function asDouble(value: number): object; + + function asFloat(value: number): object; + + function asInt(value: number): object; + + function asTimestamp(value: Date): object; + + function asUdt(value: object): object; + + interface EnumValue { + toString(): string + } + + namespace t { + const id: EnumValue; + const key: EnumValue; + const label: EnumValue; + const value: EnumValue; + } + + namespace direction { + // `in` is a reserved word + const in_: EnumValue; + const out: EnumValue; + const both: EnumValue; + } +} + +export declare type GraphOptions = { + language?: string; + name?: string; + readConsistency?: types.consistencies; + readTimeout?: number; + source?: string; + writeConsistency?: types.consistencies; +}; + +export declare interface GraphQueryOptions extends QueryOptions { + graphLanguage?: string; + graphName?: string; + graphReadConsistency?: types.consistencies; + graphSource?: string; + graphWriteConsistency?: types.consistencies; +} + +export declare interface Host extends events.EventEmitter { + address: string; + cassandraVersion: string; + datacenter: string; + rack: string; + tokens: string[]; + hostId: types.Uuid; + + canBeConsideredAsUp(): boolean; + + getCassandraVersion(): number[]; + + isUp(): boolean; +} + +export declare interface HostMap extends events.EventEmitter { + length: number; + + forEach(callback: (value: Host, key: string) => void): void; + + get(key: string): Host; + + keys(): string[]; + + values(): Host[]; +} + +export declare namespace mapping { + export interface TableMappings { + getColumnName(propName: string): string; + + getPropertyName(columnName: string): string; + + newObjectInstance(): any; + } + + export class DefaultTableMappings implements TableMappings { + getColumnName(propName: string): string; + + getPropertyName(columnName: string): string; + + newObjectInstance(): any; + } + + export class UnderscoreCqlToCamelCaseMappings implements TableMappings { + getColumnName(propName: string): string; + + getPropertyName(columnName: string): string; + + newObjectInstance(): any; + } + + export interface Result extends Iterator { + wasApplied(): boolean; + + first(): T | null; + + forEach(callback: (currentValue: T, index: number) => void, thisArg?: any): void; + + toArray(): T[]; + } + + export type MappingExecutionOptions = { + executionProfile?: string; + isIdempotent?: boolean; + logged?: boolean; + timestamp?: number | Long; + fetchSize?: number; + pageState?: number; + } + + export interface ModelTables { + name: string; + isView: boolean; + } + + export class Mapper { + constructor(client: Client, options?: MappingOptions); + + batch(items: ModelBatchItem[], executionOptions?: string | MappingExecutionOptions): Promise; + + forModel(name: string): ModelMapper; + } + + export type MappingOptions = { + models: { [key: string]: ModelOptions }; + } + + export type FindDocInfo = { + fields?: string[]; + orderBy?: { [key: string]: string }; + limit?: number; + } + + export type InsertDocInfo = { + fields?: string[]; + ttl?: number; + ifNotExists?: boolean; + } + + export type UpdateDocInfo = { + fields?: string[]; + ttl?: number; + ifExists?: boolean; + when?: { [key: string]: any }; + orderBy?: { [key: string]: string }; + limit?: number; + deleteOnlyColumns?: boolean; + } + + export type RemoveDocInfo = { + fields?: string[]; + ttl?: number; + ifExists?: boolean; + when?: { [key: string]: any }; + deleteOnlyColumns?: boolean; + } + + export type ModelOptions = { + tables?: string[] | ModelTables[]; + mappings?: TableMappings; + columns?: { [key: string]: string|ModelColumnOptions }; + keyspace?: string; + } + + export type ModelColumnOptions = { + name: string; + toModel?: (columnValue: any) => any; + fromModel?: (modelValue: any) => any; + }; + + export interface ModelBatchItem { + + } + + export interface ModelBatchMapper { + insert(doc: any, docInfo?: InsertDocInfo): ModelBatchItem; + + remove(doc: any, docInfo?: RemoveDocInfo): ModelBatchItem; + + update(doc: any, docInfo?: UpdateDocInfo): ModelBatchItem; + } + + export interface ModelMapper { + name: string; + batching: ModelBatchMapper; + + get(doc: { [key: string]: any }, docInfo?: { fields?: string[] }, executionOptions?: string | MappingExecutionOptions): Promise; + + find(doc: { [key: string]: any }, docInfo?: FindDocInfo, executionOptions?: string | MappingExecutionOptions): Promise>; + + findAll(docInfo?: FindDocInfo, executionOptions?: string | MappingExecutionOptions): Promise>; + + insert(doc: { [key: string]: any }, docInfo?: InsertDocInfo, executionOptions?: string | MappingExecutionOptions): Promise>; + + update(doc: { [key: string]: any }, docInfo?: UpdateDocInfo, executionOptions?: string | MappingExecutionOptions): Promise>; + + remove(doc: { [key: string]: any }, docInfo?: RemoveDocInfo, executionOptions?: string | MappingExecutionOptions): Promise>; + + mapWithQuery( + query: string, + paramsHandler: (doc: any) => any[], + executionOptions?: string | MappingExecutionOptions + ): (doc: any, executionOptions?: string | MappingExecutionOptions) => Promise>; + } + + export namespace q { + export interface QueryOperator { + + } + + export function in_(arr: any): QueryOperator; + + export function gt(value: any): QueryOperator; + + export function gte(value: any): QueryOperator; + + export function lt(value: any): QueryOperator; + + export function lte(value: any): QueryOperator; + + export function notEq(value: any): QueryOperator; + + export function and(condition1: any, condition2: any): QueryOperator; + + export function incr(value: any): QueryOperator; + + export function decr(value: any): QueryOperator; + + export function append(value: any): QueryOperator; + + export function prepend(value: any): QueryOperator; + + export function remove(value: any): QueryOperator; + } +} + +export declare namespace metadata { + + export interface Aggregate { + argumentTypes: Array<{ code: dataTypes, info: any }>; + finalFunction: string; + initCondition: string; + keyspaceName: string; + returnType: string; + signature: string[]; + stateFunction: string; + stateType: string; + } + + export interface ClientState { + getConnectedHosts(): Host[]; + + getInFlightQueries(host: Host): number; + + getOpenConnections(host: Host): number; + + toString(): string; + } + + export interface DataTypeInfo { + code: dataTypes; + info: string | DataTypeInfo | DataTypeInfo[]; + options: { + frozen: boolean; + reversed: boolean; + }; + } + + export interface ColumnInfo { + name: string; + type: DataTypeInfo; + } + + export enum IndexKind { + custom = 0, + keys, + composites + } + + export interface Index { + kind: IndexKind; + name: string; + options: object; + target: string; + + isCompositesKind(): boolean; + + isCustomKind(): boolean; + + isKeysKind(): boolean; + } + + export interface DataCollection { + bloomFilterFalsePositiveChance: number; + caching: string; + clusteringKeys: ColumnInfo[]; + clusteringOrder: string[]; + columns: ColumnInfo[]; + columnsByName: { [key: string]: ColumnInfo }; + comment: string; + compactionClass: string; + compactionOptions: { [option: string]: any; }; + compression: { + class?: string; + [option: string]: any; + }; + crcCheckChange?: number; + defaultTtl: number; + extensions: { [option: string]: any; }; + gcGraceSeconds: number; + localReadRepairChance: number; + maxIndexInterval?: number; + minIndexInterval?: number; + name: string; + partitionKeys: ColumnInfo[]; + populateCacheOnFlush: boolean; + readRepairChance: number; + speculativeRetry: string; + } + + export interface MaterializedView extends DataCollection { + tableName: string; + whereClause: string; + includeAllColumns: boolean; + } + + export interface TableMetadata extends DataCollection { + indexes: Index[]; + indexInterval?: number; + isCompact: boolean; + memtableFlushPeriod: number; + replicateOnWrite: boolean; + cdc?: boolean; + virtual: boolean; + } + + export interface QueryTrace { + requestType: string; + coordinator: InetAddress; + parameters: { [key: string]: any }; + startedAt: number | types.Long; + duration: number; + clientAddress: string; + events: Array<{ id: Uuid; activity: any; source: any; elapsed: any; thread: any }>; + } + + export interface SchemaFunction { + argumentNames: string[]; + argumentTypes: Array<{ code: dataTypes, info: any }>; + body: string; + calledOnNullInput: boolean; + keyspaceName: string; + language: string; + name: string; + returnType: string; + signature: string[]; + } + + export interface Udt { + name: string; + fields: ColumnInfo[] + } + + export interface Metadata { + keyspaces: { [name: string]: { name: string, strategy: string }}; + + clearPrepared(): void; + + getAggregate(keyspaceName: string, name: string, signature: string[] | Array<{ code: number, info: any }>, callback: ValueCallback): void; + + getAggregate(keyspaceName: string, name: string, signature: string[] | Array<{ code: number, info: any }>): Promise; + + getAggregates(keyspaceName: string, name: string, callback: ValueCallback): void; + + getAggregates(keyspaceName: string, name: string): Promise; + + getFunction(keyspaceName: string, name: string, signature: string[] | Array<{ code: number, info: any }>, callback: ValueCallback): void; + + getFunction(keyspaceName: string, name: string, signature: string[] | Array<{ code: number, info: any }>): Promise; + + getFunctions(keyspaceName: string, name: string, callback: ValueCallback): void; + + getFunctions(keyspaceName: string, name: string): Promise; + + getMaterializedView(keyspaceName: string, name: string, callback: ValueCallback): void; + + getMaterializedView(keyspaceName: string, name: string, callback: EmptyCallback): Promise; + + getReplicas(keyspaceName: string, token: Buffer | token.Token | token.TokenRange): Host[]; + + getTable(keyspaceName: string, name: string, callback: ValueCallback): void; + + getTable(keyspaceName: string, name: string): Promise; + + getTokenRanges(): Set; + + getTokenRangesForHost(keyspaceName: string, host: Host): Set | null; + + getTrace(traceId: Uuid, consistency: types.consistencies, callback: ValueCallback): void; + + getTrace(traceId: Uuid, consistency: types.consistencies): Promise; + + getTrace(traceId: Uuid, callback: ValueCallback): void; + + getTrace(traceId: Uuid): Promise; + + getUdt(keyspaceName: string, name: string, callback: ValueCallback): void; + + getUdt(keyspaceName: string, name: string): Promise; + + newToken(components: Buffer[] | Buffer | string): token.Token; + + newTokenRange(start: token.Token, end: token.Token): token.TokenRange; + + refreshKeyspace(name: string, callback: EmptyCallback): void; + + refreshKeyspace(name: string): Promise; + + refreshKeyspaces(waitReconnect: boolean, callback: EmptyCallback): void; + + refreshKeyspaces(waitReconnect?: boolean): Promise; + + refreshKeyspaces(callback: EmptyCallback): void; + } +} + +export declare namespace metrics { + export interface ClientMetrics { + onAuthenticationError(e: Error | errors.AuthenticationError): void; + + onClientTimeoutError(e: errors.OperationTimedOutError): void; + + onClientTimeoutRetry(e: Error): void; + + onConnectionError(e: Error): void; + + onIgnoreError(e: Error): void; + + onOtherError(e: Error): void; + + onOtherErrorRetry(e: Error): void; + + onReadTimeoutError(e: errors.ResponseError): void; + + onReadTimeoutRetry(e: Error): void; + + onResponse(latency: number[]): void; + + onSpeculativeExecution(): void; + + onSuccessfulResponse(latency: number[]): void; + + onUnavailableError(e: errors.ResponseError): void; + + onUnavailableRetry(e: Error): void; + + onWriteTimeoutError(e: errors.ResponseError): void; + + onWriteTimeoutRetry(e: Error): void; + } + + export class DefaultMetrics implements ClientMetrics { + constructor(); + + onAuthenticationError(e: Error | errors.AuthenticationError): void; + + onClientTimeoutError(e: errors.OperationTimedOutError): void; + + onClientTimeoutRetry(e: Error): void; + + onConnectionError(e: Error): void; + + onIgnoreError(e: Error): void; + + onOtherError(e: Error): void; + + onOtherErrorRetry(e: Error): void; + + onReadTimeoutError(e: errors.ResponseError): void; + + onReadTimeoutRetry(e: Error): void; + + onResponse(latency: number[]): void; + + onSpeculativeExecution(): void; + + onSuccessfulResponse(latency: number[]): void; + + onUnavailableError(e: errors.ResponseError): void; + + onUnavailableRetry(e: Error): void; + + onWriteTimeoutError(e: errors.ResponseError): void; + + onWriteTimeoutRetry(e: Error): void; + } +} + +export declare namespace policies { + export function defaultAddressTranslator(): addressResolution.AddressTranslator; + + export function defaultLoadBalancingPolicy(localDc?: string): loadBalancing.LoadBalancingPolicy; + + export function defaultReconnectionPolicy(): reconnection.ReconnectionPolicy; + + export function defaultRetryPolicy(): retry.RetryPolicy; + + export function defaultSpeculativeExecutionPolicy(): speculativeExecution.SpeculativeExecutionPolicy; + + export function defaultTimestampGenerator(): timestampGeneration.TimestampGenerator; + + export namespace addressResolution { + export interface AddressTranslator { + translate(address: string, port: number, callback: Function): void; + } + + export class EC2MultiRegionTranslator implements AddressTranslator { + translate(address: string, port: number, callback: Function): void; + } + } + + export namespace loadBalancing { + export abstract class LoadBalancingPolicy { + init(client: Client, hosts: HostMap, callback: EmptyCallback): void; + + getDistance(host: Host): types.distance; + + newQueryPlan( + keyspace: string, + executionOptions: ExecutionOptions, + callback: (error: Error, iterator: Iterator) => void): void; + + getOptions(): Map; + } + + export class DCAwareRoundRobinPolicy extends LoadBalancingPolicy { + constructor(localDc: string); + } + + export class TokenAwarePolicy extends LoadBalancingPolicy { + constructor(childPolicy: LoadBalancingPolicy); + } + + export class AllowListPolicy extends LoadBalancingPolicy { + constructor(childPolicy: LoadBalancingPolicy, allowList: string[]); + } + + export class WhiteListPolicy extends AllowListPolicy { + } + + export class RoundRobinPolicy extends LoadBalancingPolicy { + constructor(); + } + + export class DefaultLoadBalancingPolicy extends LoadBalancingPolicy { + constructor(options?: { localDc?: string, filter?: (host: Host) => boolean }); + } + } + + export namespace reconnection { + export class ConstantReconnectionPolicy implements ReconnectionPolicy { + constructor(delay: number); + + getOptions(): Map; + + newSchedule(): Iterator; + + } + + export class ExponentialReconnectionPolicy implements ReconnectionPolicy { + constructor(baseDelay: number, maxDelay: number, startWithNoDelay?: boolean); + + getOptions(): Map; + + newSchedule(): Iterator; + } + + export interface ReconnectionPolicy { + getOptions(): Map; + + newSchedule(): Iterator; + } + } + + export namespace retry { + export class DecisionInfo { + decision: number; + consistency: types.consistencies; + } + + export class OperationInfo { + query: string; + executionOptions: ExecutionOptions; + nbRetry: number; + } + + export class IdempotenceAwareRetryPolicy extends RetryPolicy { + constructor(childPolicy: RetryPolicy); + } + + export class FallthroughRetryPolicy extends RetryPolicy { + constructor(); + } + + export class RetryPolicy { + onReadTimeout( + info: OperationInfo, + consistency: types.consistencies, + received: number, + blockFor: number, + isDataPresent: boolean): DecisionInfo; + + onRequestError(info: OperationInfo, consistency: types.consistencies, err: Error): DecisionInfo; + + onUnavailable( + info: OperationInfo, consistency: types.consistencies, required: number, alive: boolean): DecisionInfo; + + onWriteTimeout( + info: OperationInfo, + consistency: types.consistencies, + received: number, + blockFor: number, + writeType: string): DecisionInfo; + + rethrowResult(): DecisionInfo; + + retryResult(consistency: types.consistencies, useCurrentHost?: boolean): DecisionInfo; + } + + export namespace RetryDecision { + export enum retryDecision { + ignore, + rethrow, + retry + } + } + } + + export namespace speculativeExecution { + export class ConstantSpeculativeExecutionPolicy implements SpeculativeExecutionPolicy { + constructor(delay: number, maxSpeculativeExecutions: number); + + getOptions(): Map; + + init(client: Client): void; + + newPlan(keyspace: string, queryInfo: string | Array): { nextExecution: Function }; + + shutdown(): void; + } + + export class NoSpeculativeExecutionPolicy implements SpeculativeExecutionPolicy { + constructor(); + + getOptions(): Map; + + init(client: Client): void; + + newPlan(keyspace: string, queryInfo: string | Array): { nextExecution: Function }; + + shutdown(): void; + } + + export interface SpeculativeExecutionPolicy { + getOptions(): Map; + + init(client: Client): void; + + newPlan(keyspace: string, queryInfo: string|Array): { nextExecution: Function }; + + shutdown(): void; + } + } + + export namespace timestampGeneration { + export class MonotonicTimestampGenerator implements TimestampGenerator { + constructor(warningThreshold: number, minLogInterval: number); + + getDate(): number; + + next(client: Client): types.Long | number; + } + + export interface TimestampGenerator { + next(client: Client): types.Long|number; + } + } +} + +export declare interface QueryOptions { + autoPage?: boolean; + captureStackTrace?: boolean; + consistency?: number; + counter?: boolean; + customPayload?: any; + executionProfile?: string | ExecutionProfile; + fetchSize?: number; + hints?: string[] | string[][]; + host?: Host; + isIdempotent?: boolean; + keyspace?: string; + logged?: boolean; + pageState?: Buffer | string; + prepare?: boolean; + readTimeout?: number; + retry?: policies.retry.RetryPolicy; + routingIndexes?: number[]; + routingKey?: Buffer | Buffer[]; + routingNames?: string[]; + serialConsistency?: number; + timestamp?: number | Long; + traceQuery?: boolean; +} + +export declare namespace token { + export interface Token { + compare(other: Token): number; + + equals(other: Token): boolean; + + getType(): { code: types.dataTypes, info: any }; + + getValue(): any; + } + + export interface TokenRange { + start: Token; + end: Token; + + compare(other: TokenRange): number; + + contains(token: Token): boolean; + + equals(other: TokenRange): boolean; + + isEmpty(): boolean; + + isWrappedAround(): boolean; + + splitEvenly(numberOfSplits: number): TokenRange[]; + + unwrap(): TokenRange[]; + } +} + +export declare namespace tracker { + export interface RequestTracker { + onError( + host: Host, + query: string | Array<{ query: string, params?: any }>, + parameters: any[] | { [key: string]: any } | null, + executionOptions: ExecutionOptions, + requestLength: number, + err: Error, + latency: number[]): void; + + onSuccess( + host: Host, + query: string | Array<{ query: string, params?: any }>, + parameters: any[] | { [key: string]: any } | null, + executionOptions: ExecutionOptions, + requestLength: number, + responseLength: number, + latency: number[]): void; + + shutdown(): void; + } + + export class RequestLogger implements RequestTracker { + constructor(options: { + slowThreshold?: number; + logNormalRequests?: boolean; + logErroredRequests?: boolean; + messageMaxQueryLength?: number; + messageMaxParameterValueLength?: number; + messageMaxErrorStackTraceLength?: number; + }); + + onError(host: Host, query: string | Array<{ query: string; params?: any }>, parameters: any[] | { [p: string]: any } | null, executionOptions: ExecutionOptions, requestLength: number, err: Error, latency: number[]): void; + + onSuccess(host: Host, query: string | Array<{ query: string; params?: any }>, parameters: any[] | { [p: string]: any } | null, executionOptions: ExecutionOptions, requestLength: number, responseLength: number, latency: number[]): void; + + shutdown(): void; + } +} + +export declare namespace types { + export class Long extends _Long { + + } + + export enum consistencies { + any = 0x00, + one = 0x01, + two = 0x02, + three = 0x03, + quorum = 0x04, + all = 0x05, + localQuorum = 0x06, + eachQuorum = 0x07, + serial = 0x08, + localSerial = 0x09, + localOne = 0x0a + } + + export enum dataTypes { + custom = 0x0000, + ascii = 0x0001, + bigint = 0x0002, + blob = 0x0003, + boolean = 0x0004, + counter = 0x0005, + decimal = 0x0006, + double = 0x0007, + float = 0x0008, + int = 0x0009, + text = 0x000a, + timestamp = 0x000b, + uuid = 0x000c, + varchar = 0x000d, + varint = 0x000e, + timeuuid = 0x000f, + inet = 0x0010, + date = 0x0011, + time = 0x0012, + smallint = 0x0013, + tinyint = 0x0014, + duration = 0x0015, + list = 0x0020, + map = 0x0021, + set = 0x0022, + udt = 0x0030, + tuple = 0x0031, + } + + export enum distance { + local = 0, + remote, + ignored + } + + export enum responseErrorCodes { + serverError = 0x0000, + protocolError = 0x000A, + badCredentials = 0x0100, + unavailableException = 0x1000, + overloaded = 0x1001, + isBootstrapping = 0x1002, + truncateError = 0x1003, + writeTimeout = 0x1100, + readTimeout = 0x1200, + readFailure = 0x1300, + functionFailure = 0x1400, + writeFailure = 0x1500, + syntaxError = 0x2000, + unauthorized = 0x2100, + invalid = 0x2200, + configError = 0x2300, + alreadyExists = 0x2400, + unprepared = 0x2500, + clientWriteFailure = 0x8000 + } + + export enum protocolVersion { + v1 = 0x01, + v2 = 0x02, + v3 = 0x03, + v4 = 0x04, + v5 = 0x05, + v6 = 0x06, + dseV1 = 0x41, + dseV2 = 0x42, + maxSupported = dseV2, + minSupported = v1 + } + + export namespace protocolVersion { + export function isSupported(version: protocolVersion): boolean; + } + + const unset: object; + + export class BigDecimal { + constructor(unscaledValue: number, scale: number); + + static fromBuffer(buf: Buffer): BigDecimal; + + static fromString(value: string): BigDecimal; + + static toBuffer(value: BigDecimal): Buffer; + + static fromNumber(value: number): BigDecimal; + + add(other: BigDecimal): BigDecimal; + + compare(other: BigDecimal): number; + + equals(other: BigDecimal): boolean; + + greaterThan(other: BigDecimal): boolean; + + isNegative(): boolean; + + isZero(): boolean; + + notEquals(other: BigDecimal): boolean; + + subtract(other: BigDecimal): BigDecimal; + + toNumber(): number; + + toString(): string; + + toJSON(): string; + } + + export class Duration { + constructor(month: number, days: number, nanoseconds: number | Long); + + static fromBuffer(buffer: Buffer): Duration; + + static fromString(input: string): Duration; + + equals(other: Duration): boolean; + + toBuffer(): Buffer; + + toString(): string; + } + + export class InetAddress { + length: number; + + version: number; + + constructor(buffer: Buffer); + + static fromString(value: string): InetAddress; + + equals(other: InetAddress): boolean; + + getBuffer(): Buffer; + + toString(): string; + + toJSON(): string; + } + + export class Integer { + static ONE: Integer; + static ZERO: Integer; + + constructor(bits: Array, sign: number); + + static fromBits(bits: Array): Integer; + + static fromBuffer(bits: Buffer): Integer; + + static fromInt(value: number): Integer; + + static fromNumber(value: number): Integer; + + static fromString(str: string, opt_radix?: number): Integer; + + static toBuffer(value: Integer): Buffer; + + abs(): Integer; + + add(other: Integer): Integer; + + compare(other: Integer): number; + + divide(other: Integer): Integer; + + equals(other: Integer): boolean; + + getBits(index: number): number; + + getBitsUnsigned(index: number): number; + + getSign(): number; + + greaterThan(other: Integer): boolean; + + greaterThanOrEqual(other: Integer): boolean; + + isNegative(): boolean; + + isOdd(): boolean; + + isZero(): boolean; + + lessThan(other: Integer): boolean; + + lessThanOrEqual(other: Integer): boolean; + + modulo(other: Integer): Integer; + + multiply(other: Integer): Integer; + + negate(): Integer; + + not(): Integer; + + notEquals(other: Integer): boolean; + + or(other: Integer): Integer; + + shiftLeft(numBits: number): Integer; + + shiftRight(numBits: number): Integer; + + shorten(numBits: number): Integer; + + subtract(other: Integer): Integer; + + toInt(): number; + + toJSON(): string; + + toNumber(): number; + + toString(opt_radix?: number): string; + + xor(other: Integer): Integer; + } + + export class LocalDate { + year: number; + month: number; + day: number; + + constructor(year: number, month: number, day: number); + + static fromDate(date: Date): LocalDate; + + static fromString(value: string): LocalDate; + + static fromBuffer(buffer: Buffer): LocalDate; + + static now(): LocalDate; + + static utcNow(): LocalDate; + + equals(other: LocalDate): boolean; + + inspect(): string; + + toBuffer(): Buffer; + + toJSON(): string; + + toString(): string; + } + + export class LocalTime { + hour: number; + minute: number; + nanosecond: number; + second: number; + + constructor(totalNanoseconds: Long); + + static fromBuffer(value: Buffer): LocalTime; + + static fromDate(date: Date, nanoseconds: number): LocalTime; + + static fromMilliseconds(milliseconds: number, nanoseconds?: number): LocalTime; + + static fromString(value: string): LocalTime; + + static now(nanoseconds?: number): LocalTime; + + compare(other: LocalTime): boolean; + + equals(other: LocalTime): boolean; + + getTotalNanoseconds(): Long; + + inspect(): string; + + toBuffer(): Buffer; + + toJSON(): string; + + toString(): string; + } + + export interface ResultSet extends Iterable, AsyncIterable { + info: { + queriedHost: string, + triedHosts: { [key: string]: any; }, + speculativeExecutions: number, + achievedConsistency: consistencies, + traceId: Uuid, + warnings: string[], + customPayload: any + }; + + columns: Array<{ name: string, type: { code: dataTypes, info: any } }>; + nextPage: (() => void) | null; + pageState: string; + rowLength: number; + rows: Row[]; + + first(): Row; + + wasApplied(): boolean; + } + + export interface ResultStream extends stream.Readable { + buffer: Buffer; + paused: boolean; + + add(chunk: Buffer): void; + } + + export interface Row { + get(columnName: string | number): any; + + keys(): string[]; + + forEach(callback: (row: Row) => void): void; + + values(): any[]; + + [key: string]: any; + } + + export class TimeUuid extends Uuid { + static now(): TimeUuid; + + static now(nodeId: string | Buffer, clockId?: string | Buffer): TimeUuid; + + static now(nodeId: string | Buffer, clockId: string | Buffer, callback: ValueCallback): void; + + static now(callback: ValueCallback): void; + + static fromDate(date: Date, ticks?: number, nodeId?: string | Buffer, clockId?: string | Buffer): TimeUuid; + + static fromDate( + date: Date, + ticks: number, + nodeId: string | Buffer, + clockId: string | Buffer, + callback: ValueCallback): void; + + static fromString(value: string): TimeUuid; + + static max(date: Date, ticks: number): TimeUuid; + + static min(date: Date, ticks: number): TimeUuid; + + getDatePrecision(): { date: Date, ticks: number }; + + getDate(): Date; + } + + export class Tuple { + elements: any[]; + length: number; + + constructor(...args: any[]); + + static fromArray(elements: any[]): Tuple; + + get(index: number): any; + + toString(): string; + + toJSON(): string; + + values(): any[]; + } + + export class Uuid { + constructor(buffer: Buffer); + + static fromString(value: string): Uuid; + + static random(callback: ValueCallback): void; + + static random(): Uuid; + + equals(other: Uuid): boolean; + + getBuffer(): Buffer; + + toString(): string; + + toJSON(): string; + } +} + +export declare type ValueCallback = (err: Error, val: T) => void; + +export declare const version: number; + +export { } diff --git a/etc/cassandra-driver.api.md b/etc/cassandra-driver.api.md new file mode 100644 index 00000000..cc947e4d --- /dev/null +++ b/etc/cassandra-driver.api.md @@ -0,0 +1,2221 @@ +## API Report File for "cassandra-driver" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as events from 'events'; +import _Long = require('long'); +import { Readable } from 'stream'; +import * as stream from 'stream'; +import * as tls from 'tls'; +import { URL as URL_2 } from 'url'; + +// @public (undocumented) +export type ArrayOrObject = any[]|{[key: string]: any}; + +// @public (undocumented) +export namespace auth { + // (undocumented) + export interface Authenticator { + // (undocumented) + evaluateChallenge(challenge: Buffer, callback: Function): void; + + // (undocumented) + initialResponse(callback: Function): void; + + // (undocumented) + onAuthenticationSuccess(token?: Buffer): void; + } + + // (undocumented) + export interface AuthProvider { + // (undocumented) + newAuthenticator(endpoint: string, name: string): Authenticator; + } + + // (undocumented) + export class DseGssapiAuthProvider implements AuthProvider { + constructor(gssOptions?: { authorizationId?: string, service?: string, hostNameResolver?: Function }); + + // (undocumented) + newAuthenticator(endpoint: string, name: string): Authenticator; + } + + // (undocumented) + export class DsePlainTextAuthProvider implements AuthProvider { + constructor(username: string, password: string, authorizationId?: string); + + // (undocumented) + newAuthenticator(endpoint: string, name: string): Authenticator; + } + + // (undocumented) + export class PlainTextAuthProvider implements AuthProvider { + constructor(username: string, password: string); + + // (undocumented) + newAuthenticator(endpoint: string, name: string): Authenticator; + } +} + +// @public (undocumented) +export class Client extends events.EventEmitter { + constructor(options: DseClientOptions); + // (undocumented) + batch( + queries: Array, + options?: QueryOptions): Promise; + // (undocumented) + batch( + queries: Array, + options: QueryOptions, + callback: ValueCallback): void; + // (undocumented) + batch( + queries: Array, + callback: ValueCallback): void; + // (undocumented) + connect(): Promise; + // (undocumented) + connect(callback: EmptyCallback): void; + // (undocumented) + eachRow(query: string, + params: ArrayOrObject, + options: QueryOptions, + rowCallback: (n: number, row: types.Row) => void, + callback?: ValueCallback): void; + // (undocumented) + eachRow(query: string, + params: ArrayOrObject, + rowCallback: (n: number, row: types.Row) => void, + callback?: ValueCallback): void; + // (undocumented) + eachRow(query: string, + rowCallback: (n: number, row: types.Row) => void): void; + // (undocumented) + execute(query: string, params?: ArrayOrObject, options?: QueryOptions): Promise; + // (undocumented) + execute(query: string, params: ArrayOrObject, options: QueryOptions, callback: ValueCallback): void; + // (undocumented) + execute(query: string, params: ArrayOrObject, callback: ValueCallback): void; + // (undocumented) + execute(query: string, callback: ValueCallback): void; + // Warning: (ae-forgotten-export) The symbol "graph" needs to be exported by the entry point index.d.ts + // + // (undocumented) + executeGraph( + traversal: string, + parameters: { [name: string]: any } | undefined, + options: GraphQueryOptions, + callback: ValueCallback): void; + // (undocumented) + executeGraph( + traversal: string, + parameters: { [name: string]: any } | undefined, + callback: ValueCallback): void; + // (undocumented) + executeGraph(traversal: string, callback: ValueCallback): void; + // (undocumented) + executeGraph( + traversal: string, + parameters?: { [name: string]: any }, + options?: GraphQueryOptions): Promise; + // (undocumented) + getReplicas(keyspace: string, token: Buffer): Host[]; + // (undocumented) + getState(): metadata.ClientState; + // (undocumented) + hosts: HostMap; + // (undocumented) + keyspace: string; + // (undocumented) + metadata: metadata.Metadata; + // (undocumented) + metrics: metrics.ClientMetrics; + // (undocumented) + shutdown(): Promise; + // (undocumented) + shutdown(callback: EmptyCallback): void; + // (undocumented) + stream(query: string, params?: ArrayOrObject, options?: QueryOptions, callback?: EmptyCallback): events.EventEmitter; +} + +// @public (undocumented) +export interface ClientOptions { + // (undocumented) + authProvider?: auth.AuthProvider; + // (undocumented) + cloud?: { + secureConnectBundle: string | URL_2; + }; + // (undocumented) + contactPoints?: string[]; + // (undocumented) + credentials?: { + username: string; + password: string; + } + // (undocumented) + encoding?: { + map?: Function; + set?: Function; + copyBuffer?: boolean; + useUndefinedAsUnset?: boolean; + useBigIntAsLong?: boolean; + useBigIntAsVarint?: boolean; + }; + // (undocumented) + isMetadataSyncEnabled?: boolean; + // (undocumented) + keyspace?: string; + // (undocumented) + localDataCenter?: string; + // (undocumented) + maxPrepared?: number; + // (undocumented) + metrics?: metrics.ClientMetrics; + // (undocumented) + policies?: { + addressResolution?: policies.addressResolution.AddressTranslator; + loadBalancing?: policies.loadBalancing.LoadBalancingPolicy; + reconnection?: policies.reconnection.ReconnectionPolicy; + retry?: policies.retry.RetryPolicy; + speculativeExecution?: policies.speculativeExecution.SpeculativeExecutionPolicy; + timestampGeneration?: policies.timestampGeneration.TimestampGenerator; + }; + // (undocumented) + pooling?: { + coreConnectionsPerHost?: { [key: number]: number; }; + heartBeatInterval?: number; + maxRequestsPerConnection?: number; + warmup?: boolean; + }; + // (undocumented) + prepareOnAllHosts?: boolean; + // (undocumented) + profiles?: ExecutionProfile[]; + // (undocumented) + promiseFactory?: (handler: (callback: (err: Error, result?: any) => void) => void) => Promise; + // (undocumented) + protocolOptions?: { + maxSchemaAgreementWaitSeconds?: number; + maxVersion?: number; + noCompact?: boolean; + port?: number; + }; + // (undocumented) + queryOptions?: QueryOptions; + // (undocumented) + refreshSchemaDelay?: number; + // (undocumented) + rePrepareOnUp?: boolean; + // (undocumented) + requestTracker?: tracker.RequestTracker; + // (undocumented) + socketOptions?: { + coalescingThreshold?: number; + connectTimeout?: number; + defunctReadTimeoutThreshold?: number; + keepAlive?: boolean; + keepAliveDelay?: number; + readTimeout?: number; + tcpNoDelay?: boolean; + }; + // (undocumented) + sslOptions?: tls.ConnectionOptions; +} + +// @public (undocumented) +export namespace concurrent { + // (undocumented) + export function executeConcurrent( + client: Client, + query: string, + parameters: any[][]|Readable, + options?: Options): Promise; + + // (undocumented) + export function executeConcurrent( + client: Client, + queries: Array<{query: string, params: any[]}>, + options?: Options): Promise; + + // (undocumented) + export type Options = { + collectResults?: boolean; + concurrencyLevel?: number; + executionProfile?: string; + maxErrors?: number; + raiseOnFirstError?: boolean; + } + + // (undocumented) + export interface ResultSetGroup { + // (undocumented) + errors: Error[]; + // (undocumented) + resultItems: any[]; + // (undocumented) + totalExecuted: number; + } +} + +// @public (undocumented) +export namespace datastax { + import graph = graphModule.graph; + + import search = searchModule.search; +} + +// @public (undocumented) +export function defaultOptions(): ClientOptions; + +// @public (undocumented) +export interface DseClientOptions extends ClientOptions { + // (undocumented) + applicationName?: string; + // (undocumented) + applicationVersion?: string; + // (undocumented) + graphOptions?: GraphOptions; + // (undocumented) + id?: Uuid; + // (undocumented) + monitorReporting?: { enabled?: boolean }; +} + +// @public (undocumented) +export type EmptyCallback = (err: Error) => void; + +// @public (undocumented) +export namespace errors { + // (undocumented) + export class ArgumentError extends DriverError { + constructor(message: string); + } + + // (undocumented) + export class AuthenticationError extends DriverError { + constructor(message: string); + } + + // (undocumented) + export class BusyConnectionError extends DriverError { + constructor(address: string, maxRequestsPerConnection: number, connectionLength: number); + } + + // (undocumented) + export abstract class DriverError extends Error { + constructor(message: string, constructor?: any); + + // (undocumented) + info: string; + } + + // (undocumented) + export class DriverInternalError extends DriverError { + constructor(message: string); + } + + // (undocumented) + export class NoHostAvailableError extends DriverError { + constructor(innerErrors: any, message?: string); + + // (undocumented) + innerErrors: any; + } + + // (undocumented) + export class NotSupportedError extends DriverError { + constructor(message: string); + } + + // (undocumented) + export class OperationTimedOutError extends DriverError { + constructor(message: string, host?: string); + + // (undocumented) + host?: string; + } + + // (undocumented) + export class ResponseError extends DriverError { + constructor(code: number, message: string); + + // (undocumented) + code: number; + } +} + +// @public (undocumented) +export interface ExecutionOptions { + // (undocumented) + getCaptureStackTrace(): boolean; + + // (undocumented) + getConsistency(): types.consistencies; + + // (undocumented) + getCustomPayload(): { [key: string]: any }; + + // (undocumented) + getFetchSize(): number; + + // (undocumented) + getFixedHost(): Host; + + // (undocumented) + getHints(): string[] | string[][]; + + // (undocumented) + getKeyspace(): string; + + // (undocumented) + getLoadBalancingPolicy(): policies.loadBalancing.LoadBalancingPolicy; + + // (undocumented) + getPageState(): Buffer; + + // (undocumented) + getRawQueryOptions(): QueryOptions; + + // (undocumented) + getReadTimeout(): number; + + // (undocumented) + getRetryPolicy(): policies.retry.RetryPolicy; + + // (undocumented) + getRoutingKey(): Buffer | Buffer[]; + + // (undocumented) + getSerialConsistency(): types.consistencies; + + // (undocumented) + getTimestamp(): number | Long | undefined | null; + + // (undocumented) + isAutoPage(): boolean; + + // (undocumented) + isBatchCounter(): boolean; + + // (undocumented) + isBatchLogged(): boolean; + + // (undocumented) + isIdempotent(): boolean; + + // (undocumented) + isPrepared(): boolean; + + // (undocumented) + isQueryTracing(): boolean; + + // (undocumented) + setHints(hints: string[]): void; +} + +// @public (undocumented) +export class ExecutionProfile { + constructor(name: string, options: { + consistency?: types.consistencies; + loadBalancing?: policies.loadBalancing.LoadBalancingPolicy; + readTimeout?: number; + retry?: policies.retry.RetryPolicy; + serialConsistency?: types.consistencies; + graphOptions?: { + name?: string; + language?: string; + source?: string; + readConsistency?: types.consistencies; + writeConsistency?: types.consistencies; + }; + }); + // (undocumented) + consistency?: types.consistencies; + // (undocumented) + graphOptions?: { + name?: string; + language?: string; + source?: string; + readConsistency?: types.consistencies; + writeConsistency?: types.consistencies; + }; + // (undocumented) + loadBalancing?: policies.loadBalancing.LoadBalancingPolicy; + // (undocumented) + name: string; + // (undocumented) + readTimeout?: number; + // (undocumented) + retry?: policies.retry.RetryPolicy; + // (undocumented) + serialConsistency?: types.consistencies; +} + +// @public (undocumented) +export namespace geometry { + // (undocumented) + export class LineString { + constructor(...args: Point[]); + + // (undocumented) + equals(other: LineString): boolean; + + // (undocumented) + static fromBuffer(buffer: Buffer): LineString; + + // (undocumented) + static fromString(textValue: string): LineString; + + // (undocumented) + toBuffer(): Buffer; + + // (undocumented) + toJSON(): string; + + // (undocumented) + toString(): string; + + } + + // (undocumented) + export class Point { + constructor(x: number, y: number); + + // (undocumented) + equals(other: Point): boolean; + + // (undocumented) + static fromBuffer(buffer: Buffer): Point; + + // (undocumented) + static fromString(textValue: string): Point; + + // (undocumented) + toBuffer(): Buffer; + + // (undocumented) + toJSON(): string; + + // (undocumented) + toString(): string; + + } + + // (undocumented) + export class Polygon { + constructor(...args: Point[]); + + // (undocumented) + equals(other: Polygon): boolean; + + // (undocumented) + static fromBuffer(buffer: Buffer): Polygon; + + // (undocumented) + static fromString(textValue: string): Polygon; + + // (undocumented) + toBuffer(): Buffer; + + // (undocumented) + toJSON(): string; + + // (undocumented) + toString(): string; + } +} + +// @public (undocumented) +export type GraphOptions = { + language?: string; + name?: string; + readConsistency?: types.consistencies; + readTimeout?: number; + source?: string; + writeConsistency?: types.consistencies; +}; + +// @public (undocumented) +export interface GraphQueryOptions extends QueryOptions { + // (undocumented) + graphLanguage?: string; + // (undocumented) + graphName?: string; + // (undocumented) + graphReadConsistency?: types.consistencies; + // (undocumented) + graphSource?: string; + // (undocumented) + graphWriteConsistency?: types.consistencies; +} + +// @public (undocumented) +export interface Host extends events.EventEmitter { + // (undocumented) + address: string; + // (undocumented) + canBeConsideredAsUp(): boolean; + // (undocumented) + cassandraVersion: string; + // (undocumented) + datacenter: string; + // (undocumented) + getCassandraVersion(): number[]; + // (undocumented) + hostId: types.Uuid; + // (undocumented) + isUp(): boolean; + // (undocumented) + rack: string; + // (undocumented) + tokens: string[]; +} + +// @public (undocumented) +export interface HostMap extends events.EventEmitter { + // (undocumented) + forEach(callback: (value: Host, key: string) => void): void; + + // (undocumented) + get(key: string): Host; + + // (undocumented) + keys(): string[]; + + // (undocumented) + length: number; + + // (undocumented) + values(): Host[]; +} + +// @public (undocumented) +export namespace mapping { + // (undocumented) + export class DefaultTableMappings implements TableMappings { + // (undocumented) + getColumnName(propName: string): string; + + // (undocumented) + getPropertyName(columnName: string): string; + + // (undocumented) + newObjectInstance(): any; + } + + // (undocumented) + export type FindDocInfo = { + fields?: string[]; + orderBy?: { [key: string]: string }; + limit?: number; + } + + // (undocumented) + export type InsertDocInfo = { + fields?: string[]; + ttl?: number; + ifNotExists?: boolean; + } + + // (undocumented) + export class Mapper { + constructor(client: Client, options?: MappingOptions); + + // (undocumented) + batch(items: ModelBatchItem[], executionOptions?: string | MappingExecutionOptions): Promise; + + // (undocumented) + forModel(name: string): ModelMapper; + } + + // (undocumented) + export type MappingExecutionOptions = { + executionProfile?: string; + isIdempotent?: boolean; + logged?: boolean; + timestamp?: number | Long; + fetchSize?: number; + pageState?: number; + } + + // (undocumented) + export type MappingOptions = { + models: { [key: string]: ModelOptions }; + } + + // (undocumented) + export interface ModelBatchItem { + + } + + // (undocumented) + export interface ModelBatchMapper { + // (undocumented) + insert(doc: any, docInfo?: InsertDocInfo): ModelBatchItem; + + // (undocumented) + remove(doc: any, docInfo?: RemoveDocInfo): ModelBatchItem; + + // (undocumented) + update(doc: any, docInfo?: UpdateDocInfo): ModelBatchItem; + } + + // (undocumented) + export type ModelColumnOptions = { + name: string; + toModel?: (columnValue: any) => any; + fromModel?: (modelValue: any) => any; + }; + + // (undocumented) + export interface ModelMapper { + // (undocumented) + batching: ModelBatchMapper; + // (undocumented) + find(doc: { [key: string]: any }, docInfo?: FindDocInfo, executionOptions?: string | MappingExecutionOptions): Promise>; + // (undocumented) + findAll(docInfo?: FindDocInfo, executionOptions?: string | MappingExecutionOptions): Promise>; + // (undocumented) + get(doc: { [key: string]: any }, docInfo?: { fields?: string[] }, executionOptions?: string | MappingExecutionOptions): Promise; + // (undocumented) + insert(doc: { [key: string]: any }, docInfo?: InsertDocInfo, executionOptions?: string | MappingExecutionOptions): Promise>; + // (undocumented) + mapWithQuery( + query: string, + paramsHandler: (doc: any) => any[], + executionOptions?: string | MappingExecutionOptions + ): (doc: any, executionOptions?: string | MappingExecutionOptions) => Promise>; + // (undocumented) + name: string; + // (undocumented) + remove(doc: { [key: string]: any }, docInfo?: RemoveDocInfo, executionOptions?: string | MappingExecutionOptions): Promise>; + // (undocumented) + update(doc: { [key: string]: any }, docInfo?: UpdateDocInfo, executionOptions?: string | MappingExecutionOptions): Promise>; + } + + // (undocumented) + export type ModelOptions = { + tables?: string[] | ModelTables[]; + mappings?: TableMappings; + columns?: { [key: string]: string|ModelColumnOptions }; + keyspace?: string; + } + + // (undocumented) + export interface ModelTables { + // (undocumented) + isView: boolean; + // (undocumented) + name: string; + } + + // (undocumented) + export namespace q { + // (undocumented) + export function and(condition1: any, condition2: any): QueryOperator; + + // (undocumented) + export function append(value: any): QueryOperator; + + // (undocumented) + export function decr(value: any): QueryOperator; + + // (undocumented) + export function gt(value: any): QueryOperator; + + // (undocumented) + export function gte(value: any): QueryOperator; + + // (undocumented) + export function in_(arr: any): QueryOperator; + + // (undocumented) + export function incr(value: any): QueryOperator; + + // (undocumented) + export function lt(value: any): QueryOperator; + + // (undocumented) + export function lte(value: any): QueryOperator; + + // (undocumented) + export function notEq(value: any): QueryOperator; + + // (undocumented) + export function prepend(value: any): QueryOperator; + + // (undocumented) + export interface QueryOperator { + + } + + // (undocumented) + export function remove(value: any): QueryOperator; + } + + // (undocumented) + export type RemoveDocInfo = { + fields?: string[]; + ttl?: number; + ifExists?: boolean; + when?: { [key: string]: any }; + deleteOnlyColumns?: boolean; + } + + // (undocumented) + export interface Result extends Iterator { + // (undocumented) + first(): T | null; + + // (undocumented) + forEach(callback: (currentValue: T, index: number) => void, thisArg?: any): void; + + // (undocumented) + toArray(): T[]; + + // (undocumented) + wasApplied(): boolean; + } + + // (undocumented) + export interface TableMappings { + // (undocumented) + getColumnName(propName: string): string; + + // (undocumented) + getPropertyName(columnName: string): string; + + // (undocumented) + newObjectInstance(): any; + } + + // (undocumented) + export class UnderscoreCqlToCamelCaseMappings implements TableMappings { + // (undocumented) + getColumnName(propName: string): string; + + // (undocumented) + getPropertyName(columnName: string): string; + + // (undocumented) + newObjectInstance(): any; + } + + // (undocumented) + export type UpdateDocInfo = { + fields?: string[]; + ttl?: number; + ifExists?: boolean; + when?: { [key: string]: any }; + orderBy?: { [key: string]: string }; + limit?: number; + deleteOnlyColumns?: boolean; + } +} + +// @public (undocumented) +export namespace metadata { + + // (undocumented) + export interface Aggregate { + // (undocumented) + argumentTypes: Array<{ code: dataTypes, info: any }>; + // (undocumented) + finalFunction: string; + // (undocumented) + initCondition: string; + // (undocumented) + keyspaceName: string; + // (undocumented) + returnType: string; + // (undocumented) + signature: string[]; + // (undocumented) + stateFunction: string; + // (undocumented) + stateType: string; + } + + // (undocumented) + export interface ClientState { + // (undocumented) + getConnectedHosts(): Host[]; + + // (undocumented) + getInFlightQueries(host: Host): number; + + // (undocumented) + getOpenConnections(host: Host): number; + + // (undocumented) + toString(): string; + } + + // (undocumented) + export interface ColumnInfo { + // (undocumented) + name: string; + // (undocumented) + type: DataTypeInfo; + } + + // (undocumented) + export interface DataCollection { + // (undocumented) + bloomFilterFalsePositiveChance: number; + // (undocumented) + caching: string; + // (undocumented) + clusteringKeys: ColumnInfo[]; + // (undocumented) + clusteringOrder: string[]; + // (undocumented) + columns: ColumnInfo[]; + // (undocumented) + columnsByName: { [key: string]: ColumnInfo }; + // (undocumented) + comment: string; + // (undocumented) + compactionClass: string; + // (undocumented) + compactionOptions: { [option: string]: any; }; + // (undocumented) + compression: { + class?: string; + [option: string]: any; + }; + // (undocumented) + crcCheckChange?: number; + // (undocumented) + defaultTtl: number; + // (undocumented) + extensions: { [option: string]: any; }; + // (undocumented) + gcGraceSeconds: number; + // (undocumented) + localReadRepairChance: number; + // (undocumented) + maxIndexInterval?: number; + // (undocumented) + minIndexInterval?: number; + // (undocumented) + name: string; + // (undocumented) + partitionKeys: ColumnInfo[]; + // (undocumented) + populateCacheOnFlush: boolean; + // (undocumented) + readRepairChance: number; + // (undocumented) + speculativeRetry: string; + } + + // (undocumented) + export interface DataTypeInfo { + // (undocumented) + code: dataTypes; + // (undocumented) + info: string | DataTypeInfo | DataTypeInfo[]; + // (undocumented) + options: { + frozen: boolean; + reversed: boolean; + }; + } + + // (undocumented) + export interface Index { + // (undocumented) + isCompositesKind(): boolean; + // (undocumented) + isCustomKind(): boolean; + // (undocumented) + isKeysKind(): boolean; + // (undocumented) + kind: IndexKind; + // (undocumented) + name: string; + // (undocumented) + options: object; + // (undocumented) + target: string; + } + + // (undocumented) + export enum IndexKind { + // (undocumented) + composites, + // (undocumented) + custom = 0, + // (undocumented) + keys + } + + // (undocumented) + export interface MaterializedView extends DataCollection { + // (undocumented) + includeAllColumns: boolean; + // (undocumented) + tableName: string; + // (undocumented) + whereClause: string; + } + + // (undocumented) + export interface Metadata { + // (undocumented) + clearPrepared(): void; + + // (undocumented) + getAggregate(keyspaceName: string, name: string, signature: string[] | Array<{ code: number, info: any }>, callback: ValueCallback): void; + + // (undocumented) + getAggregate(keyspaceName: string, name: string, signature: string[] | Array<{ code: number, info: any }>): Promise; + + // (undocumented) + getAggregates(keyspaceName: string, name: string, callback: ValueCallback): void; + + // (undocumented) + getAggregates(keyspaceName: string, name: string): Promise; + + // (undocumented) + getFunction(keyspaceName: string, name: string, signature: string[] | Array<{ code: number, info: any }>, callback: ValueCallback): void; + + // (undocumented) + getFunction(keyspaceName: string, name: string, signature: string[] | Array<{ code: number, info: any }>): Promise; + + // (undocumented) + getFunctions(keyspaceName: string, name: string, callback: ValueCallback): void; + + // (undocumented) + getFunctions(keyspaceName: string, name: string): Promise; + + // (undocumented) + getMaterializedView(keyspaceName: string, name: string, callback: ValueCallback): void; + + // (undocumented) + getMaterializedView(keyspaceName: string, name: string, callback: EmptyCallback): Promise; + + // (undocumented) + getReplicas(keyspaceName: string, token: Buffer | token.Token | token.TokenRange): Host[]; + + // (undocumented) + getTable(keyspaceName: string, name: string, callback: ValueCallback): void; + + // (undocumented) + getTable(keyspaceName: string, name: string): Promise; + + // (undocumented) + getTokenRanges(): Set; + + // (undocumented) + getTokenRangesForHost(keyspaceName: string, host: Host): Set | null; + + // (undocumented) + getTrace(traceId: Uuid, consistency: types.consistencies, callback: ValueCallback): void; + + // (undocumented) + getTrace(traceId: Uuid, consistency: types.consistencies): Promise; + + // (undocumented) + getTrace(traceId: Uuid, callback: ValueCallback): void; + + // (undocumented) + getTrace(traceId: Uuid): Promise; + + // (undocumented) + getUdt(keyspaceName: string, name: string, callback: ValueCallback): void; + + // (undocumented) + getUdt(keyspaceName: string, name: string): Promise; + + // (undocumented) + keyspaces: { [name: string]: { name: string, strategy: string }}; + + // (undocumented) + newToken(components: Buffer[] | Buffer | string): token.Token; + + // (undocumented) + newTokenRange(start: token.Token, end: token.Token): token.TokenRange; + + // (undocumented) + refreshKeyspace(name: string, callback: EmptyCallback): void; + + // (undocumented) + refreshKeyspace(name: string): Promise; + + // (undocumented) + refreshKeyspaces(waitReconnect: boolean, callback: EmptyCallback): void; + + // (undocumented) + refreshKeyspaces(waitReconnect?: boolean): Promise; + + // (undocumented) + refreshKeyspaces(callback: EmptyCallback): void; + } + + // (undocumented) + export interface QueryTrace { + // (undocumented) + clientAddress: string; + // (undocumented) + coordinator: InetAddress; + // (undocumented) + duration: number; + // (undocumented) + events: Array<{ id: Uuid; activity: any; source: any; elapsed: any; thread: any }>; + // (undocumented) + parameters: { [key: string]: any }; + // (undocumented) + requestType: string; + // (undocumented) + startedAt: number | types.Long; + } + + // (undocumented) + export interface SchemaFunction { + // (undocumented) + argumentNames: string[]; + // (undocumented) + argumentTypes: Array<{ code: dataTypes, info: any }>; + // (undocumented) + body: string; + // (undocumented) + calledOnNullInput: boolean; + // (undocumented) + keyspaceName: string; + // (undocumented) + language: string; + // (undocumented) + name: string; + // (undocumented) + returnType: string; + // (undocumented) + signature: string[]; + } + + // (undocumented) + export interface TableMetadata extends DataCollection { + // (undocumented) + cdc?: boolean; + // (undocumented) + indexes: Index[]; + // (undocumented) + indexInterval?: number; + // (undocumented) + isCompact: boolean; + // (undocumented) + memtableFlushPeriod: number; + // (undocumented) + replicateOnWrite: boolean; + // (undocumented) + virtual: boolean; + } + + // (undocumented) + export interface Udt { + // (undocumented) + fields: ColumnInfo[] + // (undocumented) + name: string; + } +} + +// @public (undocumented) +export namespace metrics { + // (undocumented) + export interface ClientMetrics { + // (undocumented) + onAuthenticationError(e: Error | errors.AuthenticationError): void; + + // (undocumented) + onClientTimeoutError(e: errors.OperationTimedOutError): void; + + // (undocumented) + onClientTimeoutRetry(e: Error): void; + + // (undocumented) + onConnectionError(e: Error): void; + + // (undocumented) + onIgnoreError(e: Error): void; + + // (undocumented) + onOtherError(e: Error): void; + + // (undocumented) + onOtherErrorRetry(e: Error): void; + + // (undocumented) + onReadTimeoutError(e: errors.ResponseError): void; + + // (undocumented) + onReadTimeoutRetry(e: Error): void; + + // (undocumented) + onResponse(latency: number[]): void; + + // (undocumented) + onSpeculativeExecution(): void; + + // (undocumented) + onSuccessfulResponse(latency: number[]): void; + + // (undocumented) + onUnavailableError(e: errors.ResponseError): void; + + // (undocumented) + onUnavailableRetry(e: Error): void; + + // (undocumented) + onWriteTimeoutError(e: errors.ResponseError): void; + + // (undocumented) + onWriteTimeoutRetry(e: Error): void; + } + + // (undocumented) + export class DefaultMetrics implements ClientMetrics { + constructor(); + + // (undocumented) + onAuthenticationError(e: Error | errors.AuthenticationError): void; + + // (undocumented) + onClientTimeoutError(e: errors.OperationTimedOutError): void; + + // (undocumented) + onClientTimeoutRetry(e: Error): void; + + // (undocumented) + onConnectionError(e: Error): void; + + // (undocumented) + onIgnoreError(e: Error): void; + + // (undocumented) + onOtherError(e: Error): void; + + // (undocumented) + onOtherErrorRetry(e: Error): void; + + // (undocumented) + onReadTimeoutError(e: errors.ResponseError): void; + + // (undocumented) + onReadTimeoutRetry(e: Error): void; + + // (undocumented) + onResponse(latency: number[]): void; + + // (undocumented) + onSpeculativeExecution(): void; + + // (undocumented) + onSuccessfulResponse(latency: number[]): void; + + // (undocumented) + onUnavailableError(e: errors.ResponseError): void; + + // (undocumented) + onUnavailableRetry(e: Error): void; + + // (undocumented) + onWriteTimeoutError(e: errors.ResponseError): void; + + // (undocumented) + onWriteTimeoutRetry(e: Error): void; + } +} + +// @public (undocumented) +export namespace policies { + // (undocumented) + export namespace addressResolution { + // (undocumented) + export interface AddressTranslator { + // (undocumented) + translate(address: string, port: number, callback: Function): void; + } + + // (undocumented) + export class EC2MultiRegionTranslator implements AddressTranslator { + // (undocumented) + translate(address: string, port: number, callback: Function): void; + } + } + + // (undocumented) + export function defaultAddressTranslator(): addressResolution.AddressTranslator; + + // (undocumented) + export function defaultLoadBalancingPolicy(localDc?: string): loadBalancing.LoadBalancingPolicy; + + // (undocumented) + export function defaultReconnectionPolicy(): reconnection.ReconnectionPolicy; + + // (undocumented) + export function defaultRetryPolicy(): retry.RetryPolicy; + + // (undocumented) + export function defaultSpeculativeExecutionPolicy(): speculativeExecution.SpeculativeExecutionPolicy; + + // (undocumented) + export function defaultTimestampGenerator(): timestampGeneration.TimestampGenerator; + + // (undocumented) + export namespace loadBalancing { + // (undocumented) + export class AllowListPolicy extends LoadBalancingPolicy { + constructor(childPolicy: LoadBalancingPolicy, allowList: string[]); + } + + // (undocumented) + export class DCAwareRoundRobinPolicy extends LoadBalancingPolicy { + constructor(localDc: string); + } + + // (undocumented) + export class DefaultLoadBalancingPolicy extends LoadBalancingPolicy { + constructor(options?: { localDc?: string, filter?: (host: Host) => boolean }); + } + + // (undocumented) + export abstract class LoadBalancingPolicy { + // (undocumented) + getDistance(host: Host): types.distance; + + // (undocumented) + getOptions(): Map; + + // (undocumented) + init(client: Client, hosts: HostMap, callback: EmptyCallback): void; + + // (undocumented) + newQueryPlan( + keyspace: string, + executionOptions: ExecutionOptions, + callback: (error: Error, iterator: Iterator) => void): void; + } + + // (undocumented) + export class RoundRobinPolicy extends LoadBalancingPolicy { + constructor(); + } + + // (undocumented) + export class TokenAwarePolicy extends LoadBalancingPolicy { + constructor(childPolicy: LoadBalancingPolicy); + } + + // (undocumented) + export class WhiteListPolicy extends AllowListPolicy { + } + } + + // (undocumented) + export namespace reconnection { + // (undocumented) + export class ConstantReconnectionPolicy implements ReconnectionPolicy { + constructor(delay: number); + + // (undocumented) + getOptions(): Map; + + // (undocumented) + newSchedule(): Iterator; + + } + + // (undocumented) + export class ExponentialReconnectionPolicy implements ReconnectionPolicy { + constructor(baseDelay: number, maxDelay: number, startWithNoDelay?: boolean); + + // (undocumented) + getOptions(): Map; + + // (undocumented) + newSchedule(): Iterator; + } + + // (undocumented) + export interface ReconnectionPolicy { + // (undocumented) + getOptions(): Map; + + // (undocumented) + newSchedule(): Iterator; + } + } + + // (undocumented) + export namespace retry { + // (undocumented) + export class DecisionInfo { + // (undocumented) + consistency: types.consistencies; + // (undocumented) + decision: number; + } + + // (undocumented) + export class FallthroughRetryPolicy extends RetryPolicy { + constructor(); + } + + // (undocumented) + export class IdempotenceAwareRetryPolicy extends RetryPolicy { + constructor(childPolicy: RetryPolicy); + } + + // (undocumented) + export class OperationInfo { + // (undocumented) + executionOptions: ExecutionOptions; + // (undocumented) + nbRetry: number; + // (undocumented) + query: string; + } + + // (undocumented) + export namespace RetryDecision { + // (undocumented) + export enum retryDecision { + // (undocumented) + ignore, + // (undocumented) + rethrow, + // (undocumented) + retry + } + } + + // (undocumented) + export class RetryPolicy { + // (undocumented) + onReadTimeout( + info: OperationInfo, + consistency: types.consistencies, + received: number, + blockFor: number, + isDataPresent: boolean): DecisionInfo; + + // (undocumented) + onRequestError(info: OperationInfo, consistency: types.consistencies, err: Error): DecisionInfo; + + // (undocumented) + onUnavailable( + info: OperationInfo, consistency: types.consistencies, required: number, alive: boolean): DecisionInfo; + + // (undocumented) + onWriteTimeout( + info: OperationInfo, + consistency: types.consistencies, + received: number, + blockFor: number, + writeType: string): DecisionInfo; + + // (undocumented) + rethrowResult(): DecisionInfo; + + // (undocumented) + retryResult(consistency: types.consistencies, useCurrentHost?: boolean): DecisionInfo; + } + } + + // (undocumented) + export namespace speculativeExecution { + // (undocumented) + export class ConstantSpeculativeExecutionPolicy implements SpeculativeExecutionPolicy { + constructor(delay: number, maxSpeculativeExecutions: number); + + // (undocumented) + getOptions(): Map; + + // (undocumented) + init(client: Client): void; + + // (undocumented) + newPlan(keyspace: string, queryInfo: string | Array): { nextExecution: Function }; + + // (undocumented) + shutdown(): void; + } + + // (undocumented) + export class NoSpeculativeExecutionPolicy implements SpeculativeExecutionPolicy { + constructor(); + + // (undocumented) + getOptions(): Map; + + // (undocumented) + init(client: Client): void; + + // (undocumented) + newPlan(keyspace: string, queryInfo: string | Array): { nextExecution: Function }; + + // (undocumented) + shutdown(): void; + } + + // (undocumented) + export interface SpeculativeExecutionPolicy { + // (undocumented) + getOptions(): Map; + + // (undocumented) + init(client: Client): void; + + // (undocumented) + newPlan(keyspace: string, queryInfo: string|Array): { nextExecution: Function }; + + // (undocumented) + shutdown(): void; + } + } + + // (undocumented) + export namespace timestampGeneration { + // (undocumented) + export class MonotonicTimestampGenerator implements TimestampGenerator { + constructor(warningThreshold: number, minLogInterval: number); + + // (undocumented) + getDate(): number; + + // (undocumented) + next(client: Client): types.Long | number; + } + + // (undocumented) + export interface TimestampGenerator { + // (undocumented) + next(client: Client): types.Long|number; + } + } +} + +// @public (undocumented) +export interface QueryOptions { + // (undocumented) + autoPage?: boolean; + // (undocumented) + captureStackTrace?: boolean; + // (undocumented) + consistency?: number; + // (undocumented) + counter?: boolean; + // (undocumented) + customPayload?: any; + // (undocumented) + executionProfile?: string | ExecutionProfile; + // (undocumented) + fetchSize?: number; + // (undocumented) + hints?: string[] | string[][]; + // (undocumented) + host?: Host; + // (undocumented) + isIdempotent?: boolean; + // (undocumented) + keyspace?: string; + // (undocumented) + logged?: boolean; + // (undocumented) + pageState?: Buffer | string; + // (undocumented) + prepare?: boolean; + // (undocumented) + readTimeout?: number; + // (undocumented) + retry?: policies.retry.RetryPolicy; + // (undocumented) + routingIndexes?: number[]; + // (undocumented) + routingKey?: Buffer | Buffer[]; + // (undocumented) + routingNames?: string[]; + // (undocumented) + serialConsistency?: number; + // (undocumented) + timestamp?: number | Long; + // (undocumented) + traceQuery?: boolean; +} + +// @public (undocumented) +export namespace token { + // (undocumented) + export interface Token { + // (undocumented) + compare(other: Token): number; + + // (undocumented) + equals(other: Token): boolean; + + // (undocumented) + getType(): { code: types.dataTypes, info: any }; + + // (undocumented) + getValue(): any; + } + + // (undocumented) + export interface TokenRange { + // (undocumented) + compare(other: TokenRange): number; + // (undocumented) + contains(token: Token): boolean; + // (undocumented) + end: Token; + // (undocumented) + equals(other: TokenRange): boolean; + // (undocumented) + isEmpty(): boolean; + // (undocumented) + isWrappedAround(): boolean; + // (undocumented) + splitEvenly(numberOfSplits: number): TokenRange[]; + // (undocumented) + start: Token; + // (undocumented) + unwrap(): TokenRange[]; + } +} + +// @public (undocumented) +export namespace tracker { + // (undocumented) + export class RequestLogger implements RequestTracker { + constructor(options: { + slowThreshold?: number; + logNormalRequests?: boolean; + logErroredRequests?: boolean; + messageMaxQueryLength?: number; + messageMaxParameterValueLength?: number; + messageMaxErrorStackTraceLength?: number; + }); + + // (undocumented) + onError(host: Host, query: string | Array<{ query: string; params?: any }>, parameters: any[] | { [p: string]: any } | null, executionOptions: ExecutionOptions, requestLength: number, err: Error, latency: number[]): void; + + // (undocumented) + onSuccess(host: Host, query: string | Array<{ query: string; params?: any }>, parameters: any[] | { [p: string]: any } | null, executionOptions: ExecutionOptions, requestLength: number, responseLength: number, latency: number[]): void; + + // (undocumented) + shutdown(): void; + } + + // (undocumented) + export interface RequestTracker { + // (undocumented) + onError( + host: Host, + query: string | Array<{ query: string, params?: any }>, + parameters: any[] | { [key: string]: any } | null, + executionOptions: ExecutionOptions, + requestLength: number, + err: Error, + latency: number[]): void; + + // (undocumented) + onSuccess( + host: Host, + query: string | Array<{ query: string, params?: any }>, + parameters: any[] | { [key: string]: any } | null, + executionOptions: ExecutionOptions, + requestLength: number, + responseLength: number, + latency: number[]): void; + + // (undocumented) + shutdown(): void; + } +} + +// @public (undocumented) +export namespace types { + // (undocumented) + export class BigDecimal { + constructor(unscaledValue: number, scale: number); + + // (undocumented) + add(other: BigDecimal): BigDecimal; + + // (undocumented) + compare(other: BigDecimal): number; + + // (undocumented) + equals(other: BigDecimal): boolean; + + // (undocumented) + static fromBuffer(buf: Buffer): BigDecimal; + + // (undocumented) + static fromNumber(value: number): BigDecimal; + + // (undocumented) + static fromString(value: string): BigDecimal; + + // (undocumented) + greaterThan(other: BigDecimal): boolean; + + // (undocumented) + isNegative(): boolean; + + // (undocumented) + isZero(): boolean; + + // (undocumented) + notEquals(other: BigDecimal): boolean; + + // (undocumented) + subtract(other: BigDecimal): BigDecimal; + + // (undocumented) + static toBuffer(value: BigDecimal): Buffer; + + // (undocumented) + toJSON(): string; + + // (undocumented) + toNumber(): number; + + // (undocumented) + toString(): string; + } + + // (undocumented) + export enum consistencies { + // (undocumented) + all = 0x05, + // (undocumented) + any = 0x00, + // (undocumented) + eachQuorum = 0x07, + // (undocumented) + localOne = 0x0a, + // (undocumented) + localQuorum = 0x06, + // (undocumented) + localSerial = 0x09, + // (undocumented) + one = 0x01, + // (undocumented) + quorum = 0x04, + // (undocumented) + serial = 0x08, + // (undocumented) + three = 0x03, + // (undocumented) + two = 0x02 + } + + // (undocumented) + export enum dataTypes { + // (undocumented) + ascii = 0x0001, + // (undocumented) + bigint = 0x0002, + // (undocumented) + blob = 0x0003, + // (undocumented) + boolean = 0x0004, + // (undocumented) + counter = 0x0005, + // (undocumented) + custom = 0x0000, + // (undocumented) + date = 0x0011, + // (undocumented) + decimal = 0x0006, + // (undocumented) + double = 0x0007, + // (undocumented) + duration = 0x0015, + // (undocumented) + float = 0x0008, + // (undocumented) + inet = 0x0010, + // (undocumented) + int = 0x0009, + // (undocumented) + list = 0x0020, + // (undocumented) + map = 0x0021, + // (undocumented) + set = 0x0022, + // (undocumented) + smallint = 0x0013, + // (undocumented) + text = 0x000a, + // (undocumented) + time = 0x0012, + // (undocumented) + timestamp = 0x000b, + // (undocumented) + timeuuid = 0x000f, + // (undocumented) + tinyint = 0x0014, + // (undocumented) + tuple = 0x0031, + // (undocumented) + udt = 0x0030, + // (undocumented) + uuid = 0x000c, + // (undocumented) + varchar = 0x000d, + // (undocumented) + varint = 0x000e, + } + + // (undocumented) + export enum distance { + // (undocumented) + ignored, + // (undocumented) + local = 0, + // (undocumented) + remote + } + + // (undocumented) + export class Duration { + constructor(month: number, days: number, nanoseconds: number | Long); + + // (undocumented) + equals(other: Duration): boolean; + + // (undocumented) + static fromBuffer(buffer: Buffer): Duration; + + // (undocumented) + static fromString(input: string): Duration; + + // (undocumented) + toBuffer(): Buffer; + + // (undocumented) + toString(): string; + } + + // (undocumented) + export class InetAddress { + constructor(buffer: Buffer); + + // (undocumented) + equals(other: InetAddress): boolean; + + // (undocumented) + static fromString(value: string): InetAddress; + + // (undocumented) + getBuffer(): Buffer; + + // (undocumented) + length: number; + + // (undocumented) + toJSON(): string; + + // (undocumented) + toString(): string; + + // (undocumented) + version: number; + } + + // (undocumented) + export class Integer { + constructor(bits: Array, sign: number); + // (undocumented) + abs(): Integer; + // (undocumented) + add(other: Integer): Integer; + // (undocumented) + compare(other: Integer): number; + // (undocumented) + divide(other: Integer): Integer; + // (undocumented) + equals(other: Integer): boolean; + // (undocumented) + static fromBits(bits: Array): Integer; + // (undocumented) + static fromBuffer(bits: Buffer): Integer; + // (undocumented) + static fromInt(value: number): Integer; + // (undocumented) + static fromNumber(value: number): Integer; + // (undocumented) + static fromString(str: string, opt_radix?: number): Integer; + // (undocumented) + getBits(index: number): number; + // (undocumented) + getBitsUnsigned(index: number): number; + // (undocumented) + getSign(): number; + // (undocumented) + greaterThan(other: Integer): boolean; + // (undocumented) + greaterThanOrEqual(other: Integer): boolean; + // (undocumented) + isNegative(): boolean; + // (undocumented) + isOdd(): boolean; + // (undocumented) + isZero(): boolean; + // (undocumented) + lessThan(other: Integer): boolean; + // (undocumented) + lessThanOrEqual(other: Integer): boolean; + // (undocumented) + modulo(other: Integer): Integer; + // (undocumented) + multiply(other: Integer): Integer; + // (undocumented) + negate(): Integer; + // (undocumented) + not(): Integer; + // (undocumented) + notEquals(other: Integer): boolean; + // (undocumented) + static ONE: Integer; + // (undocumented) + or(other: Integer): Integer; + // (undocumented) + shiftLeft(numBits: number): Integer; + // (undocumented) + shiftRight(numBits: number): Integer; + // (undocumented) + shorten(numBits: number): Integer; + // (undocumented) + subtract(other: Integer): Integer; + // (undocumented) + static toBuffer(value: Integer): Buffer; + // (undocumented) + toInt(): number; + // (undocumented) + toJSON(): string; + // (undocumented) + toNumber(): number; + // (undocumented) + toString(opt_radix?: number): string; + // (undocumented) + xor(other: Integer): Integer; + // (undocumented) + static ZERO: Integer; + } + + const // (undocumented) + unset: object; + + // (undocumented) + export class LocalDate { + constructor(year: number, month: number, day: number); + // (undocumented) + day: number; + // (undocumented) + equals(other: LocalDate): boolean; + // (undocumented) + static fromBuffer(buffer: Buffer): LocalDate; + // (undocumented) + static fromDate(date: Date): LocalDate; + // (undocumented) + static fromString(value: string): LocalDate; + // (undocumented) + inspect(): string; + // (undocumented) + month: number; + // (undocumented) + static now(): LocalDate; + // (undocumented) + toBuffer(): Buffer; + // (undocumented) + toJSON(): string; + // (undocumented) + toString(): string; + // (undocumented) + static utcNow(): LocalDate; + // (undocumented) + year: number; + } + + // (undocumented) + export class LocalTime { + constructor(totalNanoseconds: Long); + // (undocumented) + compare(other: LocalTime): boolean; + // (undocumented) + equals(other: LocalTime): boolean; + // (undocumented) + static fromBuffer(value: Buffer): LocalTime; + // (undocumented) + static fromDate(date: Date, nanoseconds: number): LocalTime; + // (undocumented) + static fromMilliseconds(milliseconds: number, nanoseconds?: number): LocalTime; + // (undocumented) + static fromString(value: string): LocalTime; + // (undocumented) + getTotalNanoseconds(): Long; + // (undocumented) + hour: number; + // (undocumented) + inspect(): string; + // (undocumented) + minute: number; + // (undocumented) + nanosecond: number; + // (undocumented) + static now(nanoseconds?: number): LocalTime; + // (undocumented) + second: number; + // (undocumented) + toBuffer(): Buffer; + // (undocumented) + toJSON(): string; + // (undocumented) + toString(): string; + } + + // (undocumented) + export class Long extends _Long { + + } + + // (undocumented) + export enum protocolVersion { + // (undocumented) + dseV1 = 0x41, + // (undocumented) + dseV2 = 0x42, + // (undocumented) + maxSupported = dseV2, + // (undocumented) + minSupported = v1, + // (undocumented) + v1 = 0x01, + // (undocumented) + v2 = 0x02, + // (undocumented) + v3 = 0x03, + // (undocumented) + v4 = 0x04, + // (undocumented) + v5 = 0x05, + // (undocumented) + v6 = 0x06 + } + + // (undocumented) + export namespace protocolVersion { + // (undocumented) + export function isSupported(version: protocolVersion): boolean; + } + + // (undocumented) + export enum responseErrorCodes { + // (undocumented) + alreadyExists = 0x2400, + // (undocumented) + badCredentials = 0x0100, + // (undocumented) + clientWriteFailure = 0x8000, + // (undocumented) + configError = 0x2300, + // (undocumented) + functionFailure = 0x1400, + // (undocumented) + invalid = 0x2200, + // (undocumented) + isBootstrapping = 0x1002, + // (undocumented) + overloaded = 0x1001, + // (undocumented) + protocolError = 0x000A, + // (undocumented) + readFailure = 0x1300, + // (undocumented) + readTimeout = 0x1200, + // (undocumented) + serverError = 0x0000, + // (undocumented) + syntaxError = 0x2000, + // (undocumented) + truncateError = 0x1003, + // (undocumented) + unauthorized = 0x2100, + // (undocumented) + unavailableException = 0x1000, + // (undocumented) + unprepared = 0x2500, + // (undocumented) + writeFailure = 0x1500, + // (undocumented) + writeTimeout = 0x1100 + } + + // (undocumented) + export interface ResultSet extends Iterable, AsyncIterable { + // (undocumented) + columns: Array<{ name: string, type: { code: dataTypes, info: any } }>; + + // (undocumented) + first(): Row; + + // (undocumented) + info: { + queriedHost: string, + triedHosts: { [key: string]: any; }, + speculativeExecutions: number, + achievedConsistency: consistencies, + traceId: Uuid, + warnings: string[], + customPayload: any + }; + + // (undocumented) + nextPage: (() => void) | null; + + // (undocumented) + pageState: string; + + // (undocumented) + rowLength: number; + + // (undocumented) + rows: Row[]; + + // (undocumented) + wasApplied(): boolean; + } + + // (undocumented) + export interface ResultStream extends stream.Readable { + // (undocumented) + add(chunk: Buffer): void; + // (undocumented) + buffer: Buffer; + // (undocumented) + paused: boolean; + } + + // (undocumented) + export interface Row { + // (undocumented) + [key: string]: any; + + // (undocumented) + forEach(callback: (row: Row) => void): void; + + // (undocumented) + get(columnName: string | number): any; + + // (undocumented) + keys(): string[]; + + // (undocumented) + values(): any[]; + } + + // (undocumented) + export class TimeUuid extends Uuid { + // (undocumented) + static fromDate(date: Date, ticks?: number, nodeId?: string | Buffer, clockId?: string | Buffer): TimeUuid; + + // (undocumented) + static fromDate( + date: Date, + ticks: number, + nodeId: string | Buffer, + clockId: string | Buffer, + callback: ValueCallback): void; + + // (undocumented) + static fromString(value: string): TimeUuid; + + // (undocumented) + getDate(): Date; + + // (undocumented) + getDatePrecision(): { date: Date, ticks: number }; + + // (undocumented) + static max(date: Date, ticks: number): TimeUuid; + + // (undocumented) + static min(date: Date, ticks: number): TimeUuid; + + // (undocumented) + static now(): TimeUuid; + + // (undocumented) + static now(nodeId: string | Buffer, clockId?: string | Buffer): TimeUuid; + + // (undocumented) + static now(nodeId: string | Buffer, clockId: string | Buffer, callback: ValueCallback): void; + + // (undocumented) + static now(callback: ValueCallback): void; + } + + // (undocumented) + export class Tuple { + constructor(...args: any[]); + // (undocumented) + elements: any[]; + // (undocumented) + static fromArray(elements: any[]): Tuple; + // (undocumented) + get(index: number): any; + // (undocumented) + length: number; + // (undocumented) + toJSON(): string; + // (undocumented) + toString(): string; + // (undocumented) + values(): any[]; + } + + // (undocumented) + export class Uuid { + constructor(buffer: Buffer); + + // (undocumented) + equals(other: Uuid): boolean; + + // (undocumented) + static fromString(value: string): Uuid; + + // (undocumented) + getBuffer(): Buffer; + + // (undocumented) + static random(callback: ValueCallback): void; + + // (undocumented) + static random(): Uuid; + + // (undocumented) + toJSON(): string; + + // (undocumented) + toString(): string; + } +} + +// @public (undocumented) +export type ValueCallback = (err: Error, val: T) => void; + +// @public (undocumented) +export const version: number; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 00000000..cf44d76e --- /dev/null +++ b/index.d.ts @@ -0,0 +1,414 @@ +/* + * Copyright DataStax, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as events from 'events'; +import * as tls from 'tls'; +import { URL } from 'url'; +import { auth } from './lib/auth'; +import { policies } from './lib/policies'; +import { types } from './lib/types'; +import { metrics } from './lib/metrics'; +import { tracker } from './lib/tracker'; +import { metadata } from './lib/metadata'; +import { datastax } from './lib/datastax/'; +import Long = types.Long; +import Uuid = types.Uuid; +import graph = datastax.graph; + +// Export imported submodules +export { concurrent } from './lib/concurrent'; +export { mapping } from './lib/mapping'; +export { geometry } from './lib/geometry'; +export { auth, datastax, metadata, metrics, policies, tracker, types }; + +export const version: number; + +export function defaultOptions(): ClientOptions; + +export type ValueCallback = (err: Error, val: T) => void; +export type EmptyCallback = (err: Error) => void; +export type ArrayOrObject = any[]|{[key: string]: any}; + +export class Client extends events.EventEmitter { + hosts: HostMap; + keyspace: string; + metadata: metadata.Metadata; + metrics: metrics.ClientMetrics; + + constructor(options: DseClientOptions); + + connect(): Promise; + + connect(callback: EmptyCallback): void; + + execute(query: string, params?: ArrayOrObject, options?: QueryOptions): Promise; + + execute(query: string, params: ArrayOrObject, options: QueryOptions, callback: ValueCallback): void; + + execute(query: string, params: ArrayOrObject, callback: ValueCallback): void; + + execute(query: string, callback: ValueCallback): void; + + executeGraph( + traversal: string, + parameters: { [name: string]: any } | undefined, + options: GraphQueryOptions, + callback: ValueCallback): void; + + executeGraph( + traversal: string, + parameters: { [name: string]: any } | undefined, + callback: ValueCallback): void; + + executeGraph(traversal: string, callback: ValueCallback): void; + + executeGraph( + traversal: string, + parameters?: { [name: string]: any }, + options?: GraphQueryOptions): Promise; + + eachRow(query: string, + params: ArrayOrObject, + options: QueryOptions, + rowCallback: (n: number, row: types.Row) => void, + callback?: ValueCallback): void; + + eachRow(query: string, + params: ArrayOrObject, + rowCallback: (n: number, row: types.Row) => void, + callback?: ValueCallback): void; + + eachRow(query: string, + rowCallback: (n: number, row: types.Row) => void): void; + + stream(query: string, params?: ArrayOrObject, options?: QueryOptions, callback?: EmptyCallback): events.EventEmitter; + + batch( + queries: Array, + options?: QueryOptions): Promise; + + batch( + queries: Array, + options: QueryOptions, + callback: ValueCallback): void; + + batch( + queries: Array, + callback: ValueCallback): void; + + shutdown(): Promise; + + shutdown(callback: EmptyCallback): void; + + getReplicas(keyspace: string, token: Buffer): Host[]; + + getState(): metadata.ClientState; +} + +export interface HostMap extends events.EventEmitter { + length: number; + + forEach(callback: (value: Host, key: string) => void): void; + + get(key: string): Host; + + keys(): string[]; + + values(): Host[]; +} + +export interface Host extends events.EventEmitter { + address: string; + cassandraVersion: string; + datacenter: string; + rack: string; + tokens: string[]; + hostId: types.Uuid; + + canBeConsideredAsUp(): boolean; + + getCassandraVersion(): number[]; + + isUp(): boolean; +} + +export interface ExecutionOptions { + getCaptureStackTrace(): boolean; + + getConsistency(): types.consistencies; + + getCustomPayload(): { [key: string]: any }; + + getFetchSize(): number; + + getFixedHost(): Host; + + getHints(): string[] | string[][]; + + isAutoPage(): boolean; + + isBatchCounter(): boolean; + + isBatchLogged(): boolean; + + isIdempotent(): boolean; + + isPrepared(): boolean; + + isQueryTracing(): boolean; + + getKeyspace(): string; + + getLoadBalancingPolicy(): policies.loadBalancing.LoadBalancingPolicy; + + getPageState(): Buffer; + + getRawQueryOptions(): QueryOptions; + + getReadTimeout(): number; + + getRetryPolicy(): policies.retry.RetryPolicy; + + getRoutingKey(): Buffer | Buffer[]; + + getSerialConsistency(): types.consistencies; + + getTimestamp(): number | Long | undefined | null; + + setHints(hints: string[]): void; +} + +export interface ClientOptions { + contactPoints?: string[]; + localDataCenter?: string; + keyspace?: string; + authProvider?: auth.AuthProvider; + credentials?: { + username: string; + password: string; + } + + cloud?: { + secureConnectBundle: string | URL; + }; + + encoding?: { + map?: Function; + set?: Function; + copyBuffer?: boolean; + useUndefinedAsUnset?: boolean; + useBigIntAsLong?: boolean; + useBigIntAsVarint?: boolean; + }; + isMetadataSyncEnabled?: boolean; + maxPrepared?: number; + metrics?: metrics.ClientMetrics; + policies?: { + addressResolution?: policies.addressResolution.AddressTranslator; + loadBalancing?: policies.loadBalancing.LoadBalancingPolicy; + reconnection?: policies.reconnection.ReconnectionPolicy; + retry?: policies.retry.RetryPolicy; + speculativeExecution?: policies.speculativeExecution.SpeculativeExecutionPolicy; + timestampGeneration?: policies.timestampGeneration.TimestampGenerator; + }; + pooling?: { + coreConnectionsPerHost?: { [key: number]: number; }; + heartBeatInterval?: number; + maxRequestsPerConnection?: number; + warmup?: boolean; + }; + prepareOnAllHosts?: boolean; + profiles?: ExecutionProfile[]; + protocolOptions?: { + maxSchemaAgreementWaitSeconds?: number; + maxVersion?: number; + noCompact?: boolean; + port?: number; + }; + promiseFactory?: (handler: (callback: (err: Error, result?: any) => void) => void) => Promise; + queryOptions?: QueryOptions; + refreshSchemaDelay?: number; + rePrepareOnUp?: boolean; + requestTracker?: tracker.RequestTracker; + socketOptions?: { + coalescingThreshold?: number; + connectTimeout?: number; + defunctReadTimeoutThreshold?: number; + keepAlive?: boolean; + keepAliveDelay?: number; + readTimeout?: number; + tcpNoDelay?: boolean; + }; + sslOptions?: tls.ConnectionOptions; +} + +export interface QueryOptions { + autoPage?: boolean; + captureStackTrace?: boolean; + consistency?: number; + counter?: boolean; + customPayload?: any; + executionProfile?: string | ExecutionProfile; + fetchSize?: number; + hints?: string[] | string[][]; + host?: Host; + isIdempotent?: boolean; + keyspace?: string; + logged?: boolean; + pageState?: Buffer | string; + prepare?: boolean; + readTimeout?: number; + retry?: policies.retry.RetryPolicy; + routingIndexes?: number[]; + routingKey?: Buffer | Buffer[]; + routingNames?: string[]; + serialConsistency?: number; + timestamp?: number | Long; + traceQuery?: boolean; +} + +export interface DseClientOptions extends ClientOptions { + id?: Uuid; + applicationName?: string; + applicationVersion?: string; + monitorReporting?: { enabled?: boolean }; + graphOptions?: GraphOptions; +} + +export interface GraphQueryOptions extends QueryOptions { + graphLanguage?: string; + graphName?: string; + graphReadConsistency?: types.consistencies; + graphSource?: string; + graphWriteConsistency?: types.consistencies; +} + +export type GraphOptions = { + language?: string; + name?: string; + readConsistency?: types.consistencies; + readTimeout?: number; + source?: string; + writeConsistency?: types.consistencies; +}; + +export class ExecutionProfile { + consistency?: types.consistencies; + loadBalancing?: policies.loadBalancing.LoadBalancingPolicy; + name: string; + readTimeout?: number; + retry?: policies.retry.RetryPolicy; + serialConsistency?: types.consistencies; + graphOptions?: { + name?: string; + language?: string; + source?: string; + readConsistency?: types.consistencies; + writeConsistency?: types.consistencies; + }; + + constructor(name: string, options: { + consistency?: types.consistencies; + loadBalancing?: policies.loadBalancing.LoadBalancingPolicy; + readTimeout?: number; + retry?: policies.retry.RetryPolicy; + serialConsistency?: types.consistencies; + graphOptions?: { + name?: string; + language?: string; + source?: string; + readConsistency?: types.consistencies; + writeConsistency?: types.consistencies; + }; + }); +} + +export namespace errors { + class ArgumentError extends DriverError { + constructor(message: string); + } + + class AuthenticationError extends DriverError { + constructor(message: string); + } + + class BusyConnectionError extends DriverError { + constructor(address: string, maxRequestsPerConnection: number, connectionLength: number); + } + + abstract class DriverError extends Error { + info: string; + + constructor(message: string, constructor?: any); + } + + class DriverInternalError extends DriverError { + constructor(message: string); + } + + class NoHostAvailableError extends DriverError { + innerErrors: any; + + constructor(innerErrors: any, message?: string); + } + + class NotSupportedError extends DriverError { + constructor(message: string); + } + + class OperationTimedOutError extends DriverError { + host?: string; + + constructor(message: string, host?: string); + } + + class ResponseError extends DriverError { + code: number; + + constructor(code: number, message: string); + } +} + +export namespace token { + interface Token { + compare(other: Token): number; + + equals(other: Token): boolean; + + getType(): { code: types.dataTypes, info: any }; + + getValue(): any; + } + + interface TokenRange { + start: Token; + end: Token; + + compare(other: TokenRange): number; + + contains(token: Token): boolean; + + equals(other: TokenRange): boolean; + + isEmpty(): boolean; + + isWrappedAround(): boolean; + + splitEvenly(numberOfSplits: number): TokenRange[]; + + unwrap(): TokenRange[]; + } +} \ No newline at end of file diff --git a/lib/auth/base-dse-authenticator.ts b/lib/auth/base-dse-authenticator.ts index bddc6493..7d356328 100644 --- a/lib/auth/base-dse-authenticator.ts +++ b/lib/auth/base-dse-authenticator.ts @@ -73,4 +73,4 @@ BaseDseAuthenticator.prototype._isDseAuthenticator = function () { return this.authenticatorName === dseAuthenticatorName; }; -module.exports = BaseDseAuthenticator; \ No newline at end of file +export default BaseDseAuthenticator; \ No newline at end of file diff --git a/lib/auth/dse-gssapi-auth-provider.ts b/lib/auth/dse-gssapi-auth-provider.ts index ac25a518..790241ed 100644 --- a/lib/auth/dse-gssapi-auth-provider.ts +++ b/lib/auth/dse-gssapi-auth-provider.ts @@ -228,4 +228,4 @@ GssapiAuthenticator.prototype.onAuthenticationSuccess = function (token) { }; -module.exports = DseGssapiAuthProvider; \ No newline at end of file +export default DseGssapiAuthProvider; \ No newline at end of file diff --git a/lib/auth/dse-plain-text-auth-provider.ts b/lib/auth/dse-plain-text-auth-provider.ts index 64a0f649..ce48444e 100644 --- a/lib/auth/dse-plain-text-auth-provider.ts +++ b/lib/auth/dse-plain-text-auth-provider.ts @@ -107,4 +107,4 @@ PlainTextAuthenticator.prototype.evaluateChallenge = function (challenge, callba ])); }; -module.exports = DsePlainTextAuthProvider; \ No newline at end of file +export default DsePlainTextAuthProvider; \ No newline at end of file diff --git a/lib/auth/gssapi-client.ts b/lib/auth/gssapi-client.ts index 92af818b..ceb5f207 100644 --- a/lib/auth/gssapi-client.ts +++ b/lib/auth/gssapi-client.ts @@ -152,4 +152,4 @@ class StandardGssClient extends GssapiClient { } } -module.exports = GssapiClient; \ No newline at end of file +export default GssapiClient; \ No newline at end of file diff --git a/lib/auth/index.ts b/lib/auth/index.ts index b79b14e2..a6e9f5d9 100644 --- a/lib/auth/index.ts +++ b/lib/auth/index.ts @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LsICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -23,13 +23,13 @@ * @module auth */ -const { Authenticator, AuthProvider } = require('./provider'); -const { PlainTextAuthProvider } = require('./plain-text-auth-provider'); -const DseGssapiAuthProvider = require('./dse-gssapi-auth-provider'); -const DsePlainTextAuthProvider = require('./dse-plain-text-auth-provider'); -const NoAuthProvider = require('./no-auth-provider'); +import { Authenticator, AuthProvider } from './provider'; +import { PlainTextAuthProvider } from './plain-text-auth-provider'; +import DseGssapiAuthProvider from './dse-gssapi-auth-provider'; +import DsePlainTextAuthProvider from './dse-plain-text-auth-provider'; +import NoAuthProvider from './no-auth-provider'; -module.exports = { +export default { Authenticator, AuthProvider, DseGssapiAuthProvider, diff --git a/lib/auth/no-auth-provider.ts b/lib/auth/no-auth-provider.ts index 7dbcd9ea..a9a3ba06 100644 --- a/lib/auth/no-auth-provider.ts +++ b/lib/auth/no-auth-provider.ts @@ -67,4 +67,4 @@ class TransitionalModePlainTextAuthenticator extends PlainTextAuthenticator { } } -module.exports = NoAuthProvider; +export default NoAuthProvider; diff --git a/lib/auth/plain-text-auth-provider.ts b/lib/auth/plain-text-auth-provider.ts index f5241f7e..ca8ba386 100644 --- a/lib/auth/plain-text-auth-provider.ts +++ b/lib/auth/plain-text-auth-provider.ts @@ -75,7 +75,7 @@ PlainTextAuthenticator.prototype.evaluateChallenge = function (challenge, callba callback(); }; -module.exports = { +export { PlainTextAuthenticator, PlainTextAuthProvider, }; diff --git a/lib/auth/provider.ts b/lib/auth/provider.ts index d4bf9ed1..50efa992 100644 --- a/lib/auth/provider.ts +++ b/lib/auth/provider.ts @@ -75,5 +75,7 @@ Authenticator.prototype.onAuthenticationSuccess = function (token) { }; -exports.AuthProvider = AuthProvider; -exports.Authenticator = Authenticator; \ No newline at end of file +export { + Authenticator, + AuthProvider +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 4983ffc8..aad45cc6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,13 +14,15 @@ "long": "~5.2.3" }, "devDependencies": { + "@types/mocha": "^10.0.10", "chai": "~4.3.8", "kerberos": "~2.0.3", "mocha": "~10.2.0", "mocha-jenkins-reporter": "~0.4.8", "proxyquire": "~2.1.3", "sinon": "~15.2.0", - "temp": ">= 0.8.3" + "temp": ">= 0.8.3", + "ts-mocha": "^10.0.0" }, "engines": { "node": ">=16" @@ -70,6 +72,19 @@ "integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==", "dev": true }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true, + "optional": true + }, + "node_modules/@types/mocha": { + "version": "10.0.10", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.10.tgz", + "integrity": "sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q==", + "dev": true + }, "node_modules/@types/node": { "version": "18.19.53", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.53.tgz", @@ -138,6 +153,15 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, + "node_modules/arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", @@ -268,6 +292,12 @@ "ieee754": "^1.1.13" } }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, "node_modules/camelcase": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", @@ -876,6 +906,19 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "optional": true, + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, "node_modules/just-extend": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz", @@ -948,6 +991,12 @@ "get-func-name": "^2.0.0" } }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, "node_modules/merge-descriptors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", @@ -1537,6 +1586,25 @@ "node": ">=8" } }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, "node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -1578,6 +1646,16 @@ "node": ">=8" } }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "optional": true, + "engines": { + "node": ">=4" + } + }, "node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -1684,6 +1762,71 @@ "node": ">=8.0" } }, + "node_modules/ts-mocha": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/ts-mocha/-/ts-mocha-10.0.0.tgz", + "integrity": "sha512-VRfgDO+iiuJFlNB18tzOfypJ21xn2xbuZyDvJvqpTbWgkAgD17ONGr8t+Tl8rcBtOBdjXp5e/Rk+d39f7XBHRw==", + "dev": true, + "dependencies": { + "ts-node": "7.0.1" + }, + "bin": { + "ts-mocha": "bin/ts-mocha" + }, + "engines": { + "node": ">= 6.X.X" + }, + "optionalDependencies": { + "tsconfig-paths": "^3.5.0" + }, + "peerDependencies": { + "mocha": "^3.X.X || ^4.X.X || ^5.X.X || ^6.X.X || ^7.X.X || ^8.X.X || ^9.X.X || ^10.X.X" + } + }, + "node_modules/ts-node": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-7.0.1.tgz", + "integrity": "sha512-BVwVbPJRspzNh2yfslyT1PSbl5uIk03EZlb493RKHN4qej/D06n1cEhjlOJG69oFsE7OT8XjpTUcYf6pKTLMhw==", + "dev": true, + "dependencies": { + "arrify": "^1.0.0", + "buffer-from": "^1.1.0", + "diff": "^3.1.0", + "make-error": "^1.1.1", + "minimist": "^1.2.0", + "mkdirp": "^0.5.1", + "source-map-support": "^0.5.6", + "yn": "^2.0.0" + }, + "bin": { + "ts-node": "dist/bin.js" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/ts-node/node_modules/diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/tsconfig-paths": { + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", + "dev": true, + "optional": true, + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } + }, "node_modules/tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -1802,6 +1945,15 @@ "node": ">=10" } }, + "node_modules/yn": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz", + "integrity": "sha512-uTv8J/wiWTgUTg+9vLTi//leUl5vDQS6uii/emeTb2ssY7vl6QWf2fFbIIGjnhjvbdKlU0ed7QPgY1htTC86jQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/package.json b/package.json index 75feaf8b..831117af 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,8 @@ "version": "4.7.2", "description": "DataStax Node.js Driver for Apache Cassandra", "author": "DataStax", + "main": "index.js", + "types": "dist/cassandra-driver.d.ts", "keywords": [ "cassandra", "cql", @@ -24,13 +26,15 @@ "long": "~5.2.3" }, "devDependencies": { + "@types/mocha": "^10.0.10", "chai": "~4.3.8", "kerberos": "~2.0.3", "mocha": "~10.2.0", "mocha-jenkins-reporter": "~0.4.8", "proxyquire": "~2.1.3", "sinon": "~15.2.0", - "temp": ">= 0.8.3" + "temp": ">= 0.8.3", + "ts-mocha": "^10.0.0" }, "repository": { "type": "git", diff --git a/tsconfig.json b/tsconfig.json index bb23852c..0b6bfad9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,6 @@ "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, - "checkJs": true, "declarationMap": true, "moduleDetection": "force" }, diff --git a/tsdoc-metadata.json b/tsdoc-metadata.json new file mode 100644 index 00000000..88a94013 --- /dev/null +++ b/tsdoc-metadata.json @@ -0,0 +1,11 @@ +// This file is read by tools that parse documentation comments conforming to the TSDoc standard. +// It should be published with your NPM package. It should not be tracked by Git. +{ + "tsdocVersion": "0.12", + "toolPackages": [ + { + "packageName": "@microsoft/api-extractor", + "packageVersion": "7.49.1" + } + ] +} From 5efc443d0c23e09e0cba54393a241a24ae3018bc Mon Sep 17 00:00:00 2001 From: Jane He Date: Wed, 22 Jan 2025 16:55:06 +0800 Subject: [PATCH 05/19] change test files to ts, can run by "npx ts-mocha test/unit --extension .ts" --- lib/auth/plain-text-auth-provider.ts | 2 +- lib/client.ts | 4 +- lib/connection.ts | 2 +- lib/policies/load-balancing.ts | 4 +- lib/writers.ts | 2 +- package-lock.json | 161 +++++++++++++++++- package.json | 4 +- ...data-tests.js => client-metadata-tests.ts} | 0 .../long/{event-tests.js => event-tests.ts} | 0 ...ncing-tests.js => load-balancing-tests.ts} | 8 +- ...s.js => dse-gssapi-auth-provider-tests.ts} | 0 ... => dse-plain-text-auth-provider-tests.ts} | 0 ...n-test.js => proxy-authentication-test.ts} | 0 ...t-batch-tests.js => client-batch-tests.ts} | 8 +- ...-row-tests.js => client-each-row-tests.ts} | 8 +- ...ts.js => client-execute-prepared-tests.ts} | 0 ...s.js => client-execute-simulator-tests.ts} | 0 ...ecute-tests.js => client-execute-tests.ts} | 10 +- ...ent-pool-tests.js => client-pool-tests.ts} | 4 +- ...stream-tests.js => client-stream-tests.ts} | 8 +- .../{cloud-helper.js => cloud-helper.ts} | 0 .../cloud/{cloud-tests.js => cloud-tests.ts} | 0 ...t-tests.js => execute-concurrent-tests.ts} | 0 ...onnection-tests.js => connection-tests.ts} | 10 +- ... => control-connection-simulator-tests.ts} | 2 +- ...n-tests.js => control-connection-tests.ts} | 2 +- ...yload-tests.js => custom-payload-tests.ts} | 0 ...n-type-tests.js => duration-type-tests.ts} | 0 ...ator-tests.js => error-simulator-tests.ts} | 0 .../short/{error-tests.js => error-tests.ts} | 0 ...le-tests.js => execution-profile-tests.ts} | 0 ...e-string-tests.js => line-string-tests.ts} | 0 .../{point-tests.js => point-tests.ts} | 0 .../{polygon-tests.js => polygon-tests.ts} | 0 ...raph-olap-tests.js => graph-olap-tests.ts} | 0 ...ph-test-helper.js => graph-test-helper.ts} | 0 .../graph/{graph-tests.js => graph-tests.ts} | 0 ...imeout-tests.js => graph-timeout-tests.ts} | 0 ...tests.js => graph-with-down-node-tests.ts} | 0 ...r-tests.js => insights-simulator-tests.ts} | 0 ...s.js => load-balancing-simulator-tests.ts} | 0 ...ncing-tests.js => load-balancing-tests.ts} | 0 ...eries-tests.js => custom-queries-tests.ts} | 0 ...js => from-and-to-model-function-tests.ts} | 0 ...r-test-helper.js => mapper-test-helper.ts} | 0 .../{mapper-tests.js => mapper-tests.ts} | 0 ...-mapper-tests.js => model-mapper-tests.ts} | 0 ...r-tests.js => metadata-simulator-tests.ts} | 0 .../{metadata-tests.js => metadata-tests.ts} | 0 .../{numeric-tests.js => numeric-tests.ts} | 0 .../{paging-tests.js => paging-tests.ts} | 0 ...lator-tests.js => pool-simulator-tests.ts} | 0 ...or-tests.js => prepare-simulator-tests.ts} | 0 ...ator-tests.js => retry-simulator-tests.ts} | 0 ...ate-range-tests.js => date-range-tests.ts} | 0 ... speculative-execution-simulator-tests.ts} | 2 +- .../short/{ssl-tests.js => ssl-tests.ts} | 0 ...or-tests.js => timeout-simulator-tests.ts} | 0 ...or-tests.js => tracker-simulator-tests.ts} | 0 .../short/{udf-tests.js => udf-tests.ts} | 0 .../{simulacron.js => simulacron.ts} | 4 +- .../{basic-profile.js => basic-profile.ts} | 4 +- ...-keeping-ref.js => profile-keeping-ref.ts} | 4 +- test/{test-helper.js => test-helper.ts} | 0 ...n-tests.js => address-resolution-tests.ts} | 0 test/unit/{api-tests.js => api-tests.ts} | 0 test/unit/{basic-tests.js => basic-tests.ts} | 2 +- ...-decimal-tests.js => big-decimal-tests.ts} | 0 .../unit/{client-tests.js => client-tests.ts} | 4 +- ...sts.js => certificate-validation-tests.ts} | 0 ...t-tests.js => execute-concurrent-tests.ts} | 0 ...onnection-tests.js => connection-tests.ts} | 0 ...n-tests.js => control-connection-tests.ts} | 2 +- ...=> default-load-balancing-policy-tests.ts} | 0 ...s.js => dse-gssapi-auth-provider-tests.ts} | 0 ... => dse-plain-text-auth-provider-tests.ts} | 0 ...n-type-tests.js => duration-type-tests.ts} | 0 .../{encoder-tests.js => encoder-tests.ts} | 0 test/unit/{error-tests.js => error-tests.ts} | 0 ...ncer-tests.js => event-debouncer-tests.ts} | 0 ...ns-tests.js => execution-options-tests.ts} | 0 ...le-tests.js => execution-profile-tests.ts} | 0 ...e-string-tests.js => line-string-tests.ts} | 0 .../{point-tests.js => point-tests.ts} | 0 .../{polygon-tests.js => polygon-tests.ts} | 0 .../{executor-tests.js => executor-tests.ts} | 0 ...-result-tests.js => graph-result-tests.ts} | 0 .../{graphson-tests.js => graphson-tests.ts} | 0 test/unit/{host-tests.js => host-tests.ts} | 2 +- ...address-tests.js => inet-address-tests.ts} | 0 ...ient-tests.js => insights-client-tests.ts} | 0 .../{license-tests.js => license-tests.ts} | 0 ...ncing-tests.js => load-balancing-tests.ts} | 4 +- .../{cache-tests.js => cache-tests.ts} | 0 .../{mapper-tests.js => mapper-tests.ts} | 0 ...t-helper.js => mapper-unit-test-helper.ts} | 0 ...dler-tests.js => mapping-handler-tests.ts} | 0 ...ests.js => model-mapper-mutation-tests.ts} | 0 ...-tests.js => model-mapper-select-tests.ts} | 0 ...o-tests.js => model-mapping-info-tests.ts} | 0 ...mapper-tests.js => result-mapper-tests.ts} | 0 .../{result-tests.js => result-tests.ts} | 0 ...pings-tests.js => table-mappings-tests.ts} | 0 .../mapping/{tree-tests.js => tree-tests.ts} | 0 .../{metadata-tests.js => metadata-tests.ts} | 6 +- ...le-long-tests.js => mutable-long-tests.ts} | 0 .../unit/{parser-tests.js => parser-tests.ts} | 0 ...dler-tests.js => prepare-handler-tests.ts} | 0 ...ream-tests.js => protocol-stream-tests.ts} | 0 ...ion-tests.js => protocol-version-tests.ts} | 0 ...onnection-test.js => reconnection-test.ts} | 0 ...dler-tests.js => request-handler-tests.ts} | 0 .../{requests-test.js => requests-test.ts} | 0 ...esult-set-tests.js => result-set-tests.ts} | 0 ...-policy-tests.js => retry-policy-tests.ts} | 0 ...ate-range-tests.js => date-range-tests.ts} | 0 ...ests.js => speculative-execution-tests.ts} | 0 ...tack-tests.js => stream-id-stack-tests.ts} | 0 ...{timestamp-tests.js => timestamp-tests.ts} | 0 test/unit/{token-tests.js => token-tests.ts} | 0 ...{tokenizer-tests.js => tokenizer-tests.ts} | 0 .../{tracker-tests.js => tracker-tests.ts} | 0 test/unit/{utils-tests.js => utils-tests.ts} | 0 test/unit/{uuid-tests.js => uuid-tests.ts} | 0 ...umber-tests.js => version-number-tests.ts} | 0 125 files changed, 217 insertions(+), 56 deletions(-) rename test/integration/long/{client-metadata-tests.js => client-metadata-tests.ts} (100%) rename test/integration/long/{event-tests.js => event-tests.ts} (100%) rename test/integration/long/{load-balancing-tests.js => load-balancing-tests.ts} (98%) rename test/integration/short/auth/{dse-gssapi-auth-provider-tests.js => dse-gssapi-auth-provider-tests.ts} (100%) rename test/integration/short/auth/{dse-plain-text-auth-provider-tests.js => dse-plain-text-auth-provider-tests.ts} (100%) rename test/integration/short/auth/{proxy-authentication-test.js => proxy-authentication-test.ts} (100%) rename test/integration/short/{client-batch-tests.js => client-batch-tests.ts} (99%) rename test/integration/short/{client-each-row-tests.js => client-each-row-tests.ts} (99%) rename test/integration/short/{client-execute-prepared-tests.js => client-execute-prepared-tests.ts} (100%) rename test/integration/short/{client-execute-simulator-tests.js => client-execute-simulator-tests.ts} (100%) rename test/integration/short/{client-execute-tests.js => client-execute-tests.ts} (99%) rename test/integration/short/{client-pool-tests.js => client-pool-tests.ts} (99%) rename test/integration/short/{client-stream-tests.js => client-stream-tests.ts} (98%) rename test/integration/short/cloud/{cloud-helper.js => cloud-helper.ts} (100%) rename test/integration/short/cloud/{cloud-tests.js => cloud-tests.ts} (100%) rename test/integration/short/concurrent/{execute-concurrent-tests.js => execute-concurrent-tests.ts} (100%) rename test/integration/short/{connection-tests.js => connection-tests.ts} (97%) rename test/integration/short/{control-connection-simulator-tests.js => control-connection-simulator-tests.ts} (99%) rename test/integration/short/{control-connection-tests.js => control-connection-tests.ts} (99%) rename test/integration/short/{custom-payload-tests.js => custom-payload-tests.ts} (100%) rename test/integration/short/{duration-type-tests.js => duration-type-tests.ts} (100%) rename test/integration/short/{error-simulator-tests.js => error-simulator-tests.ts} (100%) rename test/integration/short/{error-tests.js => error-tests.ts} (100%) rename test/integration/short/{execution-profile-tests.js => execution-profile-tests.ts} (100%) rename test/integration/short/geometry/{line-string-tests.js => line-string-tests.ts} (100%) rename test/integration/short/geometry/{point-tests.js => point-tests.ts} (100%) rename test/integration/short/geometry/{polygon-tests.js => polygon-tests.ts} (100%) rename test/integration/short/graph/{graph-olap-tests.js => graph-olap-tests.ts} (100%) rename test/integration/short/graph/{graph-test-helper.js => graph-test-helper.ts} (100%) rename test/integration/short/graph/{graph-tests.js => graph-tests.ts} (100%) rename test/integration/short/graph/{graph-timeout-tests.js => graph-timeout-tests.ts} (100%) rename test/integration/short/graph/{graph-with-down-node-tests.js => graph-with-down-node-tests.ts} (100%) rename test/integration/short/{insights-simulator-tests.js => insights-simulator-tests.ts} (100%) rename test/integration/short/{load-balancing-simulator-tests.js => load-balancing-simulator-tests.ts} (100%) rename test/integration/short/{load-balancing-tests.js => load-balancing-tests.ts} (100%) rename test/integration/short/mapping/{custom-queries-tests.js => custom-queries-tests.ts} (100%) rename test/integration/short/mapping/{from-and-to-model-function-tests.js => from-and-to-model-function-tests.ts} (100%) rename test/integration/short/mapping/{mapper-test-helper.js => mapper-test-helper.ts} (100%) rename test/integration/short/mapping/{mapper-tests.js => mapper-tests.ts} (100%) rename test/integration/short/mapping/{model-mapper-tests.js => model-mapper-tests.ts} (100%) rename test/integration/short/{metadata-simulator-tests.js => metadata-simulator-tests.ts} (100%) rename test/integration/short/{metadata-tests.js => metadata-tests.ts} (100%) rename test/integration/short/{numeric-tests.js => numeric-tests.ts} (100%) rename test/integration/short/{paging-tests.js => paging-tests.ts} (100%) rename test/integration/short/{pool-simulator-tests.js => pool-simulator-tests.ts} (100%) rename test/integration/short/{prepare-simulator-tests.js => prepare-simulator-tests.ts} (100%) rename test/integration/short/{retry-simulator-tests.js => retry-simulator-tests.ts} (100%) rename test/integration/short/search/{date-range-tests.js => date-range-tests.ts} (100%) rename test/integration/short/{speculative-execution-simulator-tests.js => speculative-execution-simulator-tests.ts} (99%) rename test/integration/short/{ssl-tests.js => ssl-tests.ts} (100%) rename test/integration/short/{timeout-simulator-tests.js => timeout-simulator-tests.ts} (100%) rename test/integration/short/{tracker-simulator-tests.js => tracker-simulator-tests.ts} (100%) rename test/integration/short/{udf-tests.js => udf-tests.ts} (100%) rename test/integration/{simulacron.js => simulacron.ts} (99%) rename test/other/memory/{basic-profile.js => basic-profile.ts} (97%) rename test/other/memory/{profile-keeping-ref.js => profile-keeping-ref.ts} (97%) rename test/{test-helper.js => test-helper.ts} (100%) rename test/unit/{address-resolution-tests.js => address-resolution-tests.ts} (100%) rename test/unit/{api-tests.js => api-tests.ts} (100%) rename test/unit/{basic-tests.js => basic-tests.ts} (99%) rename test/unit/{big-decimal-tests.js => big-decimal-tests.ts} (100%) rename test/unit/{client-tests.js => client-tests.ts} (99%) rename test/unit/cloud/{certificate-validation-tests.js => certificate-validation-tests.ts} (100%) rename test/unit/concurrent/{execute-concurrent-tests.js => execute-concurrent-tests.ts} (100%) rename test/unit/{connection-tests.js => connection-tests.ts} (100%) rename test/unit/{control-connection-tests.js => control-connection-tests.ts} (99%) rename test/unit/{default-load-balancing-policy-tests.js => default-load-balancing-policy-tests.ts} (100%) rename test/unit/{dse-gssapi-auth-provider-tests.js => dse-gssapi-auth-provider-tests.ts} (100%) rename test/unit/{dse-plain-text-auth-provider-tests.js => dse-plain-text-auth-provider-tests.ts} (100%) rename test/unit/{duration-type-tests.js => duration-type-tests.ts} (100%) rename test/unit/{encoder-tests.js => encoder-tests.ts} (100%) rename test/unit/{error-tests.js => error-tests.ts} (100%) rename test/unit/{event-debouncer-tests.js => event-debouncer-tests.ts} (100%) rename test/unit/{execution-options-tests.js => execution-options-tests.ts} (100%) rename test/unit/{execution-profile-tests.js => execution-profile-tests.ts} (100%) rename test/unit/geometry/{line-string-tests.js => line-string-tests.ts} (100%) rename test/unit/geometry/{point-tests.js => point-tests.ts} (100%) rename test/unit/geometry/{polygon-tests.js => polygon-tests.ts} (100%) rename test/unit/graph/{executor-tests.js => executor-tests.ts} (100%) rename test/unit/graph/{graph-result-tests.js => graph-result-tests.ts} (100%) rename test/unit/graph/{graphson-tests.js => graphson-tests.ts} (100%) rename test/unit/{host-tests.js => host-tests.ts} (99%) rename test/unit/{inet-address-tests.js => inet-address-tests.ts} (100%) rename test/unit/{insights-client-tests.js => insights-client-tests.ts} (100%) rename test/unit/{license-tests.js => license-tests.ts} (100%) rename test/unit/{load-balancing-tests.js => load-balancing-tests.ts} (99%) rename test/unit/mapping/{cache-tests.js => cache-tests.ts} (100%) rename test/unit/mapping/{mapper-tests.js => mapper-tests.ts} (100%) rename test/unit/mapping/{mapper-unit-test-helper.js => mapper-unit-test-helper.ts} (100%) rename test/unit/mapping/{mapping-handler-tests.js => mapping-handler-tests.ts} (100%) rename test/unit/mapping/{model-mapper-mutation-tests.js => model-mapper-mutation-tests.ts} (100%) rename test/unit/mapping/{model-mapper-select-tests.js => model-mapper-select-tests.ts} (100%) rename test/unit/mapping/{model-mapping-info-tests.js => model-mapping-info-tests.ts} (100%) rename test/unit/mapping/{result-mapper-tests.js => result-mapper-tests.ts} (100%) rename test/unit/mapping/{result-tests.js => result-tests.ts} (100%) rename test/unit/mapping/{table-mappings-tests.js => table-mappings-tests.ts} (100%) rename test/unit/mapping/{tree-tests.js => tree-tests.ts} (100%) rename test/unit/{metadata-tests.js => metadata-tests.ts} (99%) rename test/unit/{mutable-long-tests.js => mutable-long-tests.ts} (100%) rename test/unit/{parser-tests.js => parser-tests.ts} (100%) rename test/unit/{prepare-handler-tests.js => prepare-handler-tests.ts} (100%) rename test/unit/{protocol-stream-tests.js => protocol-stream-tests.ts} (100%) rename test/unit/{protocol-version-tests.js => protocol-version-tests.ts} (100%) rename test/unit/{reconnection-test.js => reconnection-test.ts} (100%) rename test/unit/{request-handler-tests.js => request-handler-tests.ts} (100%) rename test/unit/{requests-test.js => requests-test.ts} (100%) rename test/unit/{result-set-tests.js => result-set-tests.ts} (100%) rename test/unit/{retry-policy-tests.js => retry-policy-tests.ts} (100%) rename test/unit/search/{date-range-tests.js => date-range-tests.ts} (100%) rename test/unit/{speculative-execution-tests.js => speculative-execution-tests.ts} (100%) rename test/unit/{stream-id-stack-tests.js => stream-id-stack-tests.ts} (100%) rename test/unit/{timestamp-tests.js => timestamp-tests.ts} (100%) rename test/unit/{token-tests.js => token-tests.ts} (100%) rename test/unit/{tokenizer-tests.js => tokenizer-tests.ts} (100%) rename test/unit/{tracker-tests.js => tracker-tests.ts} (100%) rename test/unit/{utils-tests.js => utils-tests.ts} (100%) rename test/unit/{uuid-tests.js => uuid-tests.ts} (100%) rename test/unit/{version-number-tests.js => version-number-tests.ts} (100%) diff --git a/lib/auth/plain-text-auth-provider.ts b/lib/auth/plain-text-auth-provider.ts index f5241f7e..d696fcd5 100644 --- a/lib/auth/plain-text-auth-provider.ts +++ b/lib/auth/plain-text-auth-provider.ts @@ -16,7 +16,7 @@ 'use strict'; const util = require('util'); -const provider = require('./provider.js'); +const provider = require('./provider'); const utils = require('../utils'); const AuthProvider = provider.AuthProvider; const Authenticator = provider.Authenticator; diff --git a/lib/client.ts b/lib/client.ts index fae8ff83..333c2552 100644 --- a/lib/client.ts +++ b/lib/client.ts @@ -18,8 +18,8 @@ const events = require('events'); const util = require('util'); -const utils = require('./utils.js'); -const errors = require('./errors.js'); +const utils = require('./utils'); +const errors = require('./errors'); const types = require('./types'); const { ProfileManager } = require('./execution-profile'); const requests = require('./requests'); diff --git a/lib/connection.ts b/lib/connection.ts index 84382872..a6187fa3 100644 --- a/lib/connection.ts +++ b/lib/connection.ts @@ -21,7 +21,7 @@ const util = require('util'); const tls = require('tls'); const net = require('net'); -const Encoder = require('./encoder.js'); +const Encoder = require('./encoder'); const { WriteQueue } = require('./writers'); const requests = require('./requests'); const streams = require('./streams'); diff --git a/lib/policies/load-balancing.ts b/lib/policies/load-balancing.ts index de56e0d5..542ee792 100644 --- a/lib/policies/load-balancing.ts +++ b/lib/policies/load-balancing.ts @@ -17,8 +17,8 @@ const util = require('util'); const types = require('../types'); -const utils = require('../utils.js'); -const errors = require('../errors.js'); +const utils = require('../utils'); +const errors = require('../errors'); const doneIteratorObject = Object.freeze({ done: true }); const newlyUpInterval = 60000; diff --git a/lib/writers.ts b/lib/writers.ts index a3d4f281..aa5655f9 100644 --- a/lib/writers.ts +++ b/lib/writers.ts @@ -17,7 +17,7 @@ const events = require('events'); const types = require('./types'); -const utils = require('./utils.js'); +const utils = require('./utils'); const FrameHeader = types.FrameHeader; /** diff --git a/package-lock.json b/package-lock.json index 4983ffc8..27706d79 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,9 @@ "mocha-jenkins-reporter": "~0.4.8", "proxyquire": "~2.1.3", "sinon": "~15.2.0", - "temp": ">= 0.8.3" + "temp": ">= 0.8.3", + "ts-mocha": "^10.0.0", + "typescript": "^5.7.3" }, "engines": { "node": ">=16" @@ -70,6 +72,13 @@ "integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==", "dev": true }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true, + "optional": true + }, "node_modules/@types/node": { "version": "18.19.53", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.53.tgz", @@ -138,6 +147,15 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, + "node_modules/arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", @@ -268,6 +286,12 @@ "ieee754": "^1.1.13" } }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, "node_modules/camelcase": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", @@ -876,6 +900,19 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "optional": true, + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, "node_modules/just-extend": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz", @@ -948,6 +985,12 @@ "get-func-name": "^2.0.0" } }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, "node_modules/merge-descriptors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", @@ -1537,6 +1580,25 @@ "node": ">=8" } }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, "node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -1578,6 +1640,16 @@ "node": ">=8" } }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "optional": true, + "engines": { + "node": ">=4" + } + }, "node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -1684,6 +1756,71 @@ "node": ">=8.0" } }, + "node_modules/ts-mocha": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/ts-mocha/-/ts-mocha-10.0.0.tgz", + "integrity": "sha512-VRfgDO+iiuJFlNB18tzOfypJ21xn2xbuZyDvJvqpTbWgkAgD17ONGr8t+Tl8rcBtOBdjXp5e/Rk+d39f7XBHRw==", + "dev": true, + "dependencies": { + "ts-node": "7.0.1" + }, + "bin": { + "ts-mocha": "bin/ts-mocha" + }, + "engines": { + "node": ">= 6.X.X" + }, + "optionalDependencies": { + "tsconfig-paths": "^3.5.0" + }, + "peerDependencies": { + "mocha": "^3.X.X || ^4.X.X || ^5.X.X || ^6.X.X || ^7.X.X || ^8.X.X || ^9.X.X || ^10.X.X" + } + }, + "node_modules/ts-node": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-7.0.1.tgz", + "integrity": "sha512-BVwVbPJRspzNh2yfslyT1PSbl5uIk03EZlb493RKHN4qej/D06n1cEhjlOJG69oFsE7OT8XjpTUcYf6pKTLMhw==", + "dev": true, + "dependencies": { + "arrify": "^1.0.0", + "buffer-from": "^1.1.0", + "diff": "^3.1.0", + "make-error": "^1.1.1", + "minimist": "^1.2.0", + "mkdirp": "^0.5.1", + "source-map-support": "^0.5.6", + "yn": "^2.0.0" + }, + "bin": { + "ts-node": "dist/bin.js" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/ts-node/node_modules/diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/tsconfig-paths": { + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", + "dev": true, + "optional": true, + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } + }, "node_modules/tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -1705,6 +1842,19 @@ "node": ">=4" } }, + "node_modules/typescript": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz", + "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", @@ -1802,6 +1952,15 @@ "node": ">=10" } }, + "node_modules/yn": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz", + "integrity": "sha512-uTv8J/wiWTgUTg+9vLTi//leUl5vDQS6uii/emeTb2ssY7vl6QWf2fFbIIGjnhjvbdKlU0ed7QPgY1htTC86jQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/package.json b/package.json index 75feaf8b..c6796c87 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,9 @@ "mocha-jenkins-reporter": "~0.4.8", "proxyquire": "~2.1.3", "sinon": "~15.2.0", - "temp": ">= 0.8.3" + "temp": ">= 0.8.3", + "ts-mocha": "^10.0.0", + "typescript": "^5.7.3" }, "repository": { "type": "git", diff --git a/test/integration/long/client-metadata-tests.js b/test/integration/long/client-metadata-tests.ts similarity index 100% rename from test/integration/long/client-metadata-tests.js rename to test/integration/long/client-metadata-tests.ts diff --git a/test/integration/long/event-tests.js b/test/integration/long/event-tests.ts similarity index 100% rename from test/integration/long/event-tests.js rename to test/integration/long/event-tests.ts diff --git a/test/integration/long/load-balancing-tests.js b/test/integration/long/load-balancing-tests.ts similarity index 98% rename from test/integration/long/load-balancing-tests.js rename to test/integration/long/load-balancing-tests.ts index 2755f9e0..d28f6dd3 100644 --- a/test/integration/long/load-balancing-tests.js +++ b/test/integration/long/load-balancing-tests.ts @@ -17,10 +17,10 @@ const assert = require('assert'); const util = require('util'); -const helper = require('../../test-helper.js'); -const Client = require('../../../lib/client.js'); -const utils = require('../../../lib/utils.js'); -const loadBalancing = require('../../../lib/policies/load-balancing.js'); +const helper = require('../../test-helper'); +const Client = require('../../../lib/client'); +const utils = require('../../../lib/utils'); +const loadBalancing = require('../../../lib/policies/load-balancing'); const DCAwareRoundRobinPolicy = loadBalancing.DCAwareRoundRobinPolicy; const TokenAwarePolicy = loadBalancing.TokenAwarePolicy; diff --git a/test/integration/short/auth/dse-gssapi-auth-provider-tests.js b/test/integration/short/auth/dse-gssapi-auth-provider-tests.ts similarity index 100% rename from test/integration/short/auth/dse-gssapi-auth-provider-tests.js rename to test/integration/short/auth/dse-gssapi-auth-provider-tests.ts diff --git a/test/integration/short/auth/dse-plain-text-auth-provider-tests.js b/test/integration/short/auth/dse-plain-text-auth-provider-tests.ts similarity index 100% rename from test/integration/short/auth/dse-plain-text-auth-provider-tests.js rename to test/integration/short/auth/dse-plain-text-auth-provider-tests.ts diff --git a/test/integration/short/auth/proxy-authentication-test.js b/test/integration/short/auth/proxy-authentication-test.ts similarity index 100% rename from test/integration/short/auth/proxy-authentication-test.js rename to test/integration/short/auth/proxy-authentication-test.ts diff --git a/test/integration/short/client-batch-tests.js b/test/integration/short/client-batch-tests.ts similarity index 99% rename from test/integration/short/client-batch-tests.js rename to test/integration/short/client-batch-tests.ts index 46564d95..662a7f80 100644 --- a/test/integration/short/client-batch-tests.js +++ b/test/integration/short/client-batch-tests.ts @@ -17,11 +17,11 @@ const assert = require('assert'); const util = require('util'); -const helper = require('../../test-helper.js'); -const Client = require('../../../lib/client.js'); +const helper = require('../../test-helper'); +const Client = require('../../../lib/client'); const types = require('../../../lib/types'); -const utils = require('../../../lib/utils.js'); -const errors = require('../../../lib/errors.js'); +const utils = require('../../../lib/utils'); +const errors = require('../../../lib/errors'); const vit = helper.vit; describe('Client @SERVER_API', function () { diff --git a/test/integration/short/client-each-row-tests.js b/test/integration/short/client-each-row-tests.ts similarity index 99% rename from test/integration/short/client-each-row-tests.js rename to test/integration/short/client-each-row-tests.ts index af1240ad..552a5dbd 100644 --- a/test/integration/short/client-each-row-tests.js +++ b/test/integration/short/client-each-row-tests.ts @@ -19,11 +19,11 @@ const assert = require('chai').assert; const util = require('util'); const sinon = require('sinon'); -const helper = require('../../test-helper.js'); -const Client = require('../../../lib/client.js'); +const helper = require('../../test-helper'); +const Client = require('../../../lib/client'); const types = require('../../../lib/types'); -const utils = require('../../../lib/utils.js'); -const errors = require('../../../lib/errors.js'); +const utils = require('../../../lib/utils'); +const errors = require('../../../lib/errors'); const vit = helper.vit; describe('Client', function () { diff --git a/test/integration/short/client-execute-prepared-tests.js b/test/integration/short/client-execute-prepared-tests.ts similarity index 100% rename from test/integration/short/client-execute-prepared-tests.js rename to test/integration/short/client-execute-prepared-tests.ts diff --git a/test/integration/short/client-execute-simulator-tests.js b/test/integration/short/client-execute-simulator-tests.ts similarity index 100% rename from test/integration/short/client-execute-simulator-tests.js rename to test/integration/short/client-execute-simulator-tests.ts diff --git a/test/integration/short/client-execute-tests.js b/test/integration/short/client-execute-tests.ts similarity index 99% rename from test/integration/short/client-execute-tests.js rename to test/integration/short/client-execute-tests.ts index 30575693..9a24f241 100644 --- a/test/integration/short/client-execute-tests.js +++ b/test/integration/short/client-execute-tests.ts @@ -17,12 +17,12 @@ const assert = require('assert'); const util = require('util'); -const helper = require('../../test-helper.js'); -const Client = require('../../../lib/client.js'); -const ExecutionProfile = require('../../../lib/execution-profile.js').ExecutionProfile; +const helper = require('../../test-helper'); +const Client = require('../../../lib/client'); +const ExecutionProfile = require('../../../lib/execution-profile').ExecutionProfile; const types = require('../../../lib/types'); -const utils = require('../../../lib/utils.js'); -const errors = require('../../../lib/errors.js'); +const utils = require('../../../lib/utils'); +const errors = require('../../../lib/errors'); const vit = helper.vit; const vdescribe = helper.vdescribe; const numericTests = require('./numeric-tests'); diff --git a/test/integration/short/client-pool-tests.js b/test/integration/short/client-pool-tests.ts similarity index 99% rename from test/integration/short/client-pool-tests.js rename to test/integration/short/client-pool-tests.ts index 212d2f52..39c51785 100644 --- a/test/integration/short/client-pool-tests.js +++ b/test/integration/short/client-pool-tests.ts @@ -26,8 +26,8 @@ const utils = require('../../../lib/utils'); const errors = require('../../../lib/errors'); const types = require('../../../lib/types'); const policies = require('../../../lib/policies'); -const RoundRobinPolicy = require('../../../lib/policies/load-balancing.js').RoundRobinPolicy; -const Murmur3Tokenizer = require('../../../lib/tokenizer.js').Murmur3Tokenizer; +const RoundRobinPolicy = require('../../../lib/policies/load-balancing').RoundRobinPolicy; +const Murmur3Tokenizer = require('../../../lib/tokenizer').Murmur3Tokenizer; const { PlainTextAuthProvider } = require('../../../lib/auth'); const ConstantSpeculativeExecutionPolicy = policies.speculativeExecution.ConstantSpeculativeExecutionPolicy; const OrderedLoadBalancingPolicy = helper.OrderedLoadBalancingPolicy; diff --git a/test/integration/short/client-stream-tests.js b/test/integration/short/client-stream-tests.ts similarity index 98% rename from test/integration/short/client-stream-tests.js rename to test/integration/short/client-stream-tests.ts index 0ed8ab03..d7ca1ff7 100644 --- a/test/integration/short/client-stream-tests.js +++ b/test/integration/short/client-stream-tests.ts @@ -17,12 +17,12 @@ const assert = require('assert'); const util = require('util'); -const helper = require('../../test-helper.js'); +const helper = require('../../test-helper'); const vit = helper.vit; -const Client = require('../../../lib/client.js'); +const Client = require('../../../lib/client'); const types = require('../../../lib/types'); -const utils = require('../../../lib/utils.js'); -const errors = require('../../../lib/errors.js'); +const utils = require('../../../lib/utils'); +const errors = require('../../../lib/errors'); describe('Client', function () { this.timeout(120000); diff --git a/test/integration/short/cloud/cloud-helper.js b/test/integration/short/cloud/cloud-helper.ts similarity index 100% rename from test/integration/short/cloud/cloud-helper.js rename to test/integration/short/cloud/cloud-helper.ts diff --git a/test/integration/short/cloud/cloud-tests.js b/test/integration/short/cloud/cloud-tests.ts similarity index 100% rename from test/integration/short/cloud/cloud-tests.js rename to test/integration/short/cloud/cloud-tests.ts diff --git a/test/integration/short/concurrent/execute-concurrent-tests.js b/test/integration/short/concurrent/execute-concurrent-tests.ts similarity index 100% rename from test/integration/short/concurrent/execute-concurrent-tests.js rename to test/integration/short/concurrent/execute-concurrent-tests.ts diff --git a/test/integration/short/connection-tests.js b/test/integration/short/connection-tests.ts similarity index 97% rename from test/integration/short/connection-tests.js rename to test/integration/short/connection-tests.ts index 28d304a5..90318c3c 100644 --- a/test/integration/short/connection-tests.js +++ b/test/integration/short/connection-tests.ts @@ -18,12 +18,12 @@ const assert = require('chai').assert; const sinon = require('sinon'); -const Connection = require('../../../lib/connection.js'); -const defaultOptions = require('../../../lib/client-options.js').defaultOptions(); -const utils = require('../../../lib/utils.js'); -const requests = require('../../../lib/requests.js'); +const Connection = require('../../../lib/connection'); +const defaultOptions = require('../../../lib/client-options').defaultOptions(); +const utils = require('../../../lib/utils'); +const requests = require('../../../lib/requests'); const protocolVersion = require('../../../lib/types').protocolVersion; -const helper = require('../../test-helper.js'); +const helper = require('../../test-helper'); const errors = require('../../../lib/errors'); const types = require('../../../lib/types'); const vit = helper.vit; diff --git a/test/integration/short/control-connection-simulator-tests.js b/test/integration/short/control-connection-simulator-tests.ts similarity index 99% rename from test/integration/short/control-connection-simulator-tests.js rename to test/integration/short/control-connection-simulator-tests.ts index a5f8db99..13deac50 100644 --- a/test/integration/short/control-connection-simulator-tests.js +++ b/test/integration/short/control-connection-simulator-tests.ts @@ -21,7 +21,7 @@ const simulacron = require('../simulacron'); const utils = require('../../../lib/utils'); const types = require('../../../lib/types'); -const Client = require('../../../lib/client.js'); +const Client = require('../../../lib/client'); describe('ControlConnection', function() { this.timeout(5000); diff --git a/test/integration/short/control-connection-tests.js b/test/integration/short/control-connection-tests.ts similarity index 99% rename from test/integration/short/control-connection-tests.js rename to test/integration/short/control-connection-tests.ts index b4810216..4908638a 100644 --- a/test/integration/short/control-connection-tests.js +++ b/test/integration/short/control-connection-tests.ts @@ -18,7 +18,7 @@ const assert = require('assert'); const util = require('util'); const helper = require('../../test-helper'); -const Client = require('../../../lib/client.js'); +const Client = require('../../../lib/client'); const ControlConnection = require('../../../lib/control-connection'); const utils = require('../../../lib/utils'); const types = require('../../../lib/types'); diff --git a/test/integration/short/custom-payload-tests.js b/test/integration/short/custom-payload-tests.ts similarity index 100% rename from test/integration/short/custom-payload-tests.js rename to test/integration/short/custom-payload-tests.ts diff --git a/test/integration/short/duration-type-tests.js b/test/integration/short/duration-type-tests.ts similarity index 100% rename from test/integration/short/duration-type-tests.js rename to test/integration/short/duration-type-tests.ts diff --git a/test/integration/short/error-simulator-tests.js b/test/integration/short/error-simulator-tests.ts similarity index 100% rename from test/integration/short/error-simulator-tests.js rename to test/integration/short/error-simulator-tests.ts diff --git a/test/integration/short/error-tests.js b/test/integration/short/error-tests.ts similarity index 100% rename from test/integration/short/error-tests.js rename to test/integration/short/error-tests.ts diff --git a/test/integration/short/execution-profile-tests.js b/test/integration/short/execution-profile-tests.ts similarity index 100% rename from test/integration/short/execution-profile-tests.js rename to test/integration/short/execution-profile-tests.ts diff --git a/test/integration/short/geometry/line-string-tests.js b/test/integration/short/geometry/line-string-tests.ts similarity index 100% rename from test/integration/short/geometry/line-string-tests.js rename to test/integration/short/geometry/line-string-tests.ts diff --git a/test/integration/short/geometry/point-tests.js b/test/integration/short/geometry/point-tests.ts similarity index 100% rename from test/integration/short/geometry/point-tests.js rename to test/integration/short/geometry/point-tests.ts diff --git a/test/integration/short/geometry/polygon-tests.js b/test/integration/short/geometry/polygon-tests.ts similarity index 100% rename from test/integration/short/geometry/polygon-tests.js rename to test/integration/short/geometry/polygon-tests.ts diff --git a/test/integration/short/graph/graph-olap-tests.js b/test/integration/short/graph/graph-olap-tests.ts similarity index 100% rename from test/integration/short/graph/graph-olap-tests.js rename to test/integration/short/graph/graph-olap-tests.ts diff --git a/test/integration/short/graph/graph-test-helper.js b/test/integration/short/graph/graph-test-helper.ts similarity index 100% rename from test/integration/short/graph/graph-test-helper.js rename to test/integration/short/graph/graph-test-helper.ts diff --git a/test/integration/short/graph/graph-tests.js b/test/integration/short/graph/graph-tests.ts similarity index 100% rename from test/integration/short/graph/graph-tests.js rename to test/integration/short/graph/graph-tests.ts diff --git a/test/integration/short/graph/graph-timeout-tests.js b/test/integration/short/graph/graph-timeout-tests.ts similarity index 100% rename from test/integration/short/graph/graph-timeout-tests.js rename to test/integration/short/graph/graph-timeout-tests.ts diff --git a/test/integration/short/graph/graph-with-down-node-tests.js b/test/integration/short/graph/graph-with-down-node-tests.ts similarity index 100% rename from test/integration/short/graph/graph-with-down-node-tests.js rename to test/integration/short/graph/graph-with-down-node-tests.ts diff --git a/test/integration/short/insights-simulator-tests.js b/test/integration/short/insights-simulator-tests.ts similarity index 100% rename from test/integration/short/insights-simulator-tests.js rename to test/integration/short/insights-simulator-tests.ts diff --git a/test/integration/short/load-balancing-simulator-tests.js b/test/integration/short/load-balancing-simulator-tests.ts similarity index 100% rename from test/integration/short/load-balancing-simulator-tests.js rename to test/integration/short/load-balancing-simulator-tests.ts diff --git a/test/integration/short/load-balancing-tests.js b/test/integration/short/load-balancing-tests.ts similarity index 100% rename from test/integration/short/load-balancing-tests.js rename to test/integration/short/load-balancing-tests.ts diff --git a/test/integration/short/mapping/custom-queries-tests.js b/test/integration/short/mapping/custom-queries-tests.ts similarity index 100% rename from test/integration/short/mapping/custom-queries-tests.js rename to test/integration/short/mapping/custom-queries-tests.ts diff --git a/test/integration/short/mapping/from-and-to-model-function-tests.js b/test/integration/short/mapping/from-and-to-model-function-tests.ts similarity index 100% rename from test/integration/short/mapping/from-and-to-model-function-tests.js rename to test/integration/short/mapping/from-and-to-model-function-tests.ts diff --git a/test/integration/short/mapping/mapper-test-helper.js b/test/integration/short/mapping/mapper-test-helper.ts similarity index 100% rename from test/integration/short/mapping/mapper-test-helper.js rename to test/integration/short/mapping/mapper-test-helper.ts diff --git a/test/integration/short/mapping/mapper-tests.js b/test/integration/short/mapping/mapper-tests.ts similarity index 100% rename from test/integration/short/mapping/mapper-tests.js rename to test/integration/short/mapping/mapper-tests.ts diff --git a/test/integration/short/mapping/model-mapper-tests.js b/test/integration/short/mapping/model-mapper-tests.ts similarity index 100% rename from test/integration/short/mapping/model-mapper-tests.js rename to test/integration/short/mapping/model-mapper-tests.ts diff --git a/test/integration/short/metadata-simulator-tests.js b/test/integration/short/metadata-simulator-tests.ts similarity index 100% rename from test/integration/short/metadata-simulator-tests.js rename to test/integration/short/metadata-simulator-tests.ts diff --git a/test/integration/short/metadata-tests.js b/test/integration/short/metadata-tests.ts similarity index 100% rename from test/integration/short/metadata-tests.js rename to test/integration/short/metadata-tests.ts diff --git a/test/integration/short/numeric-tests.js b/test/integration/short/numeric-tests.ts similarity index 100% rename from test/integration/short/numeric-tests.js rename to test/integration/short/numeric-tests.ts diff --git a/test/integration/short/paging-tests.js b/test/integration/short/paging-tests.ts similarity index 100% rename from test/integration/short/paging-tests.js rename to test/integration/short/paging-tests.ts diff --git a/test/integration/short/pool-simulator-tests.js b/test/integration/short/pool-simulator-tests.ts similarity index 100% rename from test/integration/short/pool-simulator-tests.js rename to test/integration/short/pool-simulator-tests.ts diff --git a/test/integration/short/prepare-simulator-tests.js b/test/integration/short/prepare-simulator-tests.ts similarity index 100% rename from test/integration/short/prepare-simulator-tests.js rename to test/integration/short/prepare-simulator-tests.ts diff --git a/test/integration/short/retry-simulator-tests.js b/test/integration/short/retry-simulator-tests.ts similarity index 100% rename from test/integration/short/retry-simulator-tests.js rename to test/integration/short/retry-simulator-tests.ts diff --git a/test/integration/short/search/date-range-tests.js b/test/integration/short/search/date-range-tests.ts similarity index 100% rename from test/integration/short/search/date-range-tests.js rename to test/integration/short/search/date-range-tests.ts diff --git a/test/integration/short/speculative-execution-simulator-tests.js b/test/integration/short/speculative-execution-simulator-tests.ts similarity index 99% rename from test/integration/short/speculative-execution-simulator-tests.js rename to test/integration/short/speculative-execution-simulator-tests.ts index b5984a3b..d19e8e95 100644 --- a/test/integration/short/speculative-execution-simulator-tests.js +++ b/test/integration/short/speculative-execution-simulator-tests.ts @@ -20,7 +20,7 @@ const simulacron = require('../simulacron'); const helper = require('../../test-helper'); const utils = require('../../../lib/utils'); -const Client = require('../../../lib/client.js'); +const Client = require('../../../lib/client'); const ConstantSpeculativeExecutionPolicy = require('../../../lib/policies/speculative-execution').ConstantSpeculativeExecutionPolicy; const NoSpeculativeExecutionPolicy = require('../../../lib/policies/speculative-execution').NoSpeculativeExecutionPolicy; const OrderedLoadBalancingPolicy = require('../../test-helper').OrderedLoadBalancingPolicy; diff --git a/test/integration/short/ssl-tests.js b/test/integration/short/ssl-tests.ts similarity index 100% rename from test/integration/short/ssl-tests.js rename to test/integration/short/ssl-tests.ts diff --git a/test/integration/short/timeout-simulator-tests.js b/test/integration/short/timeout-simulator-tests.ts similarity index 100% rename from test/integration/short/timeout-simulator-tests.js rename to test/integration/short/timeout-simulator-tests.ts diff --git a/test/integration/short/tracker-simulator-tests.js b/test/integration/short/tracker-simulator-tests.ts similarity index 100% rename from test/integration/short/tracker-simulator-tests.js rename to test/integration/short/tracker-simulator-tests.ts diff --git a/test/integration/short/udf-tests.js b/test/integration/short/udf-tests.ts similarity index 100% rename from test/integration/short/udf-tests.js rename to test/integration/short/udf-tests.ts diff --git a/test/integration/simulacron.js b/test/integration/simulacron.ts similarity index 99% rename from test/integration/simulacron.js rename to test/integration/simulacron.ts index 4f144924..88d4481e 100644 --- a/test/integration/simulacron.js +++ b/test/integration/simulacron.ts @@ -19,8 +19,8 @@ const http = require('http'); const spawn = require('child_process').spawn; const util = require('util'); const fs = require('fs'); -const utils = require('../../lib/utils.js'); -const Client = require('../../lib/client.js'); +const utils = require('../../lib/utils'); +const Client = require('../../lib/client'); const simulacronHelper = { _execute: function(processName, params, cb) { diff --git a/test/other/memory/basic-profile.js b/test/other/memory/basic-profile.ts similarity index 97% rename from test/other/memory/basic-profile.js rename to test/other/memory/basic-profile.ts index 75b45281..50b75c40 100644 --- a/test/other/memory/basic-profile.js +++ b/test/other/memory/basic-profile.ts @@ -27,8 +27,8 @@ catch (e) { console.error('There was an error while trying to import heapdump', e); } -const helper = require('../../test-helper.js'); -const cassandra = require('../../../index.js'); +const helper = require('../../test-helper'); +const cassandra = require('../../../index'); const Client = cassandra.Client; const types = cassandra.types; const utils = require('../../../lib/utils'); diff --git a/test/other/memory/profile-keeping-ref.js b/test/other/memory/profile-keeping-ref.ts similarity index 97% rename from test/other/memory/profile-keeping-ref.js rename to test/other/memory/profile-keeping-ref.ts index 246be4d4..1decb83f 100644 --- a/test/other/memory/profile-keeping-ref.js +++ b/test/other/memory/profile-keeping-ref.ts @@ -27,8 +27,8 @@ catch (e) { console.log(e); } -const helper = require('../../test-helper.js'); -const cassandra = require('../../../index.js'); +const helper = require('../../test-helper'); +const cassandra = require('../../../index'); const Client = cassandra.Client; const types = cassandra.types; const utils = require('../../../lib/utils'); diff --git a/test/test-helper.js b/test/test-helper.ts similarity index 100% rename from test/test-helper.js rename to test/test-helper.ts diff --git a/test/unit/address-resolution-tests.js b/test/unit/address-resolution-tests.ts similarity index 100% rename from test/unit/address-resolution-tests.js rename to test/unit/address-resolution-tests.ts diff --git a/test/unit/api-tests.js b/test/unit/api-tests.ts similarity index 100% rename from test/unit/api-tests.js rename to test/unit/api-tests.ts diff --git a/test/unit/basic-tests.js b/test/unit/basic-tests.ts similarity index 99% rename from test/unit/basic-tests.js rename to test/unit/basic-tests.ts index e1b18119..94ea8c03 100644 --- a/test/unit/basic-tests.js +++ b/test/unit/basic-tests.ts @@ -911,7 +911,7 @@ describe('exports', function () { //test that the exposed API is the one expected //it looks like a dumb test and it is, but it is necessary! /* eslint-disable global-require */ - const api = require('../../index.js'); + const api = require('../../index'); assert.strictEqual(api.Client, Client); assert.ok(api.errors); assert.strictEqual(typeof api.errors.DriverError, 'function'); diff --git a/test/unit/big-decimal-tests.js b/test/unit/big-decimal-tests.ts similarity index 100% rename from test/unit/big-decimal-tests.js rename to test/unit/big-decimal-tests.ts diff --git a/test/unit/client-tests.js b/test/unit/client-tests.ts similarity index 99% rename from test/unit/client-tests.js rename to test/unit/client-tests.ts index 807d16ee..a117d798 100644 --- a/test/unit/client-tests.js +++ b/test/unit/client-tests.ts @@ -179,7 +179,7 @@ describe('Client', function () { await helper.delayAsync(20); }; - const Client = proxyquire('../../lib/client.js', { + const Client = proxyquire('../../lib/client', { './control-connection': ccMock }); const client = new Client(options); @@ -548,7 +548,7 @@ describe('Client', function () { send: () => Promise.resolve() }; - const Client = proxyquire('../../lib/client.js', { + const Client = proxyquire('../../lib/client', { './request-handler': requestHandlerMock }); diff --git a/test/unit/cloud/certificate-validation-tests.js b/test/unit/cloud/certificate-validation-tests.ts similarity index 100% rename from test/unit/cloud/certificate-validation-tests.js rename to test/unit/cloud/certificate-validation-tests.ts diff --git a/test/unit/concurrent/execute-concurrent-tests.js b/test/unit/concurrent/execute-concurrent-tests.ts similarity index 100% rename from test/unit/concurrent/execute-concurrent-tests.js rename to test/unit/concurrent/execute-concurrent-tests.ts diff --git a/test/unit/connection-tests.js b/test/unit/connection-tests.ts similarity index 100% rename from test/unit/connection-tests.js rename to test/unit/connection-tests.ts diff --git a/test/unit/control-connection-tests.js b/test/unit/control-connection-tests.ts similarity index 99% rename from test/unit/control-connection-tests.js rename to test/unit/control-connection-tests.ts index e4b69016..8b6529fe 100644 --- a/test/unit/control-connection-tests.js +++ b/test/unit/control-connection-tests.ts @@ -19,7 +19,7 @@ const events = require('events'); const proxyquire = require('proxyquire'); const util = require('util'); -const helper = require('../test-helper.js'); +const helper = require('../test-helper'); const ControlConnection = require('../../lib/control-connection'); const Host = require('../../lib/host').Host; const utils = require('../../lib/utils'); diff --git a/test/unit/default-load-balancing-policy-tests.js b/test/unit/default-load-balancing-policy-tests.ts similarity index 100% rename from test/unit/default-load-balancing-policy-tests.js rename to test/unit/default-load-balancing-policy-tests.ts diff --git a/test/unit/dse-gssapi-auth-provider-tests.js b/test/unit/dse-gssapi-auth-provider-tests.ts similarity index 100% rename from test/unit/dse-gssapi-auth-provider-tests.js rename to test/unit/dse-gssapi-auth-provider-tests.ts diff --git a/test/unit/dse-plain-text-auth-provider-tests.js b/test/unit/dse-plain-text-auth-provider-tests.ts similarity index 100% rename from test/unit/dse-plain-text-auth-provider-tests.js rename to test/unit/dse-plain-text-auth-provider-tests.ts diff --git a/test/unit/duration-type-tests.js b/test/unit/duration-type-tests.ts similarity index 100% rename from test/unit/duration-type-tests.js rename to test/unit/duration-type-tests.ts diff --git a/test/unit/encoder-tests.js b/test/unit/encoder-tests.ts similarity index 100% rename from test/unit/encoder-tests.js rename to test/unit/encoder-tests.ts diff --git a/test/unit/error-tests.js b/test/unit/error-tests.ts similarity index 100% rename from test/unit/error-tests.js rename to test/unit/error-tests.ts diff --git a/test/unit/event-debouncer-tests.js b/test/unit/event-debouncer-tests.ts similarity index 100% rename from test/unit/event-debouncer-tests.js rename to test/unit/event-debouncer-tests.ts diff --git a/test/unit/execution-options-tests.js b/test/unit/execution-options-tests.ts similarity index 100% rename from test/unit/execution-options-tests.js rename to test/unit/execution-options-tests.ts diff --git a/test/unit/execution-profile-tests.js b/test/unit/execution-profile-tests.ts similarity index 100% rename from test/unit/execution-profile-tests.js rename to test/unit/execution-profile-tests.ts diff --git a/test/unit/geometry/line-string-tests.js b/test/unit/geometry/line-string-tests.ts similarity index 100% rename from test/unit/geometry/line-string-tests.js rename to test/unit/geometry/line-string-tests.ts diff --git a/test/unit/geometry/point-tests.js b/test/unit/geometry/point-tests.ts similarity index 100% rename from test/unit/geometry/point-tests.js rename to test/unit/geometry/point-tests.ts diff --git a/test/unit/geometry/polygon-tests.js b/test/unit/geometry/polygon-tests.ts similarity index 100% rename from test/unit/geometry/polygon-tests.js rename to test/unit/geometry/polygon-tests.ts diff --git a/test/unit/graph/executor-tests.js b/test/unit/graph/executor-tests.ts similarity index 100% rename from test/unit/graph/executor-tests.js rename to test/unit/graph/executor-tests.ts diff --git a/test/unit/graph/graph-result-tests.js b/test/unit/graph/graph-result-tests.ts similarity index 100% rename from test/unit/graph/graph-result-tests.js rename to test/unit/graph/graph-result-tests.ts diff --git a/test/unit/graph/graphson-tests.js b/test/unit/graph/graphson-tests.ts similarity index 100% rename from test/unit/graph/graphson-tests.js rename to test/unit/graph/graphson-tests.ts diff --git a/test/unit/host-tests.js b/test/unit/host-tests.ts similarity index 99% rename from test/unit/host-tests.js rename to test/unit/host-tests.ts index ccf90e54..6a87ce05 100644 --- a/test/unit/host-tests.js +++ b/test/unit/host-tests.ts @@ -29,7 +29,7 @@ const types = require('../../lib/types'); const clientOptions = require('../../lib/client-options'); const defaultOptions = clientOptions.defaultOptions(); defaultOptions.pooling.coreConnectionsPerHost = clientOptions.coreConnectionsPerHostV3; -const utils = require('../../lib/utils.js'); +const utils = require('../../lib/utils'); const policies = require('../../lib/policies'); const helper = require('../test-helper'); const reconnection = policies.reconnection; diff --git a/test/unit/inet-address-tests.js b/test/unit/inet-address-tests.ts similarity index 100% rename from test/unit/inet-address-tests.js rename to test/unit/inet-address-tests.ts diff --git a/test/unit/insights-client-tests.js b/test/unit/insights-client-tests.ts similarity index 100% rename from test/unit/insights-client-tests.js rename to test/unit/insights-client-tests.ts diff --git a/test/unit/license-tests.js b/test/unit/license-tests.ts similarity index 100% rename from test/unit/license-tests.js rename to test/unit/license-tests.ts diff --git a/test/unit/load-balancing-tests.js b/test/unit/load-balancing-tests.ts similarity index 99% rename from test/unit/load-balancing-tests.js rename to test/unit/load-balancing-tests.ts index 52464928..a91fb5c7 100644 --- a/test/unit/load-balancing-tests.js +++ b/test/unit/load-balancing-tests.ts @@ -16,9 +16,9 @@ 'use strict'; const assert = require('assert'); -const helper = require('../test-helper.js'); +const helper = require('../test-helper'); const errors = require('../../lib/errors'); -const Client = require('../../lib/client.js'); +const Client = require('../../lib/client'); const clientOptions = require('../../lib/client-options'); const { Host, HostMap } = require('../../lib/host'); const types = require('../../lib/types'); diff --git a/test/unit/mapping/cache-tests.js b/test/unit/mapping/cache-tests.ts similarity index 100% rename from test/unit/mapping/cache-tests.js rename to test/unit/mapping/cache-tests.ts diff --git a/test/unit/mapping/mapper-tests.js b/test/unit/mapping/mapper-tests.ts similarity index 100% rename from test/unit/mapping/mapper-tests.js rename to test/unit/mapping/mapper-tests.ts diff --git a/test/unit/mapping/mapper-unit-test-helper.js b/test/unit/mapping/mapper-unit-test-helper.ts similarity index 100% rename from test/unit/mapping/mapper-unit-test-helper.js rename to test/unit/mapping/mapper-unit-test-helper.ts diff --git a/test/unit/mapping/mapping-handler-tests.js b/test/unit/mapping/mapping-handler-tests.ts similarity index 100% rename from test/unit/mapping/mapping-handler-tests.js rename to test/unit/mapping/mapping-handler-tests.ts diff --git a/test/unit/mapping/model-mapper-mutation-tests.js b/test/unit/mapping/model-mapper-mutation-tests.ts similarity index 100% rename from test/unit/mapping/model-mapper-mutation-tests.js rename to test/unit/mapping/model-mapper-mutation-tests.ts diff --git a/test/unit/mapping/model-mapper-select-tests.js b/test/unit/mapping/model-mapper-select-tests.ts similarity index 100% rename from test/unit/mapping/model-mapper-select-tests.js rename to test/unit/mapping/model-mapper-select-tests.ts diff --git a/test/unit/mapping/model-mapping-info-tests.js b/test/unit/mapping/model-mapping-info-tests.ts similarity index 100% rename from test/unit/mapping/model-mapping-info-tests.js rename to test/unit/mapping/model-mapping-info-tests.ts diff --git a/test/unit/mapping/result-mapper-tests.js b/test/unit/mapping/result-mapper-tests.ts similarity index 100% rename from test/unit/mapping/result-mapper-tests.js rename to test/unit/mapping/result-mapper-tests.ts diff --git a/test/unit/mapping/result-tests.js b/test/unit/mapping/result-tests.ts similarity index 100% rename from test/unit/mapping/result-tests.js rename to test/unit/mapping/result-tests.ts diff --git a/test/unit/mapping/table-mappings-tests.js b/test/unit/mapping/table-mappings-tests.ts similarity index 100% rename from test/unit/mapping/table-mappings-tests.js rename to test/unit/mapping/table-mappings-tests.ts diff --git a/test/unit/mapping/tree-tests.js b/test/unit/mapping/tree-tests.ts similarity index 100% rename from test/unit/mapping/tree-tests.js rename to test/unit/mapping/tree-tests.ts diff --git a/test/unit/metadata-tests.js b/test/unit/metadata-tests.ts similarity index 99% rename from test/unit/metadata-tests.js rename to test/unit/metadata-tests.ts index f15aa59e..3c62f7c7 100644 --- a/test/unit/metadata-tests.js +++ b/test/unit/metadata-tests.ts @@ -20,9 +20,9 @@ const { assert } = require('chai'); const sinon = require('sinon'); const events = require('events'); -const helper = require('../test-helper.js'); -const clientOptions = require('../../lib/client-options.js'); -const Host = require('../../lib/host.js').Host; +const helper = require('../test-helper'); +const clientOptions = require('../../lib/client-options'); +const Host = require('../../lib/host').Host; const HostMap = require('../../lib/host').HostMap; const Metadata = require('../../lib/metadata'); const TableMetadata = require('../../lib/metadata/table-metadata'); diff --git a/test/unit/mutable-long-tests.js b/test/unit/mutable-long-tests.ts similarity index 100% rename from test/unit/mutable-long-tests.js rename to test/unit/mutable-long-tests.ts diff --git a/test/unit/parser-tests.js b/test/unit/parser-tests.ts similarity index 100% rename from test/unit/parser-tests.js rename to test/unit/parser-tests.ts diff --git a/test/unit/prepare-handler-tests.js b/test/unit/prepare-handler-tests.ts similarity index 100% rename from test/unit/prepare-handler-tests.js rename to test/unit/prepare-handler-tests.ts diff --git a/test/unit/protocol-stream-tests.js b/test/unit/protocol-stream-tests.ts similarity index 100% rename from test/unit/protocol-stream-tests.js rename to test/unit/protocol-stream-tests.ts diff --git a/test/unit/protocol-version-tests.js b/test/unit/protocol-version-tests.ts similarity index 100% rename from test/unit/protocol-version-tests.js rename to test/unit/protocol-version-tests.ts diff --git a/test/unit/reconnection-test.js b/test/unit/reconnection-test.ts similarity index 100% rename from test/unit/reconnection-test.js rename to test/unit/reconnection-test.ts diff --git a/test/unit/request-handler-tests.js b/test/unit/request-handler-tests.ts similarity index 100% rename from test/unit/request-handler-tests.js rename to test/unit/request-handler-tests.ts diff --git a/test/unit/requests-test.js b/test/unit/requests-test.ts similarity index 100% rename from test/unit/requests-test.js rename to test/unit/requests-test.ts diff --git a/test/unit/result-set-tests.js b/test/unit/result-set-tests.ts similarity index 100% rename from test/unit/result-set-tests.js rename to test/unit/result-set-tests.ts diff --git a/test/unit/retry-policy-tests.js b/test/unit/retry-policy-tests.ts similarity index 100% rename from test/unit/retry-policy-tests.js rename to test/unit/retry-policy-tests.ts diff --git a/test/unit/search/date-range-tests.js b/test/unit/search/date-range-tests.ts similarity index 100% rename from test/unit/search/date-range-tests.js rename to test/unit/search/date-range-tests.ts diff --git a/test/unit/speculative-execution-tests.js b/test/unit/speculative-execution-tests.ts similarity index 100% rename from test/unit/speculative-execution-tests.js rename to test/unit/speculative-execution-tests.ts diff --git a/test/unit/stream-id-stack-tests.js b/test/unit/stream-id-stack-tests.ts similarity index 100% rename from test/unit/stream-id-stack-tests.js rename to test/unit/stream-id-stack-tests.ts diff --git a/test/unit/timestamp-tests.js b/test/unit/timestamp-tests.ts similarity index 100% rename from test/unit/timestamp-tests.js rename to test/unit/timestamp-tests.ts diff --git a/test/unit/token-tests.js b/test/unit/token-tests.ts similarity index 100% rename from test/unit/token-tests.js rename to test/unit/token-tests.ts diff --git a/test/unit/tokenizer-tests.js b/test/unit/tokenizer-tests.ts similarity index 100% rename from test/unit/tokenizer-tests.js rename to test/unit/tokenizer-tests.ts diff --git a/test/unit/tracker-tests.js b/test/unit/tracker-tests.ts similarity index 100% rename from test/unit/tracker-tests.js rename to test/unit/tracker-tests.ts diff --git a/test/unit/utils-tests.js b/test/unit/utils-tests.ts similarity index 100% rename from test/unit/utils-tests.js rename to test/unit/utils-tests.ts diff --git a/test/unit/uuid-tests.js b/test/unit/uuid-tests.ts similarity index 100% rename from test/unit/uuid-tests.js rename to test/unit/uuid-tests.ts diff --git a/test/unit/version-number-tests.js b/test/unit/version-number-tests.ts similarity index 100% rename from test/unit/version-number-tests.js rename to test/unit/version-number-tests.ts From add7bcc847f6dfd01ba98016ce6b1ca5e6edcaae Mon Sep 17 00:00:00 2001 From: Jane He Date: Wed, 22 Jan 2025 21:24:17 +0800 Subject: [PATCH 06/19] fix imports --- lib/auth/base-dse-authenticator.ts | 2 +- lib/auth/dse-gssapi-auth-provider.ts | 4 ++-- lib/auth/dse-plain-text-auth-provider.ts | 4 ++-- lib/auth/index.ts | 2 +- lib/auth/no-auth-provider.ts | 4 ++-- lib/auth/plain-text-auth-provider.ts | 2 +- lib/datastax/cloud/index.ts | 2 +- lib/insights-client.ts | 2 +- package.json | 4 ---- test/integration/short/auth/dse-gssapi-auth-provider-tests.ts | 2 +- .../short/auth/dse-plain-text-auth-provider-tests.ts | 2 +- test/integration/short/auth/proxy-authentication-test.ts | 4 ++-- test/integration/short/client-pool-tests.ts | 2 +- test/unit/basic-tests.ts | 2 +- test/unit/dse-gssapi-auth-provider-tests.ts | 2 +- test/unit/dse-plain-text-auth-provider-tests.ts | 4 ++-- 16 files changed, 20 insertions(+), 24 deletions(-) diff --git a/lib/auth/base-dse-authenticator.ts b/lib/auth/base-dse-authenticator.ts index 7d356328..e1d3bc4b 100644 --- a/lib/auth/base-dse-authenticator.ts +++ b/lib/auth/base-dse-authenticator.ts @@ -15,7 +15,7 @@ */ 'use strict'; const util = require('util'); -const { Authenticator } = require('./provider'); +import { Authenticator } from './provider'; const dseAuthenticatorName = 'com.datastax.bdp.cassandra.auth.DseAuthenticator'; diff --git a/lib/auth/dse-gssapi-auth-provider.ts b/lib/auth/dse-gssapi-auth-provider.ts index 790241ed..62446a4d 100644 --- a/lib/auth/dse-gssapi-auth-provider.ts +++ b/lib/auth/dse-gssapi-auth-provider.ts @@ -16,8 +16,8 @@ 'use strict'; const util = require('util'); const { AuthProvider } = require('./provider'); -const BaseDseAuthenticator = require('./base-dse-authenticator'); -const GssapiClient = require('./gssapi-client'); +import BaseDseAuthenticator from './base-dse-authenticator'; +import GssapiClient from './gssapi-client'; const dns = require('dns'); const utils = require('../utils'); diff --git a/lib/auth/dse-plain-text-auth-provider.ts b/lib/auth/dse-plain-text-auth-provider.ts index ce48444e..fc040a58 100644 --- a/lib/auth/dse-plain-text-auth-provider.ts +++ b/lib/auth/dse-plain-text-auth-provider.ts @@ -15,8 +15,8 @@ */ 'use strict'; const util = require('util'); -const { AuthProvider } = require('./provider'); -const BaseDseAuthenticator = require('./base-dse-authenticator'); +import { AuthProvider } from './provider'; +import BaseDseAuthenticator from './base-dse-authenticator'; const utils = require('../utils'); const mechanism = utils.allocBufferFromString('PLAIN'); diff --git a/lib/auth/index.ts b/lib/auth/index.ts index a6e9f5d9..e9b0dabc 100644 --- a/lib/auth/index.ts +++ b/lib/auth/index.ts @@ -29,7 +29,7 @@ import DseGssapiAuthProvider from './dse-gssapi-auth-provider'; import DsePlainTextAuthProvider from './dse-plain-text-auth-provider'; import NoAuthProvider from './no-auth-provider'; -export default { +export { Authenticator, AuthProvider, DseGssapiAuthProvider, diff --git a/lib/auth/no-auth-provider.ts b/lib/auth/no-auth-provider.ts index a9a3ba06..414b6852 100644 --- a/lib/auth/no-auth-provider.ts +++ b/lib/auth/no-auth-provider.ts @@ -16,8 +16,8 @@ 'use strict'; -const { AuthProvider, Authenticator } = require('./provider'); -const { PlainTextAuthenticator } = require('./plain-text-auth-provider'); +import { AuthProvider, Authenticator } from './provider'; +import { PlainTextAuthenticator } from './plain-text-auth-provider'; const errors = require('../errors'); const dseAuthenticator = 'com.datastax.bdp.cassandra.auth.DseAuthenticator'; diff --git a/lib/auth/plain-text-auth-provider.ts b/lib/auth/plain-text-auth-provider.ts index 07938f57..e7d20c08 100644 --- a/lib/auth/plain-text-auth-provider.ts +++ b/lib/auth/plain-text-auth-provider.ts @@ -16,7 +16,7 @@ 'use strict'; const util = require('util'); -const provider = require('./provider'); +import * as provider from './provider'; const utils = require('../utils'); const AuthProvider = provider.AuthProvider; const Authenticator = provider.Authenticator; diff --git a/lib/datastax/cloud/index.ts b/lib/datastax/cloud/index.ts index e44a4c7b..bebaf569 100644 --- a/lib/datastax/cloud/index.ts +++ b/lib/datastax/cloud/index.ts @@ -24,7 +24,7 @@ const { URL } = require('url'); const errors = require('../../errors'); const utils = require('../../utils'); -const { DsePlainTextAuthProvider, NoAuthProvider } = require('../../auth'); +import { DsePlainTextAuthProvider, NoAuthProvider } from '../../auth'; // Use the callback-based method fs.readFile() instead of fs.promises as we have to support Node.js 8+ const readFile = util.promisify(fs.readFile); diff --git a/lib/insights-client.ts b/lib/insights-client.ts index 4c9207d4..02b18834 100644 --- a/lib/insights-client.ts +++ b/lib/insights-client.ts @@ -26,7 +26,7 @@ const requests = require('./requests'); const { ExecutionOptions } = require('./execution-options'); const packageInfo = require('../package.json'); const VersionNumber = require('./types/version-number'); -const { NoAuthProvider } = require('./auth'); +import { NoAuthProvider } from './auth'; let kerberosModule; diff --git a/package.json b/package.json index d3788fd0..7422c6d6 100644 --- a/package.json +++ b/package.json @@ -34,12 +34,8 @@ "proxyquire": "~2.1.3", "sinon": "~15.2.0", "temp": ">= 0.8.3", -<<<<<<< HEAD "ts-mocha": "^10.0.0", "typescript": "^5.7.3" -======= - "ts-mocha": "^10.0.0" ->>>>>>> 2628567c85dc014fe3a29fa989d11a92dac78f67 }, "repository": { "type": "git", diff --git a/test/integration/short/auth/dse-gssapi-auth-provider-tests.ts b/test/integration/short/auth/dse-gssapi-auth-provider-tests.ts index 327d1d11..82e49d7a 100644 --- a/test/integration/short/auth/dse-gssapi-auth-provider-tests.ts +++ b/test/integration/short/auth/dse-gssapi-auth-provider-tests.ts @@ -16,7 +16,7 @@ 'use strict'; const assert = require('assert'); const helper = require('../../../test-helper'); -const DseGssapiAuthProvider = require('../../../../lib/auth/dse-gssapi-auth-provider'); +import DseGssapiAuthProvider from '../../../../lib/auth/dse-gssapi-auth-provider'; const Client = require('../../../../lib/client'); const errors = require('../../../../lib/errors'); const ads = helper.ads; diff --git a/test/integration/short/auth/dse-plain-text-auth-provider-tests.ts b/test/integration/short/auth/dse-plain-text-auth-provider-tests.ts index 202ffda9..2f1c0aa3 100644 --- a/test/integration/short/auth/dse-plain-text-auth-provider-tests.ts +++ b/test/integration/short/auth/dse-plain-text-auth-provider-tests.ts @@ -16,7 +16,7 @@ 'use strict'; const { assert } = require('chai'); const helper = require('../../../test-helper'); -const DsePlainTextAuthProvider = require('../../../../lib/auth/dse-plain-text-auth-provider'); +import DsePlainTextAuthProvider from '../../../../lib/auth/dse-plain-text-auth-provider'; const Client = require('../../../../lib/client'); const vdescribe = helper.vdescribe; diff --git a/test/integration/short/auth/proxy-authentication-test.ts b/test/integration/short/auth/proxy-authentication-test.ts index cd6c9ba3..f751299c 100644 --- a/test/integration/short/auth/proxy-authentication-test.ts +++ b/test/integration/short/auth/proxy-authentication-test.ts @@ -16,8 +16,8 @@ 'use strict'; const assert = require('assert'); const helper = require('../../../test-helper'); -const DsePlainTextAuthProvider = require('../../../../lib/auth/dse-plain-text-auth-provider'); -const DseGssapiAuthProvider = require('../../../../lib/auth/dse-gssapi-auth-provider'); +import DsePlainTextAuthProvider from '../../../../lib/auth/dse-plain-text-auth-provider'; +import DseGssapiAuthProvider from '../../../../lib/auth/dse-gssapi-auth-provider'; const Client = require('../../../../lib/client'); const utils = require('../../../../lib/utils'); const errors = require('../../../../lib/errors'); diff --git a/test/integration/short/client-pool-tests.ts b/test/integration/short/client-pool-tests.ts index 39c51785..6e900924 100644 --- a/test/integration/short/client-pool-tests.ts +++ b/test/integration/short/client-pool-tests.ts @@ -28,7 +28,7 @@ const types = require('../../../lib/types'); const policies = require('../../../lib/policies'); const RoundRobinPolicy = require('../../../lib/policies/load-balancing').RoundRobinPolicy; const Murmur3Tokenizer = require('../../../lib/tokenizer').Murmur3Tokenizer; -const { PlainTextAuthProvider } = require('../../../lib/auth'); +import { PlainTextAuthProvider } from '../../../lib/auth'; const ConstantSpeculativeExecutionPolicy = policies.speculativeExecution.ConstantSpeculativeExecutionPolicy; const OrderedLoadBalancingPolicy = helper.OrderedLoadBalancingPolicy; const vit = helper.vit; diff --git a/test/unit/basic-tests.ts b/test/unit/basic-tests.ts index 94ea8c03..067448c2 100644 --- a/test/unit/basic-tests.ts +++ b/test/unit/basic-tests.ts @@ -22,7 +22,7 @@ const events = require('events'); const Client = require('../../lib/client'); const clientOptions = require('../../lib/client-options'); -const auth = require('../../lib/auth'); +import * as auth from '../../lib/auth'; const types = require('../../lib/types'); const { dataTypes } = types; const loadBalancing = require('../../lib/policies/load-balancing'); diff --git a/test/unit/dse-gssapi-auth-provider-tests.ts b/test/unit/dse-gssapi-auth-provider-tests.ts index 9af2bcdf..05ec1eee 100644 --- a/test/unit/dse-gssapi-auth-provider-tests.ts +++ b/test/unit/dse-gssapi-auth-provider-tests.ts @@ -15,7 +15,7 @@ */ 'use strict'; const assert = require('assert'); -const DseGssapiAuthProvider = require('../../lib/auth/dse-gssapi-auth-provider'); +import DseGssapiAuthProvider from '../../lib/auth/dse-gssapi-auth-provider'; const helper = require('../test-helper'); const utils = require('../../lib/utils'); const cDescribe = helper.conditionalDescribe(helper.requireOptional('kerberos'), 'kerberos required to run'); diff --git a/test/unit/dse-plain-text-auth-provider-tests.ts b/test/unit/dse-plain-text-auth-provider-tests.ts index 50fa6758..22adc98a 100644 --- a/test/unit/dse-plain-text-auth-provider-tests.ts +++ b/test/unit/dse-plain-text-auth-provider-tests.ts @@ -15,8 +15,8 @@ */ 'use strict'; const assert = require('assert'); -const Authenticator = require('../../lib/auth/provider').Authenticator; -const DsePlainTextAuthProvider = require('../../lib/auth/dse-plain-text-auth-provider'); +import { Authenticator } from '../../lib/auth/provider'; +import DsePlainTextAuthProvider from '../../lib/auth/dse-plain-text-auth-provider'; describe('DsePlainTextAuthProvider', function () { describe('#newAuthenticator()', function () { From 965b45693f3579cd5d552b5d437a8ff0ad626845 Mon Sep 17 00:00:00 2001 From: Jane He Date: Thu, 23 Jan 2025 14:55:17 +0800 Subject: [PATCH 07/19] for private publish --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 7422c6d6..af2f5f68 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { - "name": "cassandra-driver", - "version": "4.7.2", + "name": "@SiyaoIsHiding/cassandra-driver", + "version": "0.0.4", "description": "DataStax Node.js Driver for Apache Cassandra", "author": "DataStax", - "main": "index.js", - "types": "dist/cassandra-driver.d.ts", + "main": "out/index.js", + "types": "out/index.d.ts", "keywords": [ "cassandra", "cql", From 48ec9730e294e2f20a3ced04c682042571e1e7f9 Mon Sep 17 00:00:00 2001 From: Jane He Date: Fri, 7 Feb 2025 17:32:04 +0800 Subject: [PATCH 08/19] can work with both esm and cjs syntax --- index.d.ts | 414 ---------------------------------------------- index.ts | 74 +++++---- lib/auth/index.ts | 28 ++-- package.json | 5 +- 4 files changed, 63 insertions(+), 458 deletions(-) delete mode 100644 index.d.ts diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index cf44d76e..00000000 --- a/index.d.ts +++ /dev/null @@ -1,414 +0,0 @@ -/* - * Copyright DataStax, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import * as events from 'events'; -import * as tls from 'tls'; -import { URL } from 'url'; -import { auth } from './lib/auth'; -import { policies } from './lib/policies'; -import { types } from './lib/types'; -import { metrics } from './lib/metrics'; -import { tracker } from './lib/tracker'; -import { metadata } from './lib/metadata'; -import { datastax } from './lib/datastax/'; -import Long = types.Long; -import Uuid = types.Uuid; -import graph = datastax.graph; - -// Export imported submodules -export { concurrent } from './lib/concurrent'; -export { mapping } from './lib/mapping'; -export { geometry } from './lib/geometry'; -export { auth, datastax, metadata, metrics, policies, tracker, types }; - -export const version: number; - -export function defaultOptions(): ClientOptions; - -export type ValueCallback = (err: Error, val: T) => void; -export type EmptyCallback = (err: Error) => void; -export type ArrayOrObject = any[]|{[key: string]: any}; - -export class Client extends events.EventEmitter { - hosts: HostMap; - keyspace: string; - metadata: metadata.Metadata; - metrics: metrics.ClientMetrics; - - constructor(options: DseClientOptions); - - connect(): Promise; - - connect(callback: EmptyCallback): void; - - execute(query: string, params?: ArrayOrObject, options?: QueryOptions): Promise; - - execute(query: string, params: ArrayOrObject, options: QueryOptions, callback: ValueCallback): void; - - execute(query: string, params: ArrayOrObject, callback: ValueCallback): void; - - execute(query: string, callback: ValueCallback): void; - - executeGraph( - traversal: string, - parameters: { [name: string]: any } | undefined, - options: GraphQueryOptions, - callback: ValueCallback): void; - - executeGraph( - traversal: string, - parameters: { [name: string]: any } | undefined, - callback: ValueCallback): void; - - executeGraph(traversal: string, callback: ValueCallback): void; - - executeGraph( - traversal: string, - parameters?: { [name: string]: any }, - options?: GraphQueryOptions): Promise; - - eachRow(query: string, - params: ArrayOrObject, - options: QueryOptions, - rowCallback: (n: number, row: types.Row) => void, - callback?: ValueCallback): void; - - eachRow(query: string, - params: ArrayOrObject, - rowCallback: (n: number, row: types.Row) => void, - callback?: ValueCallback): void; - - eachRow(query: string, - rowCallback: (n: number, row: types.Row) => void): void; - - stream(query: string, params?: ArrayOrObject, options?: QueryOptions, callback?: EmptyCallback): events.EventEmitter; - - batch( - queries: Array, - options?: QueryOptions): Promise; - - batch( - queries: Array, - options: QueryOptions, - callback: ValueCallback): void; - - batch( - queries: Array, - callback: ValueCallback): void; - - shutdown(): Promise; - - shutdown(callback: EmptyCallback): void; - - getReplicas(keyspace: string, token: Buffer): Host[]; - - getState(): metadata.ClientState; -} - -export interface HostMap extends events.EventEmitter { - length: number; - - forEach(callback: (value: Host, key: string) => void): void; - - get(key: string): Host; - - keys(): string[]; - - values(): Host[]; -} - -export interface Host extends events.EventEmitter { - address: string; - cassandraVersion: string; - datacenter: string; - rack: string; - tokens: string[]; - hostId: types.Uuid; - - canBeConsideredAsUp(): boolean; - - getCassandraVersion(): number[]; - - isUp(): boolean; -} - -export interface ExecutionOptions { - getCaptureStackTrace(): boolean; - - getConsistency(): types.consistencies; - - getCustomPayload(): { [key: string]: any }; - - getFetchSize(): number; - - getFixedHost(): Host; - - getHints(): string[] | string[][]; - - isAutoPage(): boolean; - - isBatchCounter(): boolean; - - isBatchLogged(): boolean; - - isIdempotent(): boolean; - - isPrepared(): boolean; - - isQueryTracing(): boolean; - - getKeyspace(): string; - - getLoadBalancingPolicy(): policies.loadBalancing.LoadBalancingPolicy; - - getPageState(): Buffer; - - getRawQueryOptions(): QueryOptions; - - getReadTimeout(): number; - - getRetryPolicy(): policies.retry.RetryPolicy; - - getRoutingKey(): Buffer | Buffer[]; - - getSerialConsistency(): types.consistencies; - - getTimestamp(): number | Long | undefined | null; - - setHints(hints: string[]): void; -} - -export interface ClientOptions { - contactPoints?: string[]; - localDataCenter?: string; - keyspace?: string; - authProvider?: auth.AuthProvider; - credentials?: { - username: string; - password: string; - } - - cloud?: { - secureConnectBundle: string | URL; - }; - - encoding?: { - map?: Function; - set?: Function; - copyBuffer?: boolean; - useUndefinedAsUnset?: boolean; - useBigIntAsLong?: boolean; - useBigIntAsVarint?: boolean; - }; - isMetadataSyncEnabled?: boolean; - maxPrepared?: number; - metrics?: metrics.ClientMetrics; - policies?: { - addressResolution?: policies.addressResolution.AddressTranslator; - loadBalancing?: policies.loadBalancing.LoadBalancingPolicy; - reconnection?: policies.reconnection.ReconnectionPolicy; - retry?: policies.retry.RetryPolicy; - speculativeExecution?: policies.speculativeExecution.SpeculativeExecutionPolicy; - timestampGeneration?: policies.timestampGeneration.TimestampGenerator; - }; - pooling?: { - coreConnectionsPerHost?: { [key: number]: number; }; - heartBeatInterval?: number; - maxRequestsPerConnection?: number; - warmup?: boolean; - }; - prepareOnAllHosts?: boolean; - profiles?: ExecutionProfile[]; - protocolOptions?: { - maxSchemaAgreementWaitSeconds?: number; - maxVersion?: number; - noCompact?: boolean; - port?: number; - }; - promiseFactory?: (handler: (callback: (err: Error, result?: any) => void) => void) => Promise; - queryOptions?: QueryOptions; - refreshSchemaDelay?: number; - rePrepareOnUp?: boolean; - requestTracker?: tracker.RequestTracker; - socketOptions?: { - coalescingThreshold?: number; - connectTimeout?: number; - defunctReadTimeoutThreshold?: number; - keepAlive?: boolean; - keepAliveDelay?: number; - readTimeout?: number; - tcpNoDelay?: boolean; - }; - sslOptions?: tls.ConnectionOptions; -} - -export interface QueryOptions { - autoPage?: boolean; - captureStackTrace?: boolean; - consistency?: number; - counter?: boolean; - customPayload?: any; - executionProfile?: string | ExecutionProfile; - fetchSize?: number; - hints?: string[] | string[][]; - host?: Host; - isIdempotent?: boolean; - keyspace?: string; - logged?: boolean; - pageState?: Buffer | string; - prepare?: boolean; - readTimeout?: number; - retry?: policies.retry.RetryPolicy; - routingIndexes?: number[]; - routingKey?: Buffer | Buffer[]; - routingNames?: string[]; - serialConsistency?: number; - timestamp?: number | Long; - traceQuery?: boolean; -} - -export interface DseClientOptions extends ClientOptions { - id?: Uuid; - applicationName?: string; - applicationVersion?: string; - monitorReporting?: { enabled?: boolean }; - graphOptions?: GraphOptions; -} - -export interface GraphQueryOptions extends QueryOptions { - graphLanguage?: string; - graphName?: string; - graphReadConsistency?: types.consistencies; - graphSource?: string; - graphWriteConsistency?: types.consistencies; -} - -export type GraphOptions = { - language?: string; - name?: string; - readConsistency?: types.consistencies; - readTimeout?: number; - source?: string; - writeConsistency?: types.consistencies; -}; - -export class ExecutionProfile { - consistency?: types.consistencies; - loadBalancing?: policies.loadBalancing.LoadBalancingPolicy; - name: string; - readTimeout?: number; - retry?: policies.retry.RetryPolicy; - serialConsistency?: types.consistencies; - graphOptions?: { - name?: string; - language?: string; - source?: string; - readConsistency?: types.consistencies; - writeConsistency?: types.consistencies; - }; - - constructor(name: string, options: { - consistency?: types.consistencies; - loadBalancing?: policies.loadBalancing.LoadBalancingPolicy; - readTimeout?: number; - retry?: policies.retry.RetryPolicy; - serialConsistency?: types.consistencies; - graphOptions?: { - name?: string; - language?: string; - source?: string; - readConsistency?: types.consistencies; - writeConsistency?: types.consistencies; - }; - }); -} - -export namespace errors { - class ArgumentError extends DriverError { - constructor(message: string); - } - - class AuthenticationError extends DriverError { - constructor(message: string); - } - - class BusyConnectionError extends DriverError { - constructor(address: string, maxRequestsPerConnection: number, connectionLength: number); - } - - abstract class DriverError extends Error { - info: string; - - constructor(message: string, constructor?: any); - } - - class DriverInternalError extends DriverError { - constructor(message: string); - } - - class NoHostAvailableError extends DriverError { - innerErrors: any; - - constructor(innerErrors: any, message?: string); - } - - class NotSupportedError extends DriverError { - constructor(message: string); - } - - class OperationTimedOutError extends DriverError { - host?: string; - - constructor(message: string, host?: string); - } - - class ResponseError extends DriverError { - code: number; - - constructor(code: number, message: string); - } -} - -export namespace token { - interface Token { - compare(other: Token): number; - - equals(other: Token): boolean; - - getType(): { code: types.dataTypes, info: any }; - - getValue(): any; - } - - interface TokenRange { - start: Token; - end: Token; - - compare(other: TokenRange): number; - - contains(token: Token): boolean; - - equals(other: TokenRange): boolean; - - isEmpty(): boolean; - - isWrappedAround(): boolean; - - splitEvenly(numberOfSplits: number): TokenRange[]; - - unwrap(): TokenRange[]; - } -} \ No newline at end of file diff --git a/index.ts b/index.ts index 2acf5ccb..1fed3ca3 100644 --- a/index.ts +++ b/index.ts @@ -15,34 +15,50 @@ */ 'use strict'; const clientOptions = require('./lib/client-options'); -exports.Client = require('./lib/client'); -exports.ExecutionProfile = require('./lib/execution-profile').ExecutionProfile; -exports.ExecutionOptions = require('./lib/execution-options').ExecutionOptions; -exports.types = require('./lib/types'); -exports.errors = require('./lib/errors'); -exports.policies = require('./lib/policies'); -exports.auth = require('./lib/auth'); -exports.mapping = require('./lib/mapping'); -exports.tracker = require('./lib/tracker'); -exports.metrics = require('./lib/metrics'); -exports.concurrent = require('./lib/concurrent'); - +const Client = require('./lib/client'); +const ExecutionProfile = require('./lib/execution-profile').ExecutionProfile; +const ExecutionOptions = require('./lib/execution-options').ExecutionOptions; +const types = require('./lib/types'); +const errors = require('./lib/errors'); +const policies = require('./lib/policies'); +import * as auth from './lib/auth'; +const mapping = require('./lib/mapping'); +const tracker = require('./lib/tracker'); +const metrics = require('./lib/metrics'); +const concurrent = require('./lib/concurrent'); const token = require('./lib/token'); -exports.token = { - Token: token.Token, - TokenRange: token.TokenRange -}; const Metadata = require('./lib/metadata'); -exports.metadata = { - Metadata: Metadata -}; -exports.Encoder = require('./lib/encoder'); -exports.geometry = require('./lib/geometry'); -exports.datastax = require('./lib/datastax'); -/** - * Returns a new instance of the default [options]{@link ClientOptions} used by the driver. - */ -exports.defaultOptions = function () { - return clientOptions.defaultOptions(); -}; -exports.version = require('./package.json').version; \ No newline at end of file +const Encoder = require('./lib/encoder'); +const geometry = require('./lib/geometry'); +const datastax = require('./lib/datastax'); + +export default { + Client, + ExecutionProfile, + ExecutionOptions, + types, + errors, + policies, + auth, + mapping, + tracker, + metrics, + concurrent, + token: { + Token: token.Token, + TokenRange: token.TokenRange + }, + metadata: { + Metadata: Metadata + }, + Encoder, + geometry, + datastax, + /** + * Returns a new instance of the default [options]{@link ClientOptions} used by the driver. + */ + defaultOptions: function () { + return clientOptions.defaultOptions(); + }, + version: require('./package.json').version +}; \ No newline at end of file diff --git a/lib/auth/index.ts b/lib/auth/index.ts index e9b0dabc..9d69d7c9 100644 --- a/lib/auth/index.ts +++ b/lib/auth/index.ts @@ -23,17 +23,19 @@ * @module auth */ -import { Authenticator, AuthProvider } from './provider'; -import { PlainTextAuthProvider } from './plain-text-auth-provider'; -import DseGssapiAuthProvider from './dse-gssapi-auth-provider'; -import DsePlainTextAuthProvider from './dse-plain-text-auth-provider'; -import NoAuthProvider from './no-auth-provider'; +// import { Authenticator, AuthProvider } from './provider'; +// import { PlainTextAuthProvider } from './plain-text-auth-provider'; +// import DseGssapiAuthProvider from './dse-gssapi-auth-provider'; +// import DsePlainTextAuthProvider from './dse-plain-text-auth-provider'; +// import NoAuthProvider from './no-auth-provider'; -export { - Authenticator, - AuthProvider, - DseGssapiAuthProvider, - DsePlainTextAuthProvider, - NoAuthProvider, - PlainTextAuthProvider -}; +// export { +// Authenticator, +// AuthProvider, +// DseGssapiAuthProvider, +// DsePlainTextAuthProvider, +// NoAuthProvider, +// PlainTextAuthProvider +// }; + +export * from './provider'; diff --git a/package.json b/package.json index af2f5f68..a341b3fb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@SiyaoIsHiding/cassandra-driver", - "version": "0.0.4", + "version": "0.0.8", "description": "DataStax Node.js Driver for Apache Cassandra", "author": "DataStax", "main": "out/index.js", @@ -53,7 +53,8 @@ "ci_appveyor": ".\\\"node_modules/.bin/mocha\" test/unit test/integration/short --recursive -R mocha-appveyor-reporter --exit", "ci_unit_appveyor": ".\\\"node_modules/.bin/mocha\" test/unit --recursive -R mocha-appveyor-reporter --exit", "server_api": "./node_modules/.bin/mocha test/integration/short -g '@SERVER_API' --recursive --exit", - "eslint": "eslint lib test" + "eslint": "eslint lib test", + "test-ts": "npx ts-mocha test/unit test/integration/short --extension .ts --recursive --exit" }, "engines": { "node": ">=16" From c2767799d3003a9dff3993dee62349430e5bd23a Mon Sep 17 00:00:00 2001 From: janehe Date: Tue, 11 Feb 2025 21:17:08 -0800 Subject: [PATCH 09/19] run ts2esm. Still need to change export to export default {...} --- index.ts | 31 +++-- lib/auth/base-dse-authenticator.ts | 4 +- lib/auth/dse-gssapi-auth-provider.ts | 13 +- lib/auth/dse-plain-text-auth-provider.ts | 9 +- lib/auth/gssapi-client.ts | 5 +- lib/auth/index.ts | 2 +- lib/auth/no-auth-provider.ts | 7 +- lib/auth/plain-text-auth-provider.ts | 7 +- lib/client-options.ts | 17 ++- lib/client.ts | 49 +++---- lib/concurrent/index.ts | 5 +- lib/connection.ts | 34 +++-- lib/control-connection.ts | 30 ++--- lib/datastax/cloud/index.ts | 25 ++-- lib/datastax/graph/complex-type-helper.ts | 11 +- lib/datastax/graph/custom-type-serializers.ts | 16 +-- lib/datastax/graph/graph-executor.ts | 16 +-- lib/datastax/graph/graph-serializer.ts | 14 +- lib/datastax/graph/index.ts | 38 +----- lib/datastax/graph/options.ts | 17 +-- lib/datastax/graph/result-set.ts | 6 +- lib/datastax/graph/structure.ts | 14 +- lib/datastax/graph/type-serializers.ts | 29 +---- lib/datastax/graph/wrappers.ts | 7 +- lib/datastax/search/date-range.ts | 7 +- lib/datastax/search/index.ts | 5 +- lib/encoder.ts | 18 +-- lib/errors.ts | 4 +- lib/execution-options.ts | 12 +- lib/execution-profile.ts | 14 +- lib/geometry/geometry.ts | 2 +- lib/geometry/line-string.ts | 11 +- lib/geometry/point.ts | 9 +- lib/geometry/polygon.ts | 13 +- lib/host-connection-pool.ts | 19 ++- lib/host.ts | 22 +--- lib/insights-client.ts | 25 ++-- lib/mapping/cache.ts | 5 +- lib/mapping/doc-info-adapter.ts | 7 +- lib/mapping/index.ts | 2 +- lib/mapping/mapper.ts | 38 ++---- lib/mapping/mapping-handler.ts | 20 ++- lib/mapping/model-batch-item.ts | 7 +- lib/mapping/model-batch-mapper.ts | 7 +- lib/mapping/model-mapper.ts | 5 +- lib/mapping/model-mapping-info.ts | 5 +- lib/mapping/object-selector.ts | 2 +- lib/mapping/q.ts | 3 +- lib/mapping/query-generator.ts | 9 +- lib/mapping/result-mapper.ts | 9 +- lib/mapping/result.ts | 7 +- lib/mapping/tree.ts | 5 +- lib/metadata/aggregate.ts | 2 +- lib/metadata/client-state.ts | 8 +- lib/metadata/data-collection.ts | 8 +- lib/metadata/event-debouncer.ts | 11 +- lib/metadata/index.ts | 32 ++--- lib/metadata/materialized-view.ts | 8 +- lib/metadata/schema-function.ts | 2 +- lib/metadata/schema-index.ts | 10 +- lib/metadata/schema-parser.ts | 22 ++-- lib/metadata/table-metadata.ts | 7 +- lib/metrics/client-metrics.ts | 2 +- lib/metrics/default-metrics.ts | 7 +- lib/metrics/index.ts | 15 +-- lib/operation-state.ts | 12 +- lib/policies/address-resolution.ts | 8 +- lib/policies/load-balancing.ts | 24 +--- lib/policies/reconnection.ts | 3 +- lib/policies/retry.ts | 4 +- lib/policies/speculative-execution.ts | 6 +- lib/policies/timestamp-generation.ts | 9 +- lib/prepare-handler.ts | 12 +- lib/promise-utils.ts | 14 +- lib/readers.ts | 12 +- lib/request-execution.ts | 17 ++- lib/request-handler.ts | 16 +-- lib/requests.ts | 15 +-- lib/stream-id-stack.ts | 7 +- lib/streams.ts | 14 +- lib/token.ts | 7 +- lib/tokenizer.ts | 10 +- lib/tracker/request-logger.ts | 12 +- lib/tracker/request-tracker.ts | 2 +- lib/types/big-decimal.ts | 8 +- lib/types/duration.ts | 10 +- lib/types/index.ts | 23 ++-- lib/types/inet-address.ts | 6 +- lib/types/integer.ts | 8 +- lib/types/local-date.ts | 8 +- lib/types/local-time.ts | 9 +- lib/types/mutable-long.ts | 7 +- lib/types/protocol-version.ts | 8 +- lib/types/result-set.ts | 8 +- lib/types/result-stream.ts | 11 +- lib/types/row.ts | 2 +- lib/types/time-uuid.ts | 15 +-- lib/types/tuple.ts | 2 +- lib/types/uuid.ts | 8 +- lib/types/version-number.ts | 2 +- lib/utils.ts | 14 +- lib/writers.ts | 10 +- package.json | 121 +++++++++--------- tsconfig.json | 42 +++--- 104 files changed, 562 insertions(+), 796 deletions(-) diff --git a/index.ts b/index.ts index 1fed3ca3..5d2b50ed 100644 --- a/index.ts +++ b/index.ts @@ -14,24 +14,23 @@ * limitations under the License. */ 'use strict'; -const clientOptions = require('./lib/client-options'); -const Client = require('./lib/client'); const ExecutionProfile = require('./lib/execution-profile').ExecutionProfile; const ExecutionOptions = require('./lib/execution-options').ExecutionOptions; -const types = require('./lib/types'); -const errors = require('./lib/errors'); -const policies = require('./lib/policies'); -import * as auth from './lib/auth'; -const mapping = require('./lib/mapping'); -const tracker = require('./lib/tracker'); -const metrics = require('./lib/metrics'); -const concurrent = require('./lib/concurrent'); -const token = require('./lib/token'); -const Metadata = require('./lib/metadata'); -const Encoder = require('./lib/encoder'); -const geometry = require('./lib/geometry'); -const datastax = require('./lib/datastax'); - +import * as auth from './lib/auth/index.js'; +import clientOptions from "./lib/client-options.js"; +import Client from "./lib/client.js"; +import types from "./lib/types/index.js"; +import errors from "./lib/errors.js"; +import policies from "./lib/policies/index.js"; +import mapping from "./lib/mapping/index.js"; +import tracker from "./lib/tracker/index.js"; +import metrics from "./lib/metrics/index.js"; +import concurrent from "./lib/concurrent/index.js"; +import token from "./lib/token.js"; +import Metadata from "./lib/metadata/index.js"; +import Encoder from "./lib/encoder.js"; +import geometry from "./lib/geometry/index.js"; +import datastax from "./lib/datastax/index.js"; export default { Client, ExecutionProfile, diff --git a/lib/auth/base-dse-authenticator.ts b/lib/auth/base-dse-authenticator.ts index e1d3bc4b..171ad891 100644 --- a/lib/auth/base-dse-authenticator.ts +++ b/lib/auth/base-dse-authenticator.ts @@ -14,8 +14,8 @@ * limitations under the License. */ 'use strict'; -const util = require('util'); -import { Authenticator } from './provider'; +import { Authenticator } from './provider.js'; +import util from "util"; const dseAuthenticatorName = 'com.datastax.bdp.cassandra.auth.DseAuthenticator'; diff --git a/lib/auth/dse-gssapi-auth-provider.ts b/lib/auth/dse-gssapi-auth-provider.ts index 62446a4d..d8ed9c11 100644 --- a/lib/auth/dse-gssapi-auth-provider.ts +++ b/lib/auth/dse-gssapi-auth-provider.ts @@ -14,13 +14,12 @@ * limitations under the License. */ 'use strict'; -const util = require('util'); -const { AuthProvider } = require('./provider'); -import BaseDseAuthenticator from './base-dse-authenticator'; -import GssapiClient from './gssapi-client'; -const dns = require('dns'); -const utils = require('../utils'); - +import BaseDseAuthenticator from './base-dse-authenticator.js'; +import GssapiClient from './gssapi-client.js'; +import util from "util"; +import { AuthProvider } from "./provider.js"; +import dns from "dns"; +import utils from "../utils.js"; const mechanism = utils.allocBufferFromString('GSSAPI'); const initialServerChallenge = 'GSSAPI-START'; const emptyBuffer = utils.allocBuffer(0); diff --git a/lib/auth/dse-plain-text-auth-provider.ts b/lib/auth/dse-plain-text-auth-provider.ts index fc040a58..95efd6aa 100644 --- a/lib/auth/dse-plain-text-auth-provider.ts +++ b/lib/auth/dse-plain-text-auth-provider.ts @@ -14,11 +14,10 @@ * limitations under the License. */ 'use strict'; -const util = require('util'); -import { AuthProvider } from './provider'; -import BaseDseAuthenticator from './base-dse-authenticator'; -const utils = require('../utils'); - +import { AuthProvider } from './provider.js'; +import BaseDseAuthenticator from './base-dse-authenticator.js'; +import util from "util"; +import utils from "../utils.js"; const mechanism = utils.allocBufferFromString('PLAIN'); const separatorBuffer = utils.allocBufferFromArray([0]); const initialServerChallenge = 'PLAIN-START'; diff --git a/lib/auth/gssapi-client.ts b/lib/auth/gssapi-client.ts index ceb5f207..6ab64d3e 100644 --- a/lib/auth/gssapi-client.ts +++ b/lib/auth/gssapi-client.ts @@ -13,12 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import util from "util"; +import utils from "../utils.js"; 'use strict'; -const util = require('util'); -const utils = require('../utils'); - /** * GSSAPI Client interface. * @ignore diff --git a/lib/auth/index.ts b/lib/auth/index.ts index 9d69d7c9..c89532ef 100644 --- a/lib/auth/index.ts +++ b/lib/auth/index.ts @@ -38,4 +38,4 @@ // PlainTextAuthProvider // }; -export * from './provider'; +export * from './provider.js'; diff --git a/lib/auth/no-auth-provider.ts b/lib/auth/no-auth-provider.ts index 414b6852..bf32669a 100644 --- a/lib/auth/no-auth-provider.ts +++ b/lib/auth/no-auth-provider.ts @@ -16,10 +16,9 @@ 'use strict'; -import { AuthProvider, Authenticator } from './provider'; -import { PlainTextAuthenticator } from './plain-text-auth-provider'; -const errors = require('../errors'); - +import { AuthProvider, Authenticator } from './provider.js'; +import { PlainTextAuthenticator } from './plain-text-auth-provider.js'; +import errors from "../errors.js"; const dseAuthenticator = 'com.datastax.bdp.cassandra.auth.DseAuthenticator'; /** diff --git a/lib/auth/plain-text-auth-provider.ts b/lib/auth/plain-text-auth-provider.ts index e7d20c08..7ebced40 100644 --- a/lib/auth/plain-text-auth-provider.ts +++ b/lib/auth/plain-text-auth-provider.ts @@ -14,10 +14,9 @@ * limitations under the License. */ 'use strict'; -const util = require('util'); - -import * as provider from './provider'; -const utils = require('../utils'); +import * as provider from './provider.js'; +import util from "util"; +import utils from "../utils.js"; const AuthProvider = provider.AuthProvider; const Authenticator = provider.Authenticator; /** diff --git a/lib/client-options.ts b/lib/client-options.ts index 029e5c8b..9be63612 100644 --- a/lib/client-options.ts +++ b/lib/client-options.ts @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; - -const util = require('util'); -const policies = require('./policies'); -const types = require('./types'); -const utils = require('./utils'); -const tracker = require('./tracker'); -const metrics = require('./metrics'); -const auth = require('./auth'); +import util from "util"; +import policies from "./policies/index.js"; +import types from "./types/index.js"; +import utils from "./utils.js"; +import tracker from "./tracker/index.js"; +import metrics from "./metrics/index.js"; +import auth from "./auth/index.js"; +'use strict'; /** Core connections per host for protocol versions 1 and 2 */ const coreConnectionsPerHostV2 = { [types.distance.local]: 2, diff --git a/lib/client.ts b/lib/client.ts index 333c2552..cf34bbf5 100644 --- a/lib/client.ts +++ b/lib/client.ts @@ -13,29 +13,27 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; - -const events = require('events'); -const util = require('util'); +import events from "events"; +import util from "util"; +import utils from "./utils.js"; +import errors from "./errors.js"; +import types from "./types/index.js"; +import { ProfileManager } from "./execution-profile.js"; +import requests from "./requests.js"; +import clientOptions from "./client-options.js"; +import ClientState from "./metadata/client-state.js"; +import { version } from "../package.json" with { type: "json" }; +import { DefaultExecutionOptions } from "./execution-options.js"; +import ControlConnection from "./control-connection.js"; +import RequestHandler from "./request-handler.js"; +import PrepareHandler from "./prepare-handler.js"; +import InsightsClient from "./insights-client.js"; +import cloud from "./datastax/cloud/index.js"; +import GraphExecutor from "./datastax/graph/graph-executor.js"; +import promiseUtils from "./promise-utils.js"; -const utils = require('./utils'); -const errors = require('./errors'); -const types = require('./types'); -const { ProfileManager } = require('./execution-profile'); -const requests = require('./requests'); -const clientOptions = require('./client-options'); -const ClientState = require('./metadata/client-state'); +'use strict'; const description = require('../package.json').description; -const { version } = require('../package.json'); -const { DefaultExecutionOptions } = require('./execution-options'); -const ControlConnection = require('./control-connection'); -const RequestHandler = require('./request-handler'); -const PrepareHandler = require('./prepare-handler'); -const InsightsClient = require('./insights-client'); -const cloud = require('./datastax/cloud'); -const GraphExecutor = require('./datastax/graph/graph-executor'); -const promiseUtils = require('./promise-utils'); - /** * Max amount of pools being warmup in parallel, when warmup is enabled * @private @@ -1170,11 +1168,4 @@ Client.prototype._setRoutingInfo = async function (execOptions, params, meta) { } }; -/** - * Callback used by execution methods. - * @callback ResultCallback - * @param {Error} err Error occurred in the execution of the query. - * @param {ResultSet} [result] Result of the execution of the query. - */ - -module.exports = Client; +export default Client; diff --git a/lib/concurrent/index.ts b/lib/concurrent/index.ts index c618693b..368b9654 100644 --- a/lib/concurrent/index.ts +++ b/lib/concurrent/index.ts @@ -13,12 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { Stream } from "stream"; +import utils from "../utils.js"; 'use strict'; -const { Stream } = require('stream'); -const utils = require('../utils'); - /** * Utilities for concurrent query execution with the DataStax Node.js Driver. * @module concurrent diff --git a/lib/connection.ts b/lib/connection.ts index a6187fa3..b200d66f 100644 --- a/lib/connection.ts +++ b/lib/connection.ts @@ -13,26 +13,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import events from "events"; +import util from "util"; +import tls from "tls"; +import net from "net"; +import Encoder from "./encoder.js"; +import { WriteQueue } from "./writers.js"; +import requests from "./requests.js"; +import streams from "./streams.js"; +import utils from "./utils.js"; +import types from "./types/index.js"; +import errors from "./errors.js"; +import StreamIdStack from "./stream-id-stack.js"; +import OperationState from "./operation-state.js"; +import promiseUtils from "./promise-utils.js"; +import { ExecutionOptions } from "./execution-options.js"; 'use strict'; -const events = require('events'); -const util = require('util'); -const tls = require('tls'); -const net = require('net'); - -const Encoder = require('./encoder'); -const { WriteQueue } = require('./writers'); -const requests = require('./requests'); -const streams = require('./streams'); -const utils = require('./utils'); -const types = require('./types'); -const errors = require('./errors'); -const StreamIdStack = require('./stream-id-stack'); -const OperationState = require('./operation-state'); -const promiseUtils = require('./promise-utils'); -const { ExecutionOptions } = require('./execution-options'); - /** * Represents a connection to a Cassandra node */ @@ -787,4 +785,4 @@ class Connection extends events.EventEmitter { } } -module.exports = Connection; +export default Connection; diff --git a/lib/control-connection.ts b/lib/control-connection.ts index 54b3e617..2df78d79 100644 --- a/lib/control-connection.ts +++ b/lib/control-connection.ts @@ -13,21 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import events from "events"; +import util from "util"; +import net from "net"; +import dns from "dns"; +import errors from "./errors.js"; +import { Host, HostMap } from "./host.js"; +import Metadata from "./metadata/index.js"; +import EventDebouncer from "./metadata/event-debouncer.js"; +import Connection from "./connection.js"; +import requests from "./requests.js"; +import utils from "./utils.js"; +import types from "./types/index.js"; +import promiseUtils from "./promise-utils.js"; + 'use strict'; -const events = require('events'); -const util = require('util'); -const net = require('net'); -const dns = require('dns'); - -const errors = require('./errors'); -const { Host, HostMap } = require('./host'); -const Metadata = require('./metadata'); -const EventDebouncer = require('./metadata/event-debouncer'); -const Connection = require('./connection'); -const requests = require('./requests'); -const utils = require('./utils'); -const types = require('./types'); -const promiseUtils = require('./promise-utils'); const f = util.format; const selectPeers = "SELECT * FROM system.peers"; @@ -1070,4 +1070,4 @@ function setDseParameters(host, row) { } } -module.exports = ControlConnection; +export default ControlConnection; diff --git a/lib/datastax/cloud/index.ts b/lib/datastax/cloud/index.ts index bebaf569..77963d62 100644 --- a/lib/datastax/cloud/index.ts +++ b/lib/datastax/cloud/index.ts @@ -15,16 +15,14 @@ */ 'use strict'; - -const https = require('https'); -const fs = require('fs'); -const util = require('util'); -const AdmZip = require('adm-zip'); -const { URL } = require('url'); - -const errors = require('../../errors'); -const utils = require('../../utils'); -import { DsePlainTextAuthProvider, NoAuthProvider } from '../../auth'; +import { DsePlainTextAuthProvider, NoAuthProvider } from '../../auth/index.js'; +import https from "https"; +import fs from "fs"; +import util from "util"; +import AdmZip from "adm-zip"; +import { URL } from "url"; +import errors from "../../errors.js"; +import utils from "../../utils.js"; // Use the callback-based method fs.readFile() instead of fs.promises as we have to support Node.js 8+ const readFile = util.promisify(fs.readFile); @@ -330,9 +328,4 @@ function checkParts(hostParts, pattern) { } return true; -} - -module.exports = { - checkServerIdentity, - init -}; \ No newline at end of file +} \ No newline at end of file diff --git a/lib/datastax/graph/complex-type-helper.ts b/lib/datastax/graph/complex-type-helper.ts index 130bf0a1..bf4e8212 100644 --- a/lib/datastax/graph/complex-type-helper.ts +++ b/lib/datastax/graph/complex-type-helper.ts @@ -13,12 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { GraphTypeWrapper, UdtGraphWrapper } from "./wrappers.js"; +import types from "../../types/index.js"; +import Encoder from "../../encoder.js"; 'use strict'; - -const { GraphTypeWrapper, UdtGraphWrapper } = require('./wrappers'); -const types = require('../../types'); -const Encoder = require('../../encoder'); const { dataTypes } = types; function getTypeDefinitionByValue(value) { @@ -94,6 +93,4 @@ function getUdtTypeDefinition(udtInfo) { function getUdtTypeDefinitionByValue(wrappedValue) { return getUdtTypeDefinition(wrappedValue.udtInfo); -} - -module.exports = { getTypeDefinitionByValue, getUdtTypeDefinitionByValue }; \ No newline at end of file +} \ No newline at end of file diff --git a/lib/datastax/graph/custom-type-serializers.ts b/lib/datastax/graph/custom-type-serializers.ts index e25ef3bb..208a670a 100644 --- a/lib/datastax/graph/custom-type-serializers.ts +++ b/lib/datastax/graph/custom-type-serializers.ts @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; +import types from "../../types/index.js"; +import utils from "../../utils.js"; +import { getTypeDefinitionByValue, getUdtTypeDefinitionByValue } from "./complex-type-helper.js"; +import { Point, Polygon, LineString } from "../../geometry/index.js"; +import { Edge } from "./structure.js"; +import { GraphTypeWrapper, UdtGraphWrapper } from "./wrappers.js"; -const types = require('../../types'); -const utils = require('../../utils'); -const { getTypeDefinitionByValue, getUdtTypeDefinitionByValue } = require('./complex-type-helper'); -const { Point, Polygon, LineString } = require('../../geometry'); -const { Edge } = require('./structure'); -const { GraphTypeWrapper, UdtGraphWrapper } = require('./wrappers'); +'use strict'; const { Tuple, dataTypes } = types; const typeKey = '@type'; @@ -359,4 +359,4 @@ function getCustomSerializers() { return customSerializers; } -module.exports = getCustomSerializers; \ No newline at end of file +export default getCustomSerializers; \ No newline at end of file diff --git a/lib/datastax/graph/graph-executor.ts b/lib/datastax/graph/graph-executor.ts index 70158267..5e5f0f3c 100644 --- a/lib/datastax/graph/graph-executor.ts +++ b/lib/datastax/graph/graph-executor.ts @@ -13,16 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import utils from "../../utils.js"; +import policies from "../../policies/index.js"; +import GraphResultSet from "./result-set.js"; +import { GraphSON2Reader, GraphSON2Writer, GraphSON3Reader, GraphSON3Writer } from "./graph-serializer.js"; +import getCustomTypeSerializers from "./custom-type-serializers.js"; +import { GraphExecutionOptions, graphProtocol } from "./options.js"; 'use strict'; - -const utils = require('../../utils'); -const policies = require('../../policies'); -const GraphResultSet = require('./result-set'); -const { GraphSON2Reader, GraphSON2Writer, GraphSON3Reader, GraphSON3Writer } = require('./graph-serializer'); -const getCustomTypeSerializers = require('./custom-type-serializers'); -const { GraphExecutionOptions, graphProtocol } = require('./options'); - const graphLanguageGroovyString = 'gremlin-groovy'; const graphEngineCore = 'Core'; @@ -277,4 +275,4 @@ function getDefaultWriter(writer) { return value => writer.write(value); } -module.exports = GraphExecutor; \ No newline at end of file +export default GraphExecutor; \ No newline at end of file diff --git a/lib/datastax/graph/graph-serializer.ts b/lib/datastax/graph/graph-serializer.ts index 4331161a..0519b761 100644 --- a/lib/datastax/graph/graph-serializer.ts +++ b/lib/datastax/graph/graph-serializer.ts @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +import typeSerializers from "./type-serializers.js"; /** * @module datastax/graph/tinkerpop/graphSerializers @@ -28,8 +29,6 @@ */ 'use strict'; -const typeSerializers = require('./type-serializers'); - /** * GraphSON2 writer. */ @@ -248,13 +247,4 @@ const graphSON3Serializers = graphSON2Serializers.concat([ typeSerializers.ListSerializer, typeSerializers.SetSerializer, typeSerializers.MapSerializer -]); - -module.exports = { - GraphSON3Writer, - GraphSON3Reader, - GraphSON2Writer, - GraphSON2Reader, - GraphSONWriter: GraphSON3Writer, - GraphSONReader: GraphSON3Reader -}; \ No newline at end of file +]); \ No newline at end of file diff --git a/lib/datastax/graph/index.ts b/lib/datastax/graph/index.ts index a0333a06..e59c0365 100644 --- a/lib/datastax/graph/index.ts +++ b/lib/datastax/graph/index.ts @@ -13,17 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; - -/** - * Graph module. - * @module datastax/graph - */ +import GraphResultSet from "./result-set.js"; +import getCustomTypeSerializers from "./custom-type-serializers.js"; +import { asInt, asDouble, asFloat, asTimestamp, asUdt, UdtGraphWrapper, GraphTypeWrapper} from "./wrappers.js"; +import { Edge, Element, Path, Property, Vertex, VertexProperty } from "./structure.js"; -const GraphResultSet = require('./result-set'); -const getCustomTypeSerializers = require('./custom-type-serializers'); -const { asInt, asDouble, asFloat, asTimestamp, asUdt, UdtGraphWrapper, GraphTypeWrapper} = require('./wrappers'); -const { Edge, Element, Path, Property, Vertex, VertexProperty } = require('./structure'); +'use strict'; class EnumValue { constructor(typeName, elementName) { @@ -58,25 +53,4 @@ const direction = { // `in` is a reserved keyword depending on the context // TinkerPop JavaScript GLV only exposes `in` but it can lead to issues for TypeScript users and others. // Expose an extra property to represent `Direction.IN`. -direction.in_ = direction.in; - -module.exports = { - Edge, - Element, - Path, - Property, - Vertex, - VertexProperty, - - asInt, - asDouble, - asFloat, - asTimestamp, - asUdt, - direction, - getCustomTypeSerializers, - GraphResultSet, - GraphTypeWrapper, - t, - UdtGraphWrapper -}; \ No newline at end of file +direction.in_ = direction.in; \ No newline at end of file diff --git a/lib/datastax/graph/options.ts b/lib/datastax/graph/options.ts index 2e0e7e71..27185f46 100644 --- a/lib/datastax/graph/options.ts +++ b/lib/datastax/graph/options.ts @@ -13,11 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import util from "util"; +import types from "../../types/index.js"; +import utils from "../../utils.js"; +import { DefaultExecutionOptions, proxyExecuteKey } from "../../execution-options.js"; + 'use strict'; -const util = require('util'); -const types = require('../../types'); -const utils = require('../../utils'); -const { DefaultExecutionOptions, proxyExecuteKey } = require('../../execution-options'); const Long = types.Long; let consistencyNames; @@ -325,10 +326,4 @@ class GraphExecutionOptions extends DefaultExecutionOptions { this.setCustomPayload(payload); } -} - -module.exports = { - GraphExecutionOptions, - graphProtocol, - payloadKeys -}; \ No newline at end of file +} \ No newline at end of file diff --git a/lib/datastax/graph/result-set.ts b/lib/datastax/graph/result-set.ts index 8e846706..c54d946b 100644 --- a/lib/datastax/graph/result-set.ts +++ b/lib/datastax/graph/result-set.ts @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; +import utils from "../../utils.js"; -const utils = require('../../utils'); +'use strict'; /** * Creates a new instance of GraphResultSet. @@ -153,4 +153,4 @@ function parsePlainJsonRow(row) { return { object: parsed.result, bulk: parsed.bulk || 1 }; } -module.exports = GraphResultSet; \ No newline at end of file +export default GraphResultSet; \ No newline at end of file diff --git a/lib/datastax/graph/structure.ts b/lib/datastax/graph/structure.ts index deef3e13..3a738c53 100644 --- a/lib/datastax/graph/structure.ts +++ b/lib/datastax/graph/structure.ts @@ -13,11 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import util from "util"; 'use strict'; -const util = require('util'); - /** * @classdesc * Represents a graph Element. @@ -155,13 +154,4 @@ function Property(key, value) { function Path(labels, objects) { this.labels = labels; this.objects = objects; -} - -module.exports = { - Edge, - Element, - Path, - Property, - Vertex, - VertexProperty -}; \ No newline at end of file +} \ No newline at end of file diff --git a/lib/datastax/graph/type-serializers.ts b/lib/datastax/graph/type-serializers.ts index 880c0f33..4c1185ad 100644 --- a/lib/datastax/graph/type-serializers.ts +++ b/lib/datastax/graph/type-serializers.ts @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +import g from "./index.js"; /** * @module datastax/graph/tinkerpop/typeSerializers @@ -34,7 +35,6 @@ const t = { }; const ts = { TraversalStrategy: UnsupportedType }; const Bytecode = UnsupportedType; -const g = require('./index'); const utils = { Long: UnsupportedType }; t.t = g.t; t.direction = g.direction; @@ -472,30 +472,3 @@ class SetSerializer extends ArraySerializer { super('g:Set'); } } - -module.exports = { - BulkSetSerializer, - BytecodeSerializer, - DateSerializer, - DirectionSerializer, - EdgeSerializer, - EnumSerializer, - LambdaSerializer, - ListSerializer, - LongSerializer, - MapSerializer, - NumberSerializer, - Path3Serializer, - PathSerializer, - PropertySerializer, - PSerializer, - TextPSerializer, - SetSerializer, - TSerializer, - TraverserSerializer, - TraversalStrategySerializer, - typeKey, - valueKey, - VertexPropertySerializer, - VertexSerializer -}; diff --git a/lib/datastax/graph/wrappers.ts b/lib/datastax/graph/wrappers.ts index 0bbf8c08..799c4380 100644 --- a/lib/datastax/graph/wrappers.ts +++ b/lib/datastax/graph/wrappers.ts @@ -13,10 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import types from "../../types/index.js"; 'use strict'; - -const types = require('../../types'); const { dataTypes } = types; /** @@ -79,6 +78,4 @@ function asTimestamp(value) { return new GraphTypeWrapper(value, dataTypes.times * @param {object} value The object representing the UDT. * @param {{name: string, keyspace: string, fields: Array}} udtInfo The UDT metadata as defined by the driver. */ -function asUdt(value, udtInfo) { return new UdtGraphWrapper(value, udtInfo); } - -module.exports = { asInt, asDouble, asFloat, asTimestamp, asUdt, UdtGraphWrapper, GraphTypeWrapper }; \ No newline at end of file +function asUdt(value, udtInfo) { return new UdtGraphWrapper(value, udtInfo); } \ No newline at end of file diff --git a/lib/datastax/search/date-range.ts b/lib/datastax/search/date-range.ts index 877c9a39..7a2180cf 100644 --- a/lib/datastax/search/date-range.ts +++ b/lib/datastax/search/date-range.ts @@ -13,11 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; - -const utils = require('../../utils'); -const Long = require('long'); +import utils from "../../utils.js"; +import Long from "long"; +'use strict'; /** * Regex to parse dates in the following format YYYY-MM-DDThh:mm:ss.mssZ * Looks cumbersome but it's straightforward: diff --git a/lib/datastax/search/index.ts b/lib/datastax/search/index.ts index c101f5d1..c9c0d40d 100644 --- a/lib/datastax/search/index.ts +++ b/lib/datastax/search/index.ts @@ -13,10 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; - -const dateRangeModule = require('./date-range'); +import dateRangeModule from "./date-range.js"; +'use strict'; /** * Search module. *

diff --git a/lib/encoder.ts b/lib/encoder.ts index 74219f77..8efb96c6 100644 --- a/lib/encoder.ts +++ b/lib/encoder.ts @@ -13,19 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const util = require('util'); +import util from "util"; +import types from "./types/index.js"; +import MutableLong from "./types/mutable-long.js"; +import utils from "./utils.js"; +import token from "./token.js"; +import { DateRange } from "./datastax/search/index.js"; +import geo from "./geometry/index.js"; -const types = require('./types'); +'use strict'; const dataTypes = types.dataTypes; const Long = types.Long; const Integer = types.Integer; const BigDecimal = types.BigDecimal; -const MutableLong = require('./types/mutable-long'); -const utils = require('./utils'); -const token = require('./token'); -const { DateRange } = require('./datastax/search'); -const geo = require('./geometry'); const Geometry = geo.Geometry; const LineString = geo.LineString; const Point = geo.Point; @@ -2012,4 +2012,4 @@ Encoder.isTypedArray = function(arg) { return (arg instanceof Object.getPrototypeOf(Uint8Array)); }; -module.exports = Encoder; +export default Encoder; diff --git a/lib/errors.ts b/lib/errors.ts index 8ec192f5..cef86fae 100644 --- a/lib/errors.ts +++ b/lib/errors.ts @@ -13,8 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import util from "util"; + 'use strict'; -const util = require('util'); + /** * Contains the error classes exposed by the driver. * @module errors diff --git a/lib/execution-options.ts b/lib/execution-options.ts index cc3df181..3340d112 100644 --- a/lib/execution-options.ts +++ b/lib/execution-options.ts @@ -13,13 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import utils from "./utils.js"; +import types from "./types/index.js"; +import errors from "./errors.js"; 'use strict'; - -const utils = require('./utils'); -const types = require('./types'); -const errors = require('./errors'); - const proxyExecuteKey = 'ProxyExecute'; /** @@ -614,6 +612,4 @@ function ifUndefined3(v1, v2, v3) { return v1; } return v2 !== undefined ? v2 : v3; -} - -module.exports = { ExecutionOptions, DefaultExecutionOptions, proxyExecuteKey }; \ No newline at end of file +} \ No newline at end of file diff --git a/lib/execution-profile.ts b/lib/execution-profile.ts index 78c4fc2b..ed97a359 100644 --- a/lib/execution-profile.ts +++ b/lib/execution-profile.ts @@ -13,13 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import utils from "./utils.js"; +import types from "./types/index.js"; +import promiseUtils from "./promise-utils.js"; 'use strict'; -const utils = require('./utils'); -const types = require('./types'); -const promiseUtils = require('./promise-utils'); - /** * Creates a new instance of {@link ExecutionProfile}. * @classdesc @@ -258,9 +257,4 @@ class ProfileManager { getDefaultConfiguredRetryPolicy() { return this._defaultConfiguredRetryPolicy; } -} - -module.exports = { - ProfileManager, - ExecutionProfile -}; \ No newline at end of file +} \ No newline at end of file diff --git a/lib/geometry/geometry.ts b/lib/geometry/geometry.ts index b91c8fdb..9eb6d06b 100644 --- a/lib/geometry/geometry.ts +++ b/lib/geometry/geometry.ts @@ -130,4 +130,4 @@ Geometry.prototype.useBESerialization = function () { throw new Error('Not Implemented'); }; -module.exports = Geometry; \ No newline at end of file +export default Geometry; \ No newline at end of file diff --git a/lib/geometry/line-string.ts b/lib/geometry/line-string.ts index 3e7c8ee2..9dfd9204 100644 --- a/lib/geometry/line-string.ts +++ b/lib/geometry/line-string.ts @@ -13,11 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import util from "util"; +import utils from "../utils.js"; +import Geometry from "./geometry.js"; +import Point from "./point.js"; + 'use strict'; -const util = require('util'); -const utils = require('../utils'); -const Geometry = require('./geometry'); -const Point = require('./point'); /** * Creates a new {@link LineString} instance. @@ -194,4 +195,4 @@ LineString.prototype.toJSON = function () { })}; }; -module.exports = LineString; \ No newline at end of file +export default LineString; \ No newline at end of file diff --git a/lib/geometry/point.ts b/lib/geometry/point.ts index 473b6cd1..9566f9e5 100644 --- a/lib/geometry/point.ts +++ b/lib/geometry/point.ts @@ -13,10 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import util from "util"; +import utils from "../utils.js"; +import Geometry from "./geometry.js"; + 'use strict'; -const util = require('util'); -const utils = require('../utils'); -const Geometry = require('./geometry'); /** * Creates a new {@link Point} instance. @@ -131,4 +132,4 @@ Point.prototype.toJSON = function () { return { type: 'Point', coordinates: [ this.x, this.y ]}; }; -module.exports = Point; \ No newline at end of file +export default Point; \ No newline at end of file diff --git a/lib/geometry/polygon.ts b/lib/geometry/polygon.ts index c4536e11..1e447d76 100644 --- a/lib/geometry/polygon.ts +++ b/lib/geometry/polygon.ts @@ -13,12 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import util from "util"; +import utils from "../utils.js"; +import Geometry from "./geometry.js"; +import Point from "./point.js"; +import LineString from "./line-string.js"; + 'use strict'; -const util = require('util'); -const utils = require('../utils'); -const Geometry = require('./geometry'); -const Point = require('./point'); -const LineString = require('./line-string'); /** * Creates a new {@link Polygon} instance. @@ -236,4 +237,4 @@ Polygon.prototype.toJSON = function () { })}; }; -module.exports = Polygon; \ No newline at end of file +export default Polygon; \ No newline at end of file diff --git a/lib/host-connection-pool.ts b/lib/host-connection-pool.ts index f03e6981..1c2b153f 100644 --- a/lib/host-connection-pool.ts +++ b/lib/host-connection-pool.ts @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const util = require('util'); -const events = require('events'); - -const Connection = require('./connection'); -const utils = require('./utils'); -const promiseUtils = require('./promise-utils'); -const errors = require('./errors'); -const clientOptions = require('./client-options'); +import util from "util"; +import events from "events"; +import Connection from "./connection.js"; +import utils from "./utils.js"; +import promiseUtils from "./promise-utils.js"; +import errors from "./errors.js"; +import clientOptions from "./client-options.js"; +'use strict'; // Used to get the index of the connection with less in-flight requests let connectionIndex = 0; const connectionIndexOverflow = Math.pow(2, 15); @@ -519,4 +518,4 @@ function getDefaultOptions() { return defaultOptions; } -module.exports = HostConnectionPool; \ No newline at end of file +export default HostConnectionPool; \ No newline at end of file diff --git a/lib/host.ts b/lib/host.ts index 56c128f5..eccdedbd 100644 --- a/lib/host.ts +++ b/lib/host.ts @@ -13,17 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import events from "events"; +import utils from "./utils.js"; +import types from "./types/index.js"; +import HostConnectionPool from "./host-connection-pool.js"; +import PrepareHandler from "./prepare-handler.js"; +import promiseUtils from "./promise-utils.js"; 'use strict'; - -const events = require('events'); - -const utils = require('./utils'); -const types = require('./types'); -const HostConnectionPool = require('./host-connection-pool'); -const PrepareHandler = require('./prepare-handler'); -const promiseUtils = require('./promise-utils'); - const healthResponseCountInterval = 200; /** @@ -650,9 +647,4 @@ class HostMap extends events.EventEmitter{ return obj; } -} - -module.exports = { - Host, - HostMap -}; \ No newline at end of file +} \ No newline at end of file diff --git a/lib/insights-client.ts b/lib/insights-client.ts index 02b18834..b8004741 100644 --- a/lib/insights-client.ts +++ b/lib/insights-client.ts @@ -15,18 +15,17 @@ */ 'use strict'; - -const os = require('os'); -const path = require('path'); -const fs = require('fs'); -const utils = require('./utils'); -const promiseUtils = require('./promise-utils'); -const types = require('./types'); -const requests = require('./requests'); -const { ExecutionOptions } = require('./execution-options'); -const packageInfo = require('../package.json'); -const VersionNumber = require('./types/version-number'); -import { NoAuthProvider } from './auth'; +import { NoAuthProvider } from './auth/index.js'; +import os from "os"; +import path from "path"; +import fs from "fs"; +import utils from "./utils.js"; +import promiseUtils from "./promise-utils.js"; +import types from "./types/index.js"; +import requests from "./requests.js"; +import { ExecutionOptions } from "./execution-options.js"; +import packageInfo from "../package.json" with { type: "json" }; +import VersionNumber from "./types/version-number.js"; let kerberosModule; @@ -404,7 +403,7 @@ class InsightsClient { } } -module.exports = InsightsClient; +export default InsightsClient; function mapToObject(map) { const result = {}; diff --git a/lib/mapping/cache.ts b/lib/mapping/cache.ts index ffc4777d..fd00f29b 100644 --- a/lib/mapping/cache.ts +++ b/lib/mapping/cache.ts @@ -13,10 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import qModule from "./q.js"; 'use strict'; - -const qModule = require('./q'); const QueryOperator = qModule.QueryOperator; const QueryAssignment = qModule.QueryAssignment; @@ -204,4 +203,4 @@ class Cache { } } -module.exports = Cache; \ No newline at end of file +export default Cache; \ No newline at end of file diff --git a/lib/mapping/doc-info-adapter.ts b/lib/mapping/doc-info-adapter.ts index 32deead5..b2adfa7b 100644 --- a/lib/mapping/doc-info-adapter.ts +++ b/lib/mapping/doc-info-adapter.ts @@ -13,12 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import errors from "../errors.js"; +import utils from "../utils.js"; 'use strict'; -const errors = require('../errors'); -const utils = require('../utils'); - /** * Provides utility methods to adapt and map user provided docInfo and executionOptions to a predictable object format. * @ignore @@ -159,4 +158,4 @@ class DocInfoAdapter { } } -module.exports = DocInfoAdapter; \ No newline at end of file +export default DocInfoAdapter; \ No newline at end of file diff --git a/lib/mapping/index.ts b/lib/mapping/index.ts index e1de6c93..193de298 100644 --- a/lib/mapping/index.ts +++ b/lib/mapping/index.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import tableMappingsModule from "./table-mappings.js"; 'use strict'; @@ -26,7 +27,6 @@ exports.ModelMapper = require('./model-mapper'); exports.ModelBatchMapper = require('./model-batch-mapper'); exports.ModelBatchItem = require('./model-batch-item').ModelBatchItem; exports.Result = require('./result'); -const tableMappingsModule = require('./table-mappings'); exports.TableMappings = tableMappingsModule.TableMappings; exports.DefaultTableMappings = tableMappingsModule.DefaultTableMappings; exports.UnderscoreCqlToCamelCaseMappings = tableMappingsModule.UnderscoreCqlToCamelCaseMappings; diff --git a/lib/mapping/mapper.ts b/lib/mapping/mapper.ts index 329c87f1..dba290d5 100644 --- a/lib/mapping/mapper.ts +++ b/lib/mapping/mapper.ts @@ -13,18 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import ModelMapper from "./model-mapper.js"; +import MappingHandler from "./mapping-handler.js"; +import DocInfoAdapter from "./doc-info-adapter.js"; +import errors from "../errors.js"; +import Result from "./result.js"; +import ResultMapper from "./result-mapper.js"; +import ModelMappingInfo from "./model-mapping-info.js"; +import { ModelBatchItem } from "./model-batch-item.js"; 'use strict'; -const ModelMapper = require('./model-mapper'); -const MappingHandler = require('./mapping-handler'); -const DocInfoAdapter = require('./doc-info-adapter'); -const errors = require('../errors'); -const Result = require('./result'); -const ResultMapper = require('./result-mapper'); -const ModelMappingInfo = require('./model-mapping-info'); -const { ModelBatchItem } = require('./model-batch-item'); - /** * Represents an object mapper for Apache Cassandra and DataStax Enterprise. * @alias module:mapping~Mapper @@ -171,23 +170,4 @@ class Mapper { } } -/** - * Represents the mapping options. - * @typedef {Object} module:mapping~MappingOptions - * @property {Object} models An associative array containing the - * name of the model as key and the table and column information as value. - */ - -/** - * Represents a set of options that applies to a certain model. - * @typedef {Object} module:mapping~ModelOptions - * @property {Array|Array<{name, isView}>} tables An Array containing the name of the tables or An Array - * containing the name and isView property to describe the table. - * @property {TableMappings} mappings The TableMappings implementation instance that is used to convert from column - * names to property names and the other way around. - * @property {Object.} [columnNames] An associative array containing the name of the columns and - * properties that doesn't follow the convention defined in the TableMappings. - * @property {String} [keyspace] The name of the keyspace. Only mandatory when the Client is not using a keyspace. - */ - -module.exports = Mapper; \ No newline at end of file +export default Mapper; \ No newline at end of file diff --git a/lib/mapping/mapping-handler.ts b/lib/mapping/mapping-handler.ts index f5bd8317..8083ca33 100644 --- a/lib/mapping/mapping-handler.ts +++ b/lib/mapping/mapping-handler.ts @@ -13,18 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import utils from "../utils.js"; +import QueryGenerator from "./query-generator.js"; +import ResultMapper from "./result-mapper.js"; +import Result from "./result.js"; +import Cache from "./cache.js"; +import Tree from "./tree.js"; +import ObjectSelector from "./object-selector.js"; +import DocInfoAdapter from "./doc-info-adapter.js"; 'use strict'; - -const utils = require('../utils'); -const QueryGenerator = require('./query-generator'); -const ResultMapper = require('./result-mapper'); -const Result = require('./result'); -const Cache = require('./cache'); -const Tree = require('./tree'); -const ObjectSelector = require('./object-selector'); -const DocInfoAdapter = require('./doc-info-adapter'); - const cacheHighWaterMark = 100; /** @@ -409,4 +407,4 @@ class MappingHandler { } } -module.exports = MappingHandler; \ No newline at end of file +export default MappingHandler; \ No newline at end of file diff --git a/lib/mapping/model-batch-item.ts b/lib/mapping/model-batch-item.ts index f04528e5..f5c1a2ca 100644 --- a/lib/mapping/model-batch-item.ts +++ b/lib/mapping/model-batch-item.ts @@ -13,11 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import Cache from "./cache.js"; 'use strict'; -const Cache = require('./cache'); - /** * Represents a query or a set of queries used to perform a mutation in a batch. * @alias module:mapping~ModelBatchItem @@ -186,6 +185,4 @@ class RemoveModelBatchItem extends ModelBatchItem { createQueries(docKeys) { return this.handler.createDeleteQueries(docKeys, this.doc, this.docInfo); } -} - -module.exports = { ModelBatchItem, InsertModelBatchItem, UpdateModelBatchItem, RemoveModelBatchItem }; \ No newline at end of file +} \ No newline at end of file diff --git a/lib/mapping/model-batch-mapper.ts b/lib/mapping/model-batch-mapper.ts index 4928072c..d39a6d84 100644 --- a/lib/mapping/model-batch-mapper.ts +++ b/lib/mapping/model-batch-mapper.ts @@ -13,11 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import Tree from "./tree.js"; +import moduleBatchItemModule from "./model-batch-item.js"; 'use strict'; - -const Tree = require('./tree'); -const moduleBatchItemModule = require('./model-batch-item'); const InsertModelBatchItem = moduleBatchItemModule.InsertModelBatchItem; const UpdateModelBatchItem = moduleBatchItemModule.UpdateModelBatchItem; const RemoveModelBatchItem = moduleBatchItemModule.RemoveModelBatchItem; @@ -122,4 +121,4 @@ class ModelBatchMapper { } } -module.exports = ModelBatchMapper; \ No newline at end of file +export default ModelBatchMapper; \ No newline at end of file diff --git a/lib/mapping/model-mapper.ts b/lib/mapping/model-mapper.ts index 8a4d0419..3d15108e 100644 --- a/lib/mapping/model-mapper.ts +++ b/lib/mapping/model-mapper.ts @@ -13,11 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import ModelBatchMapper from "./model-batch-mapper.js"; 'use strict'; -const ModelBatchMapper = require('./model-batch-mapper'); - /** * Represents an object mapper for a specific model. * @alias module:mapping~ModelMapper @@ -303,4 +302,4 @@ class ModelMapper { } } -module.exports = ModelMapper; \ No newline at end of file +export default ModelMapper; \ No newline at end of file diff --git a/lib/mapping/model-mapping-info.ts b/lib/mapping/model-mapping-info.ts index 23be0408..c6d46e9c 100644 --- a/lib/mapping/model-mapping-info.ts +++ b/lib/mapping/model-mapping-info.ts @@ -13,10 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import tableMappingsModule from "./table-mappings.js"; 'use strict'; - -const tableMappingsModule = require('./table-mappings'); const TableMappings = tableMappingsModule.TableMappings; const DefaultTableMappings = tableMappingsModule.DefaultTableMappings; @@ -191,4 +190,4 @@ class ModelColumnInfo { } } -module.exports = ModelMappingInfo; \ No newline at end of file +export default ModelMappingInfo; \ No newline at end of file diff --git a/lib/mapping/object-selector.ts b/lib/mapping/object-selector.ts index de25df62..9748cdd6 100644 --- a/lib/mapping/object-selector.ts +++ b/lib/mapping/object-selector.ts @@ -318,4 +318,4 @@ function staticColumnCount(table) { return table.columns.reduce((acc, column) => acc + (column.isStatic ? 1 : 0), 0); } -module.exports = ObjectSelector; +export default ObjectSelector; diff --git a/lib/mapping/q.ts b/lib/mapping/q.ts index 7e4c8ce2..1248c42b 100644 --- a/lib/mapping/q.ts +++ b/lib/mapping/q.ts @@ -13,11 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import errors from "../errors.js"; 'use strict'; -const errors = require('../errors'); - /** * Represents a CQL query operator, like >=, IN, <, ... * @ignore diff --git a/lib/mapping/query-generator.ts b/lib/mapping/query-generator.ts index 83a105d0..4c59430e 100644 --- a/lib/mapping/query-generator.ts +++ b/lib/mapping/query-generator.ts @@ -13,14 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import vm from "vm"; +import qModule from "./q.js"; +import types from "../types/index.js"; 'use strict'; - -const vm = require('vm'); -const qModule = require('./q'); const QueryOperator = qModule.QueryOperator; const QueryAssignment = qModule.QueryAssignment; -const types = require('../types'); const dataTypes = types.dataTypes; const vmFileName = 'gen-param-getter.js'; @@ -443,4 +442,4 @@ class QueryGenerator { } } -module.exports = QueryGenerator; \ No newline at end of file +export default QueryGenerator; \ No newline at end of file diff --git a/lib/mapping/result-mapper.ts b/lib/mapping/result-mapper.ts index c364e5a2..6ea29842 100644 --- a/lib/mapping/result-mapper.ts +++ b/lib/mapping/result-mapper.ts @@ -13,13 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import vm from "vm"; +import utils from "../utils.js"; +import types from "../types/index.js"; 'use strict'; -const vm = require('vm'); -const utils = require('../utils'); -const types = require('../types'); - /** * @ignore */ @@ -109,4 +108,4 @@ class ResultMapper { } } -module.exports = ResultMapper; \ No newline at end of file +export default ResultMapper; \ No newline at end of file diff --git a/lib/mapping/result.ts b/lib/mapping/result.ts index 6f1ead4d..24efd72b 100644 --- a/lib/mapping/result.ts +++ b/lib/mapping/result.ts @@ -13,11 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import util from "util"; +import utils from "../utils.js"; 'use strict'; - -const util = require('util'); -const utils = require('../utils'); const inspectMethod = util.inspect.custom || 'inspect'; /** @@ -133,4 +132,4 @@ class Result { } } -module.exports = Result; \ No newline at end of file +export default Result; \ No newline at end of file diff --git a/lib/mapping/tree.ts b/lib/mapping/tree.ts index e6adece9..b1595306 100644 --- a/lib/mapping/tree.ts +++ b/lib/mapping/tree.ts @@ -13,11 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import EventEmitter from "events"; 'use strict'; -const EventEmitter = require('events'); - /** * Represents a tree node where the key is composed by 1 or more strings. * @ignore @@ -148,4 +147,4 @@ function iteratorToArray(value, iterator) { return values; } -module.exports = Tree; \ No newline at end of file +export default Tree; \ No newline at end of file diff --git a/lib/metadata/aggregate.ts b/lib/metadata/aggregate.ts index 6677f5f6..45e924a9 100644 --- a/lib/metadata/aggregate.ts +++ b/lib/metadata/aggregate.ts @@ -75,4 +75,4 @@ function Aggregate() { this.deterministic = null; } -module.exports = Aggregate; \ No newline at end of file +export default Aggregate; \ No newline at end of file diff --git a/lib/metadata/client-state.ts b/lib/metadata/client-state.ts index 6bf7c372..a4b5778d 100644 --- a/lib/metadata/client-state.ts +++ b/lib/metadata/client-state.ts @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; +import util from "util"; +import errors from "../errors.js"; -const util = require('util'); -const errors = require('../errors'); +'use strict'; /** * Represents the state of a {@link Client}. @@ -111,4 +111,4 @@ class ClientState { } } -module.exports = ClientState; \ No newline at end of file +export default ClientState; \ No newline at end of file diff --git a/lib/metadata/data-collection.ts b/lib/metadata/data-collection.ts index 1bab680a..481e83ed 100644 --- a/lib/metadata/data-collection.ts +++ b/lib/metadata/data-collection.ts @@ -13,9 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import util from "util"; +import events from "events"; + 'use strict'; -const util = require('util'); -const events = require('events'); + /** * Creates a new instance of DataCollection * @param {String} name Name of the data object. @@ -170,4 +172,4 @@ function DataCollection(name) { util.inherits(DataCollection, events.EventEmitter); -module.exports = DataCollection; \ No newline at end of file +export default DataCollection; \ No newline at end of file diff --git a/lib/metadata/event-debouncer.ts b/lib/metadata/event-debouncer.ts index 4ea8ddc2..20dc378e 100644 --- a/lib/metadata/event-debouncer.ts +++ b/lib/metadata/event-debouncer.ts @@ -13,12 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; - -const util = require('util'); -const utils = require('../utils'); -const promiseUtils = require('../promise-utils'); +import util from "util"; +import utils from "../utils.js"; +import promiseUtils from "../promise-utils.js"; +'use strict'; const _queueOverflowThreshold = 1000; /** @@ -161,4 +160,4 @@ function processQueue (q) { }); } -module.exports = EventDebouncer; \ No newline at end of file +export default EventDebouncer; \ No newline at end of file diff --git a/lib/metadata/index.ts b/lib/metadata/index.ts index a34c4570..58d68a70 100644 --- a/lib/metadata/index.ts +++ b/lib/metadata/index.ts @@ -13,27 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import events from "events"; +import util from "util"; +import t from "../tokenizer.js"; +import utils from "../utils.js"; +import errors from "../errors.js"; +import types from "../types/index.js"; +import requests from "../requests.js"; +import schemaParserFactory from "./schema-parser.js"; +import promiseUtils from "../promise-utils.js"; +import { TokenRange } from "../token.js"; +import { ExecutionOptions } from "../execution-options.js"; 'use strict'; - -const events = require('events'); -const util = require('util'); - -/** - * Module containing classes and fields related to metadata. - * @module metadata - */ - -const t = require('../tokenizer'); -const utils = require('../utils'); -const errors = require('../errors'); -const types = require('../types'); -const requests = require('../requests'); -const schemaParserFactory = require('./schema-parser'); -const promiseUtils = require('../promise-utils'); -const { TokenRange } = require('../token'); -const { ExecutionOptions } = require('../execution-options'); - /** * @const * @private @@ -1021,4 +1013,4 @@ class PreparedQueries { } } -module.exports = Metadata; +export default Metadata; diff --git a/lib/metadata/materialized-view.ts b/lib/metadata/materialized-view.ts index 455a66a0..1ca420aa 100644 --- a/lib/metadata/materialized-view.ts +++ b/lib/metadata/materialized-view.ts @@ -13,9 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import util from "util"; +import DataCollection from "./data-collection.js"; + 'use strict'; -const util = require('util'); -const DataCollection = require('./data-collection'); + /** * Creates a new MaterializedView. * @param {String} name Name of the View. @@ -45,4 +47,4 @@ function MaterializedView(name) { util.inherits(MaterializedView, DataCollection); -module.exports = MaterializedView; \ No newline at end of file +export default MaterializedView; \ No newline at end of file diff --git a/lib/metadata/schema-function.ts b/lib/metadata/schema-function.ts index 40105c07..385263e0 100644 --- a/lib/metadata/schema-function.ts +++ b/lib/metadata/schema-function.ts @@ -94,4 +94,4 @@ function SchemaFunction() { this.monotonicOn = null; } -module.exports = SchemaFunction; \ No newline at end of file +export default SchemaFunction; \ No newline at end of file diff --git a/lib/metadata/schema-index.ts b/lib/metadata/schema-index.ts index 8787bad2..cad3d34f 100644 --- a/lib/metadata/schema-index.ts +++ b/lib/metadata/schema-index.ts @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const util = require('util'); -const utils = require('../utils'); -const types = require('../types'); +import util from "util"; +import utils from "../utils.js"; +import types from "../types/index.js"; +'use strict'; /** @private */ const kind = { custom: 0, @@ -146,4 +146,4 @@ function getKindByName(name) { return kind[name.toLowerCase()]; } -module.exports = Index; \ No newline at end of file +export default Index; \ No newline at end of file diff --git a/lib/metadata/schema-parser.ts b/lib/metadata/schema-parser.ts index af05a3b6..b6958364 100644 --- a/lib/metadata/schema-parser.ts +++ b/lib/metadata/schema-parser.ts @@ -13,19 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import util from "util"; +import events from "events"; +import types from "../types/index.js"; +import utils from "../utils.js"; +import errors from "../errors.js"; +import promiseUtils from "../promise-utils.js"; +import TableMetadata from "./table-metadata.js"; +import Aggregate from "./aggregate.js"; +import SchemaFunction from "./schema-function.js"; +import Index from "./schema-index.js"; +import MaterializedView from "./materialized-view.js"; 'use strict'; -const util = require('util'); -const events = require('events'); -const types = require('../types'); -const utils = require('../utils'); -const errors = require('../errors'); -const promiseUtils = require('../promise-utils'); -const TableMetadata = require('./table-metadata'); -const Aggregate = require('./aggregate'); -const SchemaFunction = require('./schema-function'); -const Index = require('./schema-index'); -const MaterializedView = require('./materialized-view'); const { format } = util; /** diff --git a/lib/metadata/table-metadata.ts b/lib/metadata/table-metadata.ts index 87e171ef..e5992c68 100644 --- a/lib/metadata/table-metadata.ts +++ b/lib/metadata/table-metadata.ts @@ -13,10 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import util from "util"; +import DataCollection from "./data-collection.js"; + 'use strict'; -const util = require('util'); -const DataCollection = require('./data-collection'); /** * Creates a new instance of TableMetadata * @classdesc Describes a table @@ -74,4 +75,4 @@ function TableMetadata(name) { util.inherits(TableMetadata, DataCollection); -module.exports = TableMetadata; \ No newline at end of file +export default TableMetadata; \ No newline at end of file diff --git a/lib/metrics/client-metrics.ts b/lib/metrics/client-metrics.ts index 88fe073e..e7b9a61c 100644 --- a/lib/metrics/client-metrics.ts +++ b/lib/metrics/client-metrics.ts @@ -126,4 +126,4 @@ class ClientMetrics { } } -module.exports = ClientMetrics; \ No newline at end of file +export default ClientMetrics; \ No newline at end of file diff --git a/lib/metrics/default-metrics.ts b/lib/metrics/default-metrics.ts index 1df5dfae..8926d6e5 100644 --- a/lib/metrics/default-metrics.ts +++ b/lib/metrics/default-metrics.ts @@ -13,12 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import ClientMetrics from "./client-metrics.js"; +import EventEmitter from "events"; 'use strict'; -const ClientMetrics = require('./client-metrics'); -const EventEmitter = require('events'); - /** * A default implementation of [ClientMetrics]{@link module:metrics~ClientMetrics} that exposes the driver events as * Node.js events. @@ -195,4 +194,4 @@ class DefaultMetrics extends ClientMetrics { } } -module.exports = DefaultMetrics; \ No newline at end of file +export default DefaultMetrics; \ No newline at end of file diff --git a/lib/metrics/index.ts b/lib/metrics/index.ts index 9afb03a0..2389e763 100644 --- a/lib/metrics/index.ts +++ b/lib/metrics/index.ts @@ -13,16 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import ClientMetrics from "./client-metrics.js"; +import DefaultMetrics from "./default-metrics.js"; -'use strict'; - -const ClientMetrics = require('./client-metrics'); -const DefaultMetrics = require('./default-metrics'); - -/** - * The metrics module contains interfaces and implementations used by the driver to expose - * measurements of its internal behavior and of the server as seen from the driver side. - * @module metrics - */ - -module.exports = { ClientMetrics, DefaultMetrics }; \ No newline at end of file +'use strict'; \ No newline at end of file diff --git a/lib/operation-state.ts b/lib/operation-state.ts index 8fe623d1..608a6a32 100644 --- a/lib/operation-state.ts +++ b/lib/operation-state.ts @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; +import util from "util"; +import utils from "./utils.js"; +import errors from "./errors.js"; +import requests from "./requests.js"; -const util = require('util'); -const utils = require('./utils'); -const errors = require('./errors'); -const requests = require('./requests'); +'use strict'; const ExecuteRequest = requests.ExecuteRequest; const QueryRequest = requests.QueryRequest; @@ -161,4 +161,4 @@ class OperationState { } } -module.exports = OperationState; \ No newline at end of file +export default OperationState; \ No newline at end of file diff --git a/lib/policies/address-resolution.ts b/lib/policies/address-resolution.ts index e0a0fc0b..7964384f 100644 --- a/lib/policies/address-resolution.ts +++ b/lib/policies/address-resolution.ts @@ -13,10 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import dns from "dns"; +import util from "util"; +import utils from "../utils.js"; + 'use strict'; -const dns = require('dns'); -const util = require('util'); -const utils = require('../utils'); + /** @module policies/addressResolution */ /** * @class diff --git a/lib/policies/load-balancing.ts b/lib/policies/load-balancing.ts index 542ee792..30b3ab14 100644 --- a/lib/policies/load-balancing.ts +++ b/lib/policies/load-balancing.ts @@ -13,13 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; - -const util = require('util'); -const types = require('../types'); -const utils = require('../utils'); -const errors = require('../errors'); +import util from "util"; +import types from "../types/index.js"; +import utils from "../utils.js"; +import errors from "../errors.js"; +'use strict'; const doneIteratorObject = Object.freeze({ done: true }); const newlyUpInterval = 60000; @@ -869,15 +868,4 @@ function setLocalDc(lbp, client, hosts) { function getDataCenters(hosts) { return new Set(hosts.values().map(h => h.datacenter)); -} - -module.exports = { - AllowListPolicy, - DCAwareRoundRobinPolicy, - DefaultLoadBalancingPolicy, - LoadBalancingPolicy, - RoundRobinPolicy, - TokenAwarePolicy, - // Deprecated: for backward compatibility only. - WhiteListPolicy -}; \ No newline at end of file +} \ No newline at end of file diff --git a/lib/policies/reconnection.ts b/lib/policies/reconnection.ts index fa6a899a..925d234e 100644 --- a/lib/policies/reconnection.ts +++ b/lib/policies/reconnection.ts @@ -13,8 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import util from "util"; + 'use strict'; -const util = require('util'); /** @module policies/reconnection */ /** diff --git a/lib/policies/retry.ts b/lib/policies/retry.ts index 370d6c5d..4a7ea29f 100644 --- a/lib/policies/retry.ts +++ b/lib/policies/retry.ts @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const util = require('util'); +import util from "util"; +'use strict'; /** @module policies/retry */ /** diff --git a/lib/policies/speculative-execution.ts b/lib/policies/speculative-execution.ts index 7705802c..4c0b7034 100644 --- a/lib/policies/speculative-execution.ts +++ b/lib/policies/speculative-execution.ts @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; +import util from "util"; +import errors from "../errors.js"; -const util = require('util'); -const errors = require('../errors'); +'use strict'; /** @module policies/speculativeExecution */ diff --git a/lib/policies/timestamp-generation.ts b/lib/policies/timestamp-generation.ts index dbae075e..8d83f77f 100644 --- a/lib/policies/timestamp-generation.ts +++ b/lib/policies/timestamp-generation.ts @@ -13,12 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; - -const util = require('util'); -const { Long } = require('../types'); -const errors = require('../errors'); +import util from "util"; +import { Long } from "../types/index.js"; +import errors from "../errors.js"; +'use strict'; /** @module policies/timestampGeneration */ /** diff --git a/lib/prepare-handler.ts b/lib/prepare-handler.ts index 0edaa60d..ad0e4212 100644 --- a/lib/prepare-handler.ts +++ b/lib/prepare-handler.ts @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; +import errors from "./errors.js"; +import utils from "./utils.js"; +import types from "./types/index.js"; +import promiseUtils from "./promise-utils.js"; -const errors = require('./errors'); -const utils = require('./utils'); -const types = require('./types'); -const promiseUtils = require('./promise-utils'); +'use strict'; /** * Encapsulates the logic for dealing with the different prepare request and response flows, including failover when @@ -294,4 +294,4 @@ class PrepareHandler { } } -module.exports = PrepareHandler; \ No newline at end of file +export default PrepareHandler; \ No newline at end of file diff --git a/lib/promise-utils.ts b/lib/promise-utils.ts index 1fc56802..06bd1ffa 100644 --- a/lib/promise-utils.ts +++ b/lib/promise-utils.ts @@ -162,16 +162,4 @@ function toCallback(promise, callback) { result => process.nextTick(() => callback(null, result)), // Avoid marking the promise as rejected err => process.nextTick(() => callback(err))); -} - -module.exports = { - delay, - fromCallback, - fromEvent, - getCallback, - newQueryPlan, - optionalCallback, - times, - toBackground, - toCallback -}; \ No newline at end of file +} \ No newline at end of file diff --git a/lib/readers.ts b/lib/readers.ts index 57f0e0f7..e533d274 100644 --- a/lib/readers.ts +++ b/lib/readers.ts @@ -13,14 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import util from "util"; +import utils from "./utils.js"; +import types from "./types/index.js"; +import errors from "./errors.js"; 'use strict'; - -const util = require('util'); -const utils = require('./utils'); -const types = require('./types'); -const errors = require('./errors'); - /** * Information on the formatting of the returned rows */ @@ -538,5 +536,3 @@ class FrameReader { return result; } } - -module.exports = { FrameReader }; diff --git a/lib/request-execution.ts b/lib/request-execution.ts index 00cd9a5f..3ca7054e 100644 --- a/lib/request-execution.ts +++ b/lib/request-execution.ts @@ -13,15 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; - -const errors = require('./errors'); -const requests = require('./requests'); -const retry = require('./policies/retry'); -const types = require('./types'); -const utils = require('./utils'); -const promiseUtils = require('./promise-utils'); +import errors from "./errors.js"; +import requests from "./requests.js"; +import retry from "./policies/retry.js"; +import types from "./types/index.js"; +import utils from "./utils.js"; +import promiseUtils from "./promise-utils.js"; +'use strict'; const retryOnCurrentHost = Object.freeze({ decision: retry.RetryPolicy.retryDecision.retry, useCurrentHost: true, @@ -494,4 +493,4 @@ class RequestExecution { } } -module.exports = RequestExecution; \ No newline at end of file +export default RequestExecution; \ No newline at end of file diff --git a/lib/request-handler.ts b/lib/request-handler.ts index c1c7b6da..d079d34f 100644 --- a/lib/request-handler.ts +++ b/lib/request-handler.ts @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const util = require('util'); +import util from "util"; +import errors from "./errors.js"; +import types from "./types/index.js"; +import utils from "./utils.js"; +import RequestExecution from "./request-execution.js"; +import promiseUtils from "./promise-utils.js"; -const errors = require('./errors'); -const types = require('./types'); -const utils = require('./utils'); -const RequestExecution = require('./request-execution'); -const promiseUtils = require('./promise-utils'); +'use strict'; /** * Handles a BATCH, QUERY and EXECUTE request to the server, dealing with host fail-over and retries on error @@ -308,4 +308,4 @@ class RequestHandler { } } -module.exports = RequestHandler; +export default RequestHandler; diff --git a/lib/requests.ts b/lib/requests.ts index 443347ee..505f75c0 100644 --- a/lib/requests.ts +++ b/lib/requests.ts @@ -13,15 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const util = require('util'); - -const { FrameWriter } = require('./writers'); -const types = require('./types'); -const utils = require('./utils'); -const { ExecutionOptions } = require('./execution-options'); -const packageInfo = require('../package.json'); +import util from "util"; +import { FrameWriter } from "./writers.js"; +import types from "./types/index.js"; +import utils from "./utils.js"; +import { ExecutionOptions } from "./execution-options.js"; +import packageInfo from "../package.json" with { type: "json" }; +'use strict'; /** * Options for the execution of the query / prepared statement * @private diff --git a/lib/stream-id-stack.ts b/lib/stream-id-stack.ts index 7947af79..25b12804 100644 --- a/lib/stream-id-stack.ts +++ b/lib/stream-id-stack.ts @@ -13,10 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; - -const types = require('./types'); +import types from "./types/index.js"; +'use strict'; /** * Group size * @type {number} @@ -197,4 +196,4 @@ function generateGroup(initialValue) { return arr; } -module.exports = StreamIdStack; \ No newline at end of file +export default StreamIdStack; \ No newline at end of file diff --git a/lib/streams.ts b/lib/streams.ts index 158cc8b7..04a199b9 100644 --- a/lib/streams.ts +++ b/lib/streams.ts @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import util from "util"; +import { Transform, Writable } from "stream"; +import types from "./types/index.js"; +import utils from "./utils.js"; +import errors from "./errors.js"; +import { FrameReader } from "./readers.js"; 'use strict'; - -const util = require('util'); -const { Transform, Writable } = require('stream'); - -const types = require('./types'); -const utils = require('./utils'); -const errors = require('./errors'); const { FrameHeader } = types; -const { FrameReader } = require('./readers'); /** * Transforms chunks, emits data objects {header, chunk} diff --git a/lib/token.ts b/lib/token.ts index dabed71f..9ad86d7f 100644 --- a/lib/token.ts +++ b/lib/token.ts @@ -13,11 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; - -const types = require('./types'); -const util = require('util'); +import types from "./types/index.js"; +import util from "util"; +'use strict'; const _Murmur3TokenType = types.dataTypes.getByName('bigint'); const _RandomTokenType = types.dataTypes.getByName('varint'); const _OrderedTokenType = types.dataTypes.getByName('blob'); diff --git a/lib/tokenizer.ts b/lib/tokenizer.ts index 57340e65..d99d53d0 100644 --- a/lib/tokenizer.ts +++ b/lib/tokenizer.ts @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; +import types from "./types/index.js"; +import token from "./token.js"; +import utils from "./utils.js"; +import MutableLong from "./types/mutable-long.js"; -const types = require('./types'); -const token = require('./token'); -const utils = require('./utils'); -const MutableLong = require('./types/mutable-long'); +'use strict'; const { Integer } = types; // Murmur3 constants diff --git a/lib/tracker/request-logger.ts b/lib/tracker/request-logger.ts index da3d2085..47d73148 100644 --- a/lib/tracker/request-logger.ts +++ b/lib/tracker/request-logger.ts @@ -13,14 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import events from "events"; +import RequestTracker from "./request-tracker.js"; +import errors from "../errors.js"; +import { format } from "util"; 'use strict'; - -const events = require('events'); -const RequestTracker = require('./request-tracker'); -const errors = require('../errors'); -const { format } = require('util'); - const nanosToMillis = 1000000; const defaultMessageMaxQueryLength = 500; const defaultMaxParameterValueLength = 50; @@ -291,4 +289,4 @@ function formatSize(length) { return length > 1000 ? Math.round(length / 1024) + ' KB' : length + ' bytes'; } -module.exports = RequestLogger; \ No newline at end of file +export default RequestLogger; \ No newline at end of file diff --git a/lib/tracker/request-tracker.ts b/lib/tracker/request-tracker.ts index 3a00732e..71e89119 100644 --- a/lib/tracker/request-tracker.ts +++ b/lib/tracker/request-tracker.ts @@ -71,4 +71,4 @@ class RequestTracker { } } -module.exports = RequestTracker; \ No newline at end of file +export default RequestTracker; \ No newline at end of file diff --git a/lib/types/big-decimal.ts b/lib/types/big-decimal.ts index 39ec9f7b..bf755193 100644 --- a/lib/types/big-decimal.ts +++ b/lib/types/big-decimal.ts @@ -13,9 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import Integer from "./integer.js"; +import utils from "../utils.js"; + 'use strict'; -const Integer = require('./integer'); -const utils = require('../utils'); /** @module types */ /** @@ -267,5 +268,4 @@ BigDecimal.prototype.toJSON = function () { return this.toString(); }; - -module.exports = BigDecimal; \ No newline at end of file +export default BigDecimal; \ No newline at end of file diff --git a/lib/types/duration.ts b/lib/types/duration.ts index aa1b4197..54fa3e2e 100644 --- a/lib/types/duration.ts +++ b/lib/types/duration.ts @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const Long = require('long'); -const util = require('util'); -const utils = require('../utils'); +import Long from "long"; +import util from "util"; +import utils from "../utils.js"; +'use strict'; /** @module types */ // Reuse the same buffers that should perform slightly better than built-in buffer pool @@ -711,4 +711,4 @@ const VIntCoding = (function () { }; })(); -module.exports = Duration; +export default Duration; diff --git a/lib/types/index.ts b/lib/types/index.ts index 953295a0..56dfde67 100644 --- a/lib/types/index.ts +++ b/lib/types/index.ts @@ -13,22 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const util = require('util'); - -const errors = require('../errors'); -const TimeUuid = require('./time-uuid'); -const Uuid = require('./uuid'); -const protocolVersion = require('./protocol-version'); -const utils = require('../utils'); - -/** @module types */ -/** - * Long constructor, wrapper of the internal library used: {@link https://github.com/dcodeIO/long.js Long.js}. - * @constructor - */ -const Long = require('long'); +import util from "util"; +import errors from "../errors.js"; +import TimeUuid from "./time-uuid.js"; +import Uuid from "./uuid.js"; +import protocolVersion from "./protocol-version.js"; +import utils from "../utils.js"; +import Long from "long"; +'use strict'; /** * Consistency levels * @type {Object} diff --git a/lib/types/inet-address.ts b/lib/types/inet-address.ts index 1647deaf..1edacb04 100644 --- a/lib/types/inet-address.ts +++ b/lib/types/inet-address.ts @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; +import utils from "../utils.js"; -const utils = require('../utils'); +'use strict'; /** @module types */ /** @@ -245,4 +245,4 @@ function isValidIPv4Mapped(buffer) { return !(buffer[10] !== 255 || buffer[11] !== 255); } -module.exports = InetAddress; \ No newline at end of file +export default InetAddress; \ No newline at end of file diff --git a/lib/types/integer.ts b/lib/types/integer.ts index d70d789a..6f05ef2c 100644 --- a/lib/types/integer.ts +++ b/lib/types/integer.ts @@ -1,3 +1,5 @@ +import utils from "../utils.js"; + // Copyright 2009 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -12,10 +14,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -/** @module types */ - -var utils = require('../utils'); - /** * Constructs a two's-complement integer an array containing bits of the * integer in 32-bit (signed) pieces, given in little-endian order (i.e., @@ -852,4 +850,4 @@ Integer.prototype.toJSON = function () { return this.toString(); }; -module.exports = Integer; +export default Integer; diff --git a/lib/types/local-date.ts b/lib/types/local-date.ts index 9651d735..a3fd09ca 100644 --- a/lib/types/local-date.ts +++ b/lib/types/local-date.ts @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const util = require('util'); +import util from "util"; +import utils from "../utils.js"; -const utils = require('../utils'); +'use strict'; /** @module types */ /** @@ -249,4 +249,4 @@ function fillZeros(value, amount) { return utils.stringRepeat('0', amount - value.length) + value; } -module.exports = LocalDate; \ No newline at end of file +export default LocalDate; \ No newline at end of file diff --git a/lib/types/local-time.ts b/lib/types/local-time.ts index 0e320cc9..468d23b9 100644 --- a/lib/types/local-time.ts +++ b/lib/types/local-time.ts @@ -13,10 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import Long from "long"; +import util from "util"; +import utils from "../utils.js"; + 'use strict'; -const Long = require('long'); -const util = require('util'); -const utils = require('../utils'); /** @module types */ /** @@ -292,4 +293,4 @@ function formatTime(values) { return result; } -module.exports = LocalTime; \ No newline at end of file +export default LocalTime; \ No newline at end of file diff --git a/lib/types/mutable-long.ts b/lib/types/mutable-long.ts index 43992d50..8569d056 100644 --- a/lib/types/mutable-long.ts +++ b/lib/types/mutable-long.ts @@ -13,10 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -"use strict"; - -const Long = require('long'); +import Long from "long"; +"use strict"; const TWO_PWR_16_DBL = 1 << 16; const TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL; @@ -326,4 +325,4 @@ class MutableLong { MutableLong.one = new MutableLong(1, 0, 0, 0); -module.exports = MutableLong; \ No newline at end of file +export default MutableLong; \ No newline at end of file diff --git a/lib/types/protocol-version.ts b/lib/types/protocol-version.ts index 4accf2b6..2a0f805e 100644 --- a/lib/types/protocol-version.ts +++ b/lib/types/protocol-version.ts @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; +import utils from "../utils.js"; +import VersionNumber from "./version-number.js"; -const utils = require('../utils'); -const VersionNumber = require('./version-number'); +'use strict'; const v200 = VersionNumber.parse('2.0.0'); const v210 = VersionNumber.parse('2.1.0'); const v220 = VersionNumber.parse('2.2.0'); @@ -346,4 +346,4 @@ const protocolVersion = { } }; -module.exports = protocolVersion; \ No newline at end of file +export default protocolVersion; \ No newline at end of file diff --git a/lib/types/result-set.ts b/lib/types/result-set.ts index 4137ddb0..e6a6931a 100644 --- a/lib/types/result-set.ts +++ b/lib/types/result-set.ts @@ -13,12 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import utils from "../utils.js"; +import errors from "../errors.js"; 'use strict'; - -const utils = require('../utils'); -const errors = require('../errors'); - const asyncIteratorSymbol = Symbol.asyncIterator || '@@asyncIterator'; /** @module types */ @@ -272,4 +270,4 @@ ResultSet.prototype.isPaged = function() { return !!this.rawPageState; }; -module.exports = ResultSet; \ No newline at end of file +export default ResultSet; \ No newline at end of file diff --git a/lib/types/result-stream.ts b/lib/types/result-stream.ts index 90cb64c7..c95ca262 100644 --- a/lib/types/result-stream.ts +++ b/lib/types/result-stream.ts @@ -13,14 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { Readable } from "stream"; +import utils from "../utils.js"; +import errors from "../errors.js"; +import clientOptions from "../client-options.js"; 'use strict'; -const { Readable } = require('stream'); -const utils = require('../utils'); -const errors = require('../errors'); -const clientOptions = require('../client-options'); - /** @module types */ /** * Readable stream using to yield data from a result or a field @@ -145,4 +144,4 @@ class ResultStream extends Readable { } } -module.exports = ResultStream; \ No newline at end of file +export default ResultStream; \ No newline at end of file diff --git a/lib/types/row.ts b/lib/types/row.ts index fca71321..61e957fc 100644 --- a/lib/types/row.ts +++ b/lib/types/row.ts @@ -77,4 +77,4 @@ Row.prototype.forEach = function (callback) { } }; -module.exports = Row; \ No newline at end of file +export default Row; \ No newline at end of file diff --git a/lib/types/time-uuid.ts b/lib/types/time-uuid.ts index d4caae67..4ab69ba3 100644 --- a/lib/types/time-uuid.ts +++ b/lib/types/time-uuid.ts @@ -13,14 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const util = require('util'); -const crypto = require('crypto'); -const Long = require('long'); - -const Uuid = require('./uuid'); -const utils = require('../utils'); +import util from "util"; +import crypto from "crypto"; +import Long from "long"; +import Uuid from "./uuid.js"; +import utils from "../utils.js"; +'use strict'; /** @module types */ /** * Oct 15, 1582 in milliseconds since unix epoch @@ -407,4 +406,4 @@ function generateBuffer(date, ticks, nodeId, clockId) { return buffer; } -module.exports = TimeUuid; \ No newline at end of file +export default TimeUuid; \ No newline at end of file diff --git a/lib/types/tuple.ts b/lib/types/tuple.ts index f8989ccb..f3e415f0 100644 --- a/lib/types/tuple.ts +++ b/lib/types/tuple.ts @@ -99,4 +99,4 @@ Tuple.prototype.values = function () { return this.elements.slice(0); }; -module.exports = Tuple; \ No newline at end of file +export default Tuple; \ No newline at end of file diff --git a/lib/types/uuid.ts b/lib/types/uuid.ts index 56281d58..9ec0d3ca 100644 --- a/lib/types/uuid.ts +++ b/lib/types/uuid.ts @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; +import crypto from "crypto"; +import utils from "../utils.js"; -const crypto = require('crypto'); -const utils = require('../utils'); +'use strict'; /** @module types */ @@ -150,4 +150,4 @@ function getRandomBytes (cb) { return crypto.randomBytes(16, cb); } -module.exports = Uuid; +export default Uuid; diff --git a/lib/types/version-number.ts b/lib/types/version-number.ts index 7f5b7430..bbbe8189 100644 --- a/lib/types/version-number.ts +++ b/lib/types/version-number.ts @@ -141,4 +141,4 @@ class VersionNumber { } } -module.exports = VersionNumber; \ No newline at end of file +export default VersionNumber; \ No newline at end of file diff --git a/lib/utils.ts b/lib/utils.ts index 395f122c..77c97687 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -13,15 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; - -const util = require('util'); -const net = require('net'); -const { EventEmitter } = require('events'); - -const errors = require('./errors'); -const promiseUtils = require('./promise-utils'); +import util from "util"; +import net from "net"; +import { EventEmitter } from "events"; +import errors from "./errors.js"; +import promiseUtils from "./promise-utils.js"; +'use strict'; /** * Max int that can be accurately represented with 64-bit Number (2^53) * @type {number} diff --git a/lib/writers.ts b/lib/writers.ts index aa5655f9..7a3bdb95 100644 --- a/lib/writers.ts +++ b/lib/writers.ts @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const events = require('events'); +import events from "events"; +import types from "./types/index.js"; +import utils from "./utils.js"; -const types = require('./types'); -const utils = require('./utils'); +'use strict'; const FrameHeader = types.FrameHeader; /** @@ -306,5 +306,3 @@ class WriteQueue extends events.EventEmitter { } } } - -module.exports = { FrameWriter, WriteQueue }; diff --git a/package.json b/package.json index a341b3fb..2c5a7091 100644 --- a/package.json +++ b/package.json @@ -1,62 +1,61 @@ { - "name": "@SiyaoIsHiding/cassandra-driver", - "version": "0.0.8", - "description": "DataStax Node.js Driver for Apache Cassandra", - "author": "DataStax", - "main": "out/index.js", - "types": "out/index.d.ts", - "keywords": [ - "cassandra", - "cql", - "cql3", - "connection", - "gremlin", - "datastax", - "nosql", - "driver", - "database", - "dse", - "graph", - "graphdb" - ], - "license": "Apache-2.0", - "dependencies": { - "@types/node": "^18.11.18", - "adm-zip": "~0.5.10", - "long": "~5.2.3" - }, - "devDependencies": { - "@types/mocha": "^10.0.10", - "chai": "~4.3.8", - "kerberos": "~2.0.3", - "mocha": "~10.2.0", - "mocha-jenkins-reporter": "~0.4.8", - "proxyquire": "~2.1.3", - "sinon": "~15.2.0", - "temp": ">= 0.8.3", - "ts-mocha": "^10.0.0", - "typescript": "^5.7.3" - }, - "repository": { - "type": "git", - "url": "https://github.com/datastax/nodejs-driver.git" - }, - "bugs": { - "url": "https://groups.google.com/a/lists.datastax.com/forum/#!forum/nodejs-driver-user" - }, - "scripts": { - "test": "./node_modules/.bin/mocha test/unit -R spec -t 5000 --recursive", - "unit": "./node_modules/.bin/mocha test/unit -R spec -t 5000 --recursive", - "integration_short": "./node_modules/.bin/mocha test/integration/short -R spec -t 5000 --recursive", - "integration_long": "./node_modules/.bin/mocha test/integration/long -R spec -t 5000 --recursive", - "ci_jenkins": "./node_modules/.bin/mocha test/unit test/integration/short --recursive -R mocha-jenkins-reporter --exit", - "ci_appveyor": ".\\\"node_modules/.bin/mocha\" test/unit test/integration/short --recursive -R mocha-appveyor-reporter --exit", - "ci_unit_appveyor": ".\\\"node_modules/.bin/mocha\" test/unit --recursive -R mocha-appveyor-reporter --exit", - "server_api": "./node_modules/.bin/mocha test/integration/short -g '@SERVER_API' --recursive --exit", - "eslint": "eslint lib test", - "test-ts": "npx ts-mocha test/unit test/integration/short --extension .ts --recursive --exit" - }, - "engines": { - "node": ">=16" - } -} + "name": "@SiyaoIsHiding/cassandra-driver", + "version": "0.0.8", + "description": "DataStax Node.js Driver for Apache Cassandra", + "author": "DataStax", + "main": "out/index.js", + "types": "out/index.d.ts", + "keywords": [ + "cassandra", + "cql", + "cql3", + "connection", + "gremlin", + "datastax", + "nosql", + "driver", + "database", + "dse", + "graph", + "graphdb" + ], + "license": "Apache-2.0", + "dependencies": { + "@types/node": "^18.11.18", + "adm-zip": "~0.5.10", + "long": "~5.2.3" + }, + "devDependencies": { + "@types/mocha": "^10.0.10", + "chai": "~4.3.8", + "kerberos": "~2.0.3", + "mocha": "~10.2.0", + "mocha-jenkins-reporter": "~0.4.8", + "proxyquire": "~2.1.3", + "sinon": "~15.2.0", + "temp": ">= 0.8.3", + "ts-mocha": "^10.0.0", + "typescript": "^5.7.3" + }, + "repository": { + "type": "git", + "url": "https://github.com/datastax/nodejs-driver.git" + }, + "bugs": { + "url": "https://groups.google.com/a/lists.datastax.com/forum/#!forum/nodejs-driver-user" + }, + "scripts": { + "test": "./node_modules/.bin/mocha test/unit -R spec -t 5000 --recursive", + "unit": "./node_modules/.bin/mocha test/unit -R spec -t 5000 --recursive", + "integration_short": "./node_modules/.bin/mocha test/integration/short -R spec -t 5000 --recursive", + "integration_long": "./node_modules/.bin/mocha test/integration/long -R spec -t 5000 --recursive", + "ci_jenkins": "./node_modules/.bin/mocha test/unit test/integration/short --recursive -R mocha-jenkins-reporter --exit", + "ci_appveyor": ".\\\"node_modules/.bin/mocha\" test/unit test/integration/short --recursive -R mocha-appveyor-reporter --exit", + "ci_unit_appveyor": ".\\\"node_modules/.bin/mocha\" test/unit --recursive -R mocha-appveyor-reporter --exit", + "server_api": "./node_modules/.bin/mocha test/integration/short -g '@SERVER_API' --recursive --exit", + "eslint": "eslint lib test", + "test-ts": "npx ts-mocha test/unit test/integration/short --extension .ts --recursive --exit" + }, + "engines": {"node": ">=16"}, + "type": "module" +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 0b6bfad9..bbb25a62 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,25 +1,21 @@ { - "compilerOptions": { - "module": "commonjs", - "lib": ["es2015"], - "target": "es2015", - "sourceMap": true, - "strict": false, - "noImplicitAny": false, - "outDir": "out", - "declaration": true, - "allowJs": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "declarationMap": true, - "moduleDetection": "force" - }, - "include": [ - "lib/**/*.ts", - "index.ts" - ], - "exclude": [ - "node_modules" - ] + "compilerOptions": { + "module": "nodenext", + "lib": ["es2015"], + "target": "es2015", + "sourceMap": true, + "strict": false, + "noImplicitAny": false, + "outDir": "out", + "declaration": true, + "allowJs": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "declarationMap": true, + "moduleDetection": "force", + "moduleResolution": "nodenext" + }, + "include": ["lib/**/*.ts", "index.ts"], + "exclude": ["node_modules"] } \ No newline at end of file From 1becd83a1c393263eef50ae4afa6fdff2401fb29 Mon Sep 17 00:00:00 2001 From: janehe Date: Tue, 4 Mar 2025 15:41:41 -0800 Subject: [PATCH 10/19] works! export both default and named. Works for both esm and cjs. Cjs lacks IDE mouse hover hints. --- index.ts | 40 ++++---- lib/auth/index.ts | 35 ++++--- lib/client-options.ts | 35 +++++-- lib/client.ts | 7 +- lib/concurrent/index.ts | 11 ++- lib/datastax/cloud/index.ts | 12 ++- lib/datastax/graph/complex-type-helper.ts | 6 +- lib/datastax/graph/graph-serializer.ts | 11 ++- lib/datastax/graph/index.ts | 23 ++++- lib/datastax/graph/options.ts | 8 +- lib/datastax/graph/structure.ts | 11 ++- lib/datastax/graph/type-serializers.ts | 27 ++++++ lib/datastax/graph/wrappers.ts | 4 +- lib/datastax/index.ts | 10 +- lib/datastax/search/date-range.ts | 10 +- lib/datastax/search/index.ts | 7 +- lib/errors.ts | 20 ++-- lib/execution-options.ts | 4 +- lib/execution-profile.ts | 12 ++- lib/geometry/index.ts | 22 ++++- lib/host.ts | 12 ++- lib/insights-client.ts | 3 +- lib/mapping/index.ts | 40 ++++++-- lib/mapping/model-batch-item.ts | 4 +- lib/mapping/model-batch-mapper.ts | 2 +- lib/mapping/q.ts | 14 ++- lib/mapping/table-mappings.ts | 14 ++- lib/metadata/schema-parser.ts | 6 +- lib/metrics/index.ts | 5 +- lib/policies/address-resolution.ts | 6 +- lib/policies/index.ts | 71 ++++++++++---- lib/policies/load-balancing.ts | 24 ++++- lib/policies/reconnection.ts | 14 ++- lib/policies/retry.ts | 14 ++- lib/policies/speculative-execution.ts | 14 ++- lib/policies/timestamp-generation.ts | 13 ++- lib/promise-utils.ts | 14 ++- lib/readers.ts | 3 + lib/requests.ts | 40 +++++--- lib/streams.ts | 13 ++- lib/token.ts | 20 +++- lib/tokenizer.ts | 14 ++- lib/tracker/index.ts | 12 ++- lib/types/index.ts | 112 +++++++++++++++------- lib/utils.ts | 92 +++++++++--------- lib/writers.ts | 2 + package.json | 3 +- tsconfig.json | 41 ++++---- 48 files changed, 677 insertions(+), 260 deletions(-) diff --git a/index.ts b/index.ts index 5d2b50ed..d4f4dd0a 100644 --- a/index.ts +++ b/index.ts @@ -13,10 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const ExecutionProfile = require('./lib/execution-profile').ExecutionProfile; -const ExecutionOptions = require('./lib/execution-options').ExecutionOptions; -import * as auth from './lib/auth/index.js'; +import auth from './lib/auth/index.js'; import clientOptions from "./lib/client-options.js"; import Client from "./lib/client.js"; import types from "./lib/types/index.js"; @@ -26,12 +23,28 @@ import mapping from "./lib/mapping/index.js"; import tracker from "./lib/tracker/index.js"; import metrics from "./lib/metrics/index.js"; import concurrent from "./lib/concurrent/index.js"; -import token from "./lib/token.js"; +import Token from "./lib/token.js"; import Metadata from "./lib/metadata/index.js"; import Encoder from "./lib/encoder.js"; import geometry from "./lib/geometry/index.js"; import datastax from "./lib/datastax/index.js"; -export default { +import packageJson from './package.json'; + +import { ExecutionProfile } from './lib/execution-profile.js'; +import { ExecutionOptions } from './lib/execution-options.js'; + +const token = { + Token: Token.Token, + TokenRange: Token.TokenRange +} +const metadata = {Metadata: Metadata}; +const defaultOptions = function () { + return clientOptions.defaultOptions(); +} +const version = packageJson.version; + + +export { Client, ExecutionProfile, ExecutionOptions, @@ -43,21 +56,14 @@ export default { tracker, metrics, concurrent, - token: { - Token: token.Token, - TokenRange: token.TokenRange - }, - metadata: { - Metadata: Metadata - }, + token, + metadata, Encoder, geometry, datastax, /** * Returns a new instance of the default [options]{@link ClientOptions} used by the driver. */ - defaultOptions: function () { - return clientOptions.defaultOptions(); - }, - version: require('./package.json').version + defaultOptions, + version }; \ No newline at end of file diff --git a/lib/auth/index.ts b/lib/auth/index.ts index c89532ef..016a88b0 100644 --- a/lib/auth/index.ts +++ b/lib/auth/index.ts @@ -23,19 +23,26 @@ * @module auth */ -// import { Authenticator, AuthProvider } from './provider'; -// import { PlainTextAuthProvider } from './plain-text-auth-provider'; -// import DseGssapiAuthProvider from './dse-gssapi-auth-provider'; -// import DsePlainTextAuthProvider from './dse-plain-text-auth-provider'; -// import NoAuthProvider from './no-auth-provider'; +import { Authenticator, AuthProvider } from './provider.js'; +import { PlainTextAuthProvider } from './plain-text-auth-provider.js'; +import DseGssapiAuthProvider from './dse-gssapi-auth-provider.js'; +import DsePlainTextAuthProvider from './dse-plain-text-auth-provider.js'; +import NoAuthProvider from './no-auth-provider.js'; -// export { -// Authenticator, -// AuthProvider, -// DseGssapiAuthProvider, -// DsePlainTextAuthProvider, -// NoAuthProvider, -// PlainTextAuthProvider -// }; +export { + Authenticator, + AuthProvider, + DseGssapiAuthProvider, + DsePlainTextAuthProvider, + NoAuthProvider, + PlainTextAuthProvider +}; -export * from './provider.js'; +export default { + Authenticator, + AuthProvider, + DseGssapiAuthProvider, + DsePlainTextAuthProvider, + NoAuthProvider, + PlainTextAuthProvider +}; \ No newline at end of file diff --git a/lib/client-options.ts b/lib/client-options.ts index 9be63612..a6c1b2be 100644 --- a/lib/client-options.ts +++ b/lib/client-options.ts @@ -348,13 +348,28 @@ function setMetadataDependent(client) { {}, { coreConnectionsPerHost, maxRequestsPerConnection }, client.options.pooling); } -exports.extend = extend; -exports.defaultOptions = defaultOptions; -exports.coreConnectionsPerHostV2 = coreConnectionsPerHostV2; -exports.coreConnectionsPerHostV3 = coreConnectionsPerHostV3; -exports.maxRequestsPerConnectionV2 = maxRequestsPerConnectionV2; -exports.maxRequestsPerConnectionV3 = maxRequestsPerConnectionV3; -exports.setMetadataDependent = setMetadataDependent; -exports.continuousPageUnitBytes = continuousPageUnitBytes; -exports.continuousPageDefaultSize = continuousPageDefaultSize; -exports.continuousPageDefaultHighWaterMark = continuousPageDefaultHighWaterMark; +export { + extend, + defaultOptions, + coreConnectionsPerHostV2, + coreConnectionsPerHostV3, + maxRequestsPerConnectionV2, + maxRequestsPerConnectionV3, + setMetadataDependent, + continuousPageUnitBytes, + continuousPageDefaultSize, + continuousPageDefaultHighWaterMark +}; + +export default { + extend, + defaultOptions, + coreConnectionsPerHostV2, + coreConnectionsPerHostV3, + maxRequestsPerConnectionV2, + maxRequestsPerConnectionV3, + setMetadataDependent, + continuousPageUnitBytes, + continuousPageDefaultSize, + continuousPageDefaultHighWaterMark +}; \ No newline at end of file diff --git a/lib/client.ts b/lib/client.ts index cf34bbf5..3f1cd9c2 100644 --- a/lib/client.ts +++ b/lib/client.ts @@ -22,7 +22,6 @@ import { ProfileManager } from "./execution-profile.js"; import requests from "./requests.js"; import clientOptions from "./client-options.js"; import ClientState from "./metadata/client-state.js"; -import { version } from "../package.json" with { type: "json" }; import { DefaultExecutionOptions } from "./execution-options.js"; import ControlConnection from "./control-connection.js"; import RequestHandler from "./request-handler.js"; @@ -31,9 +30,13 @@ import InsightsClient from "./insights-client.js"; import cloud from "./datastax/cloud/index.js"; import GraphExecutor from "./datastax/graph/graph-executor.js"; import promiseUtils from "./promise-utils.js"; +import packageInfo from '../package.json' assert {type: 'json'}; 'use strict'; -const description = require('../package.json').description; + +const version = packageInfo.version; + +const description = packageInfo.description; /** * Max amount of pools being warmup in parallel, when warmup is enabled * @private diff --git a/lib/concurrent/index.ts b/lib/concurrent/index.ts index 368b9654..e505bc60 100644 --- a/lib/concurrent/index.ts +++ b/lib/concurrent/index.ts @@ -330,5 +330,12 @@ class ResultSetGroup { } } -exports.executeConcurrent = executeConcurrent; -exports.ResultSetGroup = ResultSetGroup; \ No newline at end of file +export { + executeConcurrent, + ResultSetGroup +}; + +export default { + executeConcurrent, + ResultSetGroup +}; \ No newline at end of file diff --git a/lib/datastax/cloud/index.ts b/lib/datastax/cloud/index.ts index 77963d62..3e60fb31 100644 --- a/lib/datastax/cloud/index.ts +++ b/lib/datastax/cloud/index.ts @@ -328,4 +328,14 @@ function checkParts(hostParts, pattern) { } return true; -} \ No newline at end of file +} + +export { + checkServerIdentity, + init +}; + +export default { + checkServerIdentity, + init +}; \ No newline at end of file diff --git a/lib/datastax/graph/complex-type-helper.ts b/lib/datastax/graph/complex-type-helper.ts index bf4e8212..d9c59443 100644 --- a/lib/datastax/graph/complex-type-helper.ts +++ b/lib/datastax/graph/complex-type-helper.ts @@ -93,4 +93,8 @@ function getUdtTypeDefinition(udtInfo) { function getUdtTypeDefinitionByValue(wrappedValue) { return getUdtTypeDefinition(wrappedValue.udtInfo); -} \ No newline at end of file +} + +export { + getTypeDefinitionByValue, + getUdtTypeDefinitionByValue }; \ No newline at end of file diff --git a/lib/datastax/graph/graph-serializer.ts b/lib/datastax/graph/graph-serializer.ts index 0519b761..857d9807 100644 --- a/lib/datastax/graph/graph-serializer.ts +++ b/lib/datastax/graph/graph-serializer.ts @@ -247,4 +247,13 @@ const graphSON3Serializers = graphSON2Serializers.concat([ typeSerializers.ListSerializer, typeSerializers.SetSerializer, typeSerializers.MapSerializer -]); \ No newline at end of file +]); + +export { + GraphSON3Writer, + GraphSON3Reader, + GraphSON2Writer, + GraphSON2Reader, + GraphSON3Writer as GraphSONWriter, + GraphSON3Reader as GraphSONReader +}; \ No newline at end of file diff --git a/lib/datastax/graph/index.ts b/lib/datastax/graph/index.ts index e59c0365..bf63df1c 100644 --- a/lib/datastax/graph/index.ts +++ b/lib/datastax/graph/index.ts @@ -53,4 +53,25 @@ const direction = { // `in` is a reserved keyword depending on the context // TinkerPop JavaScript GLV only exposes `in` but it can lead to issues for TypeScript users and others. // Expose an extra property to represent `Direction.IN`. -direction.in_ = direction.in; \ No newline at end of file +direction.in_ = direction.in; + +export default { + Edge, + Element, + Path, + Property, + Vertex, + VertexProperty, + + asInt, + asDouble, + asFloat, + asTimestamp, + asUdt, + direction, + getCustomTypeSerializers, + GraphResultSet, + GraphTypeWrapper, + t, + UdtGraphWrapper +}; \ No newline at end of file diff --git a/lib/datastax/graph/options.ts b/lib/datastax/graph/options.ts index 27185f46..23c351f9 100644 --- a/lib/datastax/graph/options.ts +++ b/lib/datastax/graph/options.ts @@ -326,4 +326,10 @@ class GraphExecutionOptions extends DefaultExecutionOptions { this.setCustomPayload(payload); } -} \ No newline at end of file +} + +export { + GraphExecutionOptions, + graphProtocol, + payloadKeys +}; \ No newline at end of file diff --git a/lib/datastax/graph/structure.ts b/lib/datastax/graph/structure.ts index 3a738c53..a239062b 100644 --- a/lib/datastax/graph/structure.ts +++ b/lib/datastax/graph/structure.ts @@ -154,4 +154,13 @@ function Property(key, value) { function Path(labels, objects) { this.labels = labels; this.objects = objects; -} \ No newline at end of file +} + +export { + Edge, + Element, + Path, + Property, + Vertex, + VertexProperty +}; \ No newline at end of file diff --git a/lib/datastax/graph/type-serializers.ts b/lib/datastax/graph/type-serializers.ts index 4c1185ad..7d874d11 100644 --- a/lib/datastax/graph/type-serializers.ts +++ b/lib/datastax/graph/type-serializers.ts @@ -472,3 +472,30 @@ class SetSerializer extends ArraySerializer { super('g:Set'); } } + +export default { + BulkSetSerializer, + BytecodeSerializer, + DateSerializer, + DirectionSerializer, + EdgeSerializer, + EnumSerializer, + LambdaSerializer, + ListSerializer, + LongSerializer, + MapSerializer, + NumberSerializer, + Path3Serializer, + PathSerializer, + PropertySerializer, + PSerializer, + TextPSerializer, + SetSerializer, + TSerializer, + TraverserSerializer, + TraversalStrategySerializer, + typeKey, + valueKey, + VertexPropertySerializer, + VertexSerializer +}; \ No newline at end of file diff --git a/lib/datastax/graph/wrappers.ts b/lib/datastax/graph/wrappers.ts index 799c4380..004a68d3 100644 --- a/lib/datastax/graph/wrappers.ts +++ b/lib/datastax/graph/wrappers.ts @@ -78,4 +78,6 @@ function asTimestamp(value) { return new GraphTypeWrapper(value, dataTypes.times * @param {object} value The object representing the UDT. * @param {{name: string, keyspace: string, fields: Array}} udtInfo The UDT metadata as defined by the driver. */ -function asUdt(value, udtInfo) { return new UdtGraphWrapper(value, udtInfo); } \ No newline at end of file +function asUdt(value, udtInfo) { return new UdtGraphWrapper(value, udtInfo); } + +export { asInt, asDouble, asFloat, asTimestamp, asUdt, UdtGraphWrapper, GraphTypeWrapper }; \ No newline at end of file diff --git a/lib/datastax/index.ts b/lib/datastax/index.ts index b193461a..ee29f737 100644 --- a/lib/datastax/index.ts +++ b/lib/datastax/index.ts @@ -24,5 +24,11 @@ * @module datastax */ -exports.graph = require('./graph'); -exports.search = require('./search'); \ No newline at end of file +import graph from "./graph/index.js"; +import { DateRange } from "./search/index.js"; + +export default { + graph, + DateRange +}; + diff --git a/lib/datastax/search/date-range.ts b/lib/datastax/search/date-range.ts index 7a2180cf..70c551a3 100644 --- a/lib/datastax/search/date-range.ts +++ b/lib/datastax/search/date-range.ts @@ -530,7 +530,9 @@ BoundaryBuilder.prototype.build = function () { return new DateRangeBound(date, this._index); }; -exports.unbounded = unbounded; -exports.dateRangePrecision = dateRangePrecision; -exports.DateRange = DateRange; -exports.DateRangeBound = DateRangeBound; \ No newline at end of file +export { + unbounded, + dateRangePrecision, + DateRange, + DateRangeBound +} \ No newline at end of file diff --git a/lib/datastax/search/index.ts b/lib/datastax/search/index.ts index c9c0d40d..b216f05b 100644 --- a/lib/datastax/search/index.ts +++ b/lib/datastax/search/index.ts @@ -13,9 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import dateRangeModule from "./date-range.js"; - 'use strict'; + /** * Search module. *

@@ -24,6 +23,4 @@ import dateRangeModule from "./date-range.js"; * @module datastax/search */ -exports.DateRange = dateRangeModule.DateRange; -exports.DateRangeBound = dateRangeModule.DateRangeBound; -exports.dateRangePrecision = dateRangeModule.dateRangePrecision; \ No newline at end of file +export * from "./date-range.js"; \ No newline at end of file diff --git a/lib/errors.ts b/lib/errors.ts index cef86fae..7edab180 100644 --- a/lib/errors.ts +++ b/lib/errors.ts @@ -166,12 +166,14 @@ function BusyConnectionError(address, maxRequestsPerConnection, connectionLength util.inherits(BusyConnectionError, DriverError); -exports.ArgumentError = ArgumentError; -exports.AuthenticationError = AuthenticationError; -exports.BusyConnectionError = BusyConnectionError; -exports.DriverError = DriverError; -exports.OperationTimedOutError = OperationTimedOutError; -exports.DriverInternalError = DriverInternalError; -exports.NoHostAvailableError = NoHostAvailableError; -exports.NotSupportedError = NotSupportedError; -exports.ResponseError = ResponseError; \ No newline at end of file +export default { + ArgumentError, + AuthenticationError, + BusyConnectionError, + DriverError, + OperationTimedOutError, + DriverInternalError, + NoHostAvailableError, + NotSupportedError, + ResponseError +} \ No newline at end of file diff --git a/lib/execution-options.ts b/lib/execution-options.ts index 3340d112..ab439fab 100644 --- a/lib/execution-options.ts +++ b/lib/execution-options.ts @@ -612,4 +612,6 @@ function ifUndefined3(v1, v2, v3) { return v1; } return v2 !== undefined ? v2 : v3; -} \ No newline at end of file +} + +export { ExecutionOptions, DefaultExecutionOptions, proxyExecuteKey }; \ No newline at end of file diff --git a/lib/execution-profile.ts b/lib/execution-profile.ts index ed97a359..8ac1c0f2 100644 --- a/lib/execution-profile.ts +++ b/lib/execution-profile.ts @@ -257,4 +257,14 @@ class ProfileManager { getDefaultConfiguredRetryPolicy() { return this._defaultConfiguredRetryPolicy; } -} \ No newline at end of file +} + +export { + ProfileManager, + ExecutionProfile +}; + +export default { + ProfileManager, + ExecutionProfile +}; \ No newline at end of file diff --git a/lib/geometry/index.ts b/lib/geometry/index.ts index 28c9bc7b..32cd0038 100644 --- a/lib/geometry/index.ts +++ b/lib/geometry/index.ts @@ -24,7 +24,21 @@ * @module geometry */ -exports.Geometry = require('./geometry'); -exports.LineString = require('./line-string'); -exports.Point = require('./point'); -exports.Polygon = require('./polygon'); \ No newline at end of file +import Point from './point.js'; +import LineString from './line-string.js'; +import Polygon from './polygon.js'; +import Geometry from './geometry.js'; + +export default { + Point, + LineString, + Polygon, + Geometry +} + +export { + Point, + LineString, + Polygon, + Geometry +} \ No newline at end of file diff --git a/lib/host.ts b/lib/host.ts index eccdedbd..f1ed776f 100644 --- a/lib/host.ts +++ b/lib/host.ts @@ -647,4 +647,14 @@ class HostMap extends events.EventEmitter{ return obj; } -} \ No newline at end of file +} + +export { + Host, + HostMap +}; + +export default { + Host, + HostMap +}; \ No newline at end of file diff --git a/lib/insights-client.ts b/lib/insights-client.ts index b8004741..400f122d 100644 --- a/lib/insights-client.ts +++ b/lib/insights-client.ts @@ -24,8 +24,9 @@ import promiseUtils from "./promise-utils.js"; import types from "./types/index.js"; import requests from "./requests.js"; import { ExecutionOptions } from "./execution-options.js"; -import packageInfo from "../package.json" with { type: "json" }; +import packageInfo from "../package.json" assert {type: 'json'}; import VersionNumber from "./types/version-number.js"; +import { assert } from 'console'; let kerberosModule; diff --git a/lib/mapping/index.ts b/lib/mapping/index.ts index 193de298..7ba0468f 100644 --- a/lib/mapping/index.ts +++ b/lib/mapping/index.ts @@ -13,7 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import tableMappingsModule from "./table-mappings.js"; +import Mapper from './mapper.js'; +import ModelMapper from "./model-mapper.js"; +import ModelBatchMapper from "./model-batch-mapper.js"; +import { ModelBatchItem } from './model-batch-item.js'; +import Result from "./result.js"; +import { q } from "./q.js"; +import {TableMappings, DefaultTableMappings, UnderscoreCqlToCamelCaseMappings} from "./table-mappings.js"; 'use strict'; @@ -22,12 +28,26 @@ import tableMappingsModule from "./table-mappings.js"; * @module mapping */ -exports.Mapper = require('./mapper'); -exports.ModelMapper = require('./model-mapper'); -exports.ModelBatchMapper = require('./model-batch-mapper'); -exports.ModelBatchItem = require('./model-batch-item').ModelBatchItem; -exports.Result = require('./result'); -exports.TableMappings = tableMappingsModule.TableMappings; -exports.DefaultTableMappings = tableMappingsModule.DefaultTableMappings; -exports.UnderscoreCqlToCamelCaseMappings = tableMappingsModule.UnderscoreCqlToCamelCaseMappings; -exports.q = require('./q').q; \ No newline at end of file +export { + Mapper, + ModelMapper, + ModelBatchMapper, + ModelBatchItem, + Result, + TableMappings, + DefaultTableMappings, + UnderscoreCqlToCamelCaseMappings, + q +} + +export default { + Mapper, + ModelMapper, + ModelBatchMapper, + ModelBatchItem, + Result, + TableMappings, + DefaultTableMappings, + UnderscoreCqlToCamelCaseMappings, + q +} \ No newline at end of file diff --git a/lib/mapping/model-batch-item.ts b/lib/mapping/model-batch-item.ts index f5c1a2ca..9c253bd5 100644 --- a/lib/mapping/model-batch-item.ts +++ b/lib/mapping/model-batch-item.ts @@ -185,4 +185,6 @@ class RemoveModelBatchItem extends ModelBatchItem { createQueries(docKeys) { return this.handler.createDeleteQueries(docKeys, this.doc, this.docInfo); } -} \ No newline at end of file +} + +export { ModelBatchItem, InsertModelBatchItem, UpdateModelBatchItem, RemoveModelBatchItem }; \ No newline at end of file diff --git a/lib/mapping/model-batch-mapper.ts b/lib/mapping/model-batch-mapper.ts index d39a6d84..0bd3ee15 100644 --- a/lib/mapping/model-batch-mapper.ts +++ b/lib/mapping/model-batch-mapper.ts @@ -14,7 +14,7 @@ * limitations under the License. */ import Tree from "./tree.js"; -import moduleBatchItemModule from "./model-batch-item.js"; +import * as moduleBatchItemModule from "./model-batch-item.js"; 'use strict'; const InsertModelBatchItem = moduleBatchItemModule.InsertModelBatchItem; diff --git a/lib/mapping/q.ts b/lib/mapping/q.ts index 1248c42b..1802b499 100644 --- a/lib/mapping/q.ts +++ b/lib/mapping/q.ts @@ -148,6 +148,14 @@ const q = { } }; -exports.q = q; -exports.QueryAssignment = QueryAssignment; -exports.QueryOperator = QueryOperator; \ No newline at end of file +export default { + q, + QueryAssignment, + QueryOperator, +} + +export { + q, + QueryAssignment, + QueryOperator, +} \ No newline at end of file diff --git a/lib/mapping/table-mappings.ts b/lib/mapping/table-mappings.ts index 06010a1c..83a844d2 100644 --- a/lib/mapping/table-mappings.ts +++ b/lib/mapping/table-mappings.ts @@ -117,6 +117,14 @@ class DefaultTableMappings extends TableMappings { } } -exports.TableMappings = TableMappings; -exports.UnderscoreCqlToCamelCaseMappings = UnderscoreCqlToCamelCaseMappings; -exports.DefaultTableMappings = DefaultTableMappings; \ No newline at end of file +export default { + TableMappings, + UnderscoreCqlToCamelCaseMappings, + DefaultTableMappings +} + +export { + TableMappings, + UnderscoreCqlToCamelCaseMappings, + DefaultTableMappings +} \ No newline at end of file diff --git a/lib/metadata/schema-parser.ts b/lib/metadata/schema-parser.ts index b6958364..e039bfb3 100644 --- a/lib/metadata/schema-parser.ts +++ b/lib/metadata/schema-parser.ts @@ -1173,5 +1173,7 @@ function getByVersion(options, cc, udtResolver, version, currentInstance) { return currentInstance; } -exports.getByVersion = getByVersion; -exports.isDoneForToken = isDoneForToken; \ No newline at end of file +export default { + getByVersion, + isDoneForToken +} \ No newline at end of file diff --git a/lib/metrics/index.ts b/lib/metrics/index.ts index 2389e763..ed12a388 100644 --- a/lib/metrics/index.ts +++ b/lib/metrics/index.ts @@ -16,4 +16,7 @@ import ClientMetrics from "./client-metrics.js"; import DefaultMetrics from "./default-metrics.js"; -'use strict'; \ No newline at end of file +'use strict'; + +export { ClientMetrics, DefaultMetrics }; +export default { ClientMetrics, DefaultMetrics }; \ No newline at end of file diff --git a/lib/policies/address-resolution.ts b/lib/policies/address-resolution.ts index 7964384f..7d5ac23d 100644 --- a/lib/policies/address-resolution.ts +++ b/lib/policies/address-resolution.ts @@ -137,5 +137,7 @@ EC2MultiRegionTranslator.prototype.logError = function (address, err) { //Do nothing by default }; -exports.AddressTranslator = AddressTranslator; -exports.EC2MultiRegionTranslator = EC2MultiRegionTranslator; \ No newline at end of file +export { + AddressTranslator, + EC2MultiRegionTranslator +} \ No newline at end of file diff --git a/lib/policies/index.ts b/lib/policies/index.ts index 9590d6b5..0bf6c439 100644 --- a/lib/policies/index.ts +++ b/lib/policies/index.ts @@ -15,26 +15,18 @@ */ 'use strict'; -/** - * Contains driver tuning policies to determine [load balancing]{@link module:policies/loadBalancing}, - * [retrying]{@link module:policies/retry} queries, [reconnecting]{@link module:policies/reconnection} to a node, - * [address resolution]{@link module:policies/addressResolution}, - * [timestamp generation]{@link module:policies/timestampGeneration} and - * [speculative execution]{@link module:policies/speculativeExecution}. - * @module policies - */ -const addressResolution = exports.addressResolution = require('./address-resolution'); -const loadBalancing = exports.loadBalancing = require('./load-balancing'); -const reconnection = exports.reconnection = require('./reconnection'); -const retry = exports.retry = require('./retry'); -const speculativeExecution = exports.speculativeExecution = require('./speculative-execution'); -const timestampGeneration = exports.timestampGeneration = require('./timestamp-generation'); +import * as addressResolution from './address-resolution.js'; +import * as loadBalancing from './load-balancing.js'; +import * as reconnection from './reconnection.js'; +import * as retry from './retry.js'; +import * as speculativeExecution from './speculative-execution.js'; +import * as timestampGeneration from './timestamp-generation.js'; /** * Returns a new instance of the default address translator policy used by the driver. * @returns {AddressTranslator} */ -exports.defaultAddressTranslator = function () { +const defaultAddressTranslator = function () { return new addressResolution.AddressTranslator(); }; @@ -46,7 +38,7 @@ exports.defaultAddressTranslator = function () { * provided in the {@link ClientOptions}.

* @returns {LoadBalancingPolicy} */ -exports.defaultLoadBalancingPolicy = function (localDc) { +const defaultLoadBalancingPolicy = function (localDc) { return new loadBalancing.DefaultLoadBalancingPolicy(localDc); }; @@ -54,7 +46,7 @@ exports.defaultLoadBalancingPolicy = function (localDc) { * Returns a new instance of the default retry policy used by the driver. * @returns {RetryPolicy} */ -exports.defaultRetryPolicy = function () { +const defaultRetryPolicy = function () { return new retry.RetryPolicy(); }; @@ -62,7 +54,7 @@ exports.defaultRetryPolicy = function () { * Returns a new instance of the default reconnection policy used by the driver. * @returns {ReconnectionPolicy} */ -exports.defaultReconnectionPolicy = function () { +const defaultReconnectionPolicy = function () { return new reconnection.ExponentialReconnectionPolicy(1000, 10 * 60 * 1000, false); }; @@ -71,7 +63,7 @@ exports.defaultReconnectionPolicy = function () { * Returns a new instance of the default speculative execution policy used by the driver. * @returns {SpeculativeExecutionPolicy} */ -exports.defaultSpeculativeExecutionPolicy = function () { +const defaultSpeculativeExecutionPolicy = function () { return new speculativeExecution.NoSpeculativeExecutionPolicy(); }; @@ -79,6 +71,45 @@ exports.defaultSpeculativeExecutionPolicy = function () { * Returns a new instance of the default timestamp generator used by the driver. * @returns {TimestampGenerator} */ -exports.defaultTimestampGenerator = function () { +const defaultTimestampGenerator = function () { return new timestampGeneration.MonotonicTimestampGenerator(); }; + +/** + * Contains driver tuning policies to determine [load balancing]{@link module:policies/loadBalancing}, + * [retrying]{@link module:policies/retry} queries, [reconnecting]{@link module:policies/reconnection} to a node, + * [address resolution]{@link module:policies/addressResolution}, + * [timestamp generation]{@link module:policies/timestampGeneration} and + * [speculative execution]{@link module:policies/speculativeExecution}. + * @module policies + */ + +export { + addressResolution, + loadBalancing, + reconnection, + retry, + speculativeExecution, + timestampGeneration, + defaultAddressTranslator, + defaultLoadBalancingPolicy, + defaultRetryPolicy, + defaultReconnectionPolicy, + defaultSpeculativeExecutionPolicy, + defaultTimestampGenerator +} + +export default { + addressResolution, + loadBalancing, + reconnection, + retry, + speculativeExecution, + timestampGeneration, + defaultAddressTranslator, + defaultLoadBalancingPolicy, + defaultRetryPolicy, + defaultReconnectionPolicy, + defaultSpeculativeExecutionPolicy, + defaultTimestampGenerator +} diff --git a/lib/policies/load-balancing.ts b/lib/policies/load-balancing.ts index 30b3ab14..bbb9a6ac 100644 --- a/lib/policies/load-balancing.ts +++ b/lib/policies/load-balancing.ts @@ -868,4 +868,26 @@ function setLocalDc(lbp, client, hosts) { function getDataCenters(hosts) { return new Set(hosts.values().map(h => h.datacenter)); -} \ No newline at end of file +} + +export { + AllowListPolicy, + DCAwareRoundRobinPolicy, + DefaultLoadBalancingPolicy, + LoadBalancingPolicy, + RoundRobinPolicy, + TokenAwarePolicy, + // Deprecated: for backward compatibility only. + WhiteListPolicy +}; + +export default { + AllowListPolicy, + DCAwareRoundRobinPolicy, + DefaultLoadBalancingPolicy, + LoadBalancingPolicy, + RoundRobinPolicy, + TokenAwarePolicy, + // Deprecated: for backward compatibility only. + WhiteListPolicy +}; \ No newline at end of file diff --git a/lib/policies/reconnection.ts b/lib/policies/reconnection.ts index 925d234e..890df6c3 100644 --- a/lib/policies/reconnection.ts +++ b/lib/policies/reconnection.ts @@ -153,6 +153,14 @@ ExponentialReconnectionPolicy.prototype.getOptions = function () { ]); }; -exports.ReconnectionPolicy = ReconnectionPolicy; -exports.ConstantReconnectionPolicy = ConstantReconnectionPolicy; -exports.ExponentialReconnectionPolicy = ExponentialReconnectionPolicy; \ No newline at end of file +export { + ReconnectionPolicy, + ConstantReconnectionPolicy, + ExponentialReconnectionPolicy +} + +export default { + ReconnectionPolicy, + ConstantReconnectionPolicy, + ExponentialReconnectionPolicy +} \ No newline at end of file diff --git a/lib/policies/retry.ts b/lib/policies/retry.ts index 4a7ea29f..4e2735c7 100644 --- a/lib/policies/retry.ts +++ b/lib/policies/retry.ts @@ -271,6 +271,14 @@ FallthroughRetryPolicy.prototype.onWriteTimeout = function () { * @property {Number} nbRetry The number of retries already performed for this operation. */ -exports.IdempotenceAwareRetryPolicy = IdempotenceAwareRetryPolicy; -exports.FallthroughRetryPolicy = FallthroughRetryPolicy; -exports.RetryPolicy = RetryPolicy; \ No newline at end of file +export { + IdempotenceAwareRetryPolicy, + FallthroughRetryPolicy, + RetryPolicy +} + +export default { + IdempotenceAwareRetryPolicy, + FallthroughRetryPolicy, + RetryPolicy +} \ No newline at end of file diff --git a/lib/policies/speculative-execution.ts b/lib/policies/speculative-execution.ts index 4c0b7034..ccd79bc5 100644 --- a/lib/policies/speculative-execution.ts +++ b/lib/policies/speculative-execution.ts @@ -138,6 +138,14 @@ ConstantSpeculativeExecutionPolicy.prototype.getOptions = function () { ]); }; -exports.NoSpeculativeExecutionPolicy = NoSpeculativeExecutionPolicy; -exports.SpeculativeExecutionPolicy = SpeculativeExecutionPolicy; -exports.ConstantSpeculativeExecutionPolicy = ConstantSpeculativeExecutionPolicy; \ No newline at end of file +export { + NoSpeculativeExecutionPolicy, + SpeculativeExecutionPolicy, + ConstantSpeculativeExecutionPolicy +} + +export default{ + NoSpeculativeExecutionPolicy, + SpeculativeExecutionPolicy, + ConstantSpeculativeExecutionPolicy +} \ No newline at end of file diff --git a/lib/policies/timestamp-generation.ts b/lib/policies/timestamp-generation.ts index 8d83f77f..cb2a4622 100644 --- a/lib/policies/timestamp-generation.ts +++ b/lib/policies/timestamp-generation.ts @@ -83,7 +83,7 @@ TimestampGenerator.prototype.next = function (client) { * @extends {TimestampGenerator} * @constructor */ -function MonotonicTimestampGenerator(warningThreshold, minLogInterval) { +function MonotonicTimestampGenerator(warningThreshold?, minLogInterval?) { if (warningThreshold < 0) { throw new errors.ArgumentError('warningThreshold can not be lower than 0'); } @@ -165,5 +165,12 @@ MonotonicTimestampGenerator.prototype._generateMicroseconds = function () { .add(Long.fromInt(this._micros)); }; -exports.TimestampGenerator = TimestampGenerator; -exports.MonotonicTimestampGenerator = MonotonicTimestampGenerator; \ No newline at end of file +export { + TimestampGenerator, + MonotonicTimestampGenerator +} + +export default{ + TimestampGenerator, + MonotonicTimestampGenerator +} \ No newline at end of file diff --git a/lib/promise-utils.ts b/lib/promise-utils.ts index 06bd1ffa..c85b6016 100644 --- a/lib/promise-utils.ts +++ b/lib/promise-utils.ts @@ -162,4 +162,16 @@ function toCallback(promise, callback) { result => process.nextTick(() => callback(null, result)), // Avoid marking the promise as rejected err => process.nextTick(() => callback(err))); -} \ No newline at end of file +} + +export default { + delay, + fromCallback, + fromEvent, + getCallback, + newQueryPlan, + optionalCallback, + times, + toBackground, + toCallback +}; \ No newline at end of file diff --git a/lib/readers.ts b/lib/readers.ts index e533d274..0eb4496e 100644 --- a/lib/readers.ts +++ b/lib/readers.ts @@ -536,3 +536,6 @@ class FrameReader { return result; } } + +export { FrameReader }; +export default { FrameReader }; \ No newline at end of file diff --git a/lib/requests.ts b/lib/requests.ts index 505f75c0..481a6c9b 100644 --- a/lib/requests.ts +++ b/lib/requests.ts @@ -18,7 +18,7 @@ import { FrameWriter } from "./writers.js"; import types from "./types/index.js"; import utils from "./utils.js"; import { ExecutionOptions } from "./execution-options.js"; -import packageInfo from "../package.json" with { type: "json" }; +import packageInfo from "../package.json" assert {type: 'json'}; 'use strict'; /** @@ -528,14 +528,30 @@ class OptionsRequest extends Request { const options = new OptionsRequest(); -exports.AuthResponseRequest = AuthResponseRequest; -exports.BatchRequest = BatchRequest; -exports.CancelRequest = CancelRequest; -exports.CredentialsRequest = CredentialsRequest; -exports.ExecuteRequest = ExecuteRequest; -exports.PrepareRequest = PrepareRequest; -exports.QueryRequest = QueryRequest; -exports.Request = Request; -exports.RegisterRequest = RegisterRequest; -exports.StartupRequest = StartupRequest; -exports.options = options; +export { + AuthResponseRequest, + BatchRequest, + CancelRequest, + CredentialsRequest, + ExecuteRequest, + PrepareRequest, + QueryRequest, + Request, + RegisterRequest, + StartupRequest, + options +}; + +export default { + AuthResponseRequest, + BatchRequest, + CancelRequest, + CredentialsRequest, + ExecuteRequest, + PrepareRequest, + QueryRequest, + Request, + RegisterRequest, + StartupRequest, + options +}; diff --git a/lib/streams.ts b/lib/streams.ts index 04a199b9..7071787b 100644 --- a/lib/streams.ts +++ b/lib/streams.ts @@ -575,6 +575,13 @@ ResultEmitter.prototype.bufferAndEmit = function (item) { } }; -exports.Protocol = Protocol; -exports.Parser = Parser; -exports.ResultEmitter = ResultEmitter; +export { + Protocol, + Parser, + ResultEmitter +} +export default { + Protocol, + Parser, + ResultEmitter +} \ No newline at end of file diff --git a/lib/token.ts b/lib/token.ts index 9ad86d7f..e7110b46 100644 --- a/lib/token.ts +++ b/lib/token.ts @@ -278,8 +278,18 @@ class TokenRange { } } -exports.Token = Token; -exports.TokenRange = TokenRange; -exports.ByteOrderedToken = ByteOrderedToken; -exports.Murmur3Token = Murmur3Token; -exports.RandomToken = RandomToken; \ No newline at end of file +export { + Token, + TokenRange, + ByteOrderedToken, + Murmur3Token, + RandomToken +} + +export default { + Token, + TokenRange, + ByteOrderedToken, + Murmur3Token, + RandomToken +} \ No newline at end of file diff --git a/lib/tokenizer.ts b/lib/tokenizer.ts index d99d53d0..36c90069 100644 --- a/lib/tokenizer.ts +++ b/lib/tokenizer.ts @@ -579,6 +579,14 @@ function fromSignedByte(value) { return new MutableLong((value - 256) & 0xffff, 0xffff, 0xffff, 0xffff); } -exports.Murmur3Tokenizer = Murmur3Tokenizer; -exports.RandomTokenizer = RandomTokenizer; -exports.ByteOrderedTokenizer = ByteOrderedTokenizer; +export { + Murmur3Tokenizer, + RandomTokenizer, + ByteOrderedTokenizer +} + +export default { + Murmur3Tokenizer, + RandomTokenizer, + ByteOrderedTokenizer +} \ No newline at end of file diff --git a/lib/tracker/index.ts b/lib/tracker/index.ts index 848d5bb3..bf0255a5 100644 --- a/lib/tracker/index.ts +++ b/lib/tracker/index.ts @@ -21,5 +21,13 @@ * @module tracker */ -exports.RequestLogger = require('./request-logger'); -exports.RequestTracker = require('./request-tracker'); \ No newline at end of file +import RequestTracker from "./request-tracker.js"; +import RequestLogger from "./request-logger.js"; +export { + RequestTracker, + RequestLogger +} +export default { + RequestTracker, + RequestLogger +} \ No newline at end of file diff --git a/lib/types/index.ts b/lib/types/index.ts index 56dfde67..6430c0b0 100644 --- a/lib/types/index.ts +++ b/lib/types/index.ts @@ -20,6 +20,17 @@ import Uuid from "./uuid.js"; import protocolVersion from "./protocol-version.js"; import utils from "../utils.js"; import Long from "long"; +import BigDecimal from './big-decimal.js'; +import Duration from './duration.js'; +import InetAddress from './inet-address.js'; +import Integer from './integer.js'; +import LocalDate from './local-date.js'; +import LocalTime from './local-time.js'; +import ResultSet from './result-set.js'; +import ResultStream from './result-stream.js'; +import Row from './row.js'; +import Tuple from './tuple.js'; + 'use strict'; /** @@ -588,35 +599,72 @@ function TimeoutError (message) { } util.inherits(TimeoutError, errors.DriverError); -exports.opcodes = opcodes; -exports.consistencies = consistencies; -exports.consistencyToString = consistencyToString; -exports.dataTypes = dataTypes; -exports.getDataTypeNameByCode = getDataTypeNameByCode; -exports.distance = distance; -exports.frameFlags = frameFlags; -exports.protocolEvents = protocolEvents; -exports.protocolVersion = protocolVersion; -exports.responseErrorCodes = responseErrorCodes; -exports.resultKind = resultKind; -exports.timeuuid = timeuuid; -exports.uuid = uuid; -exports.BigDecimal = require('./big-decimal'); -exports.Duration = require('./duration'); -exports.FrameHeader = FrameHeader; -exports.InetAddress = require('./inet-address'); -exports.Integer = require('./integer'); -exports.LocalDate = require('./local-date'); -exports.LocalTime = require('./local-time'); -exports.Long = Long; -exports.ResultSet = require('./result-set'); -exports.ResultStream = require('./result-stream'); -exports.Row = require('./row'); -//export DriverError for backward-compatibility -exports.DriverError = errors.DriverError; -exports.TimeoutError = TimeoutError; -exports.TimeUuid = TimeUuid; -exports.Tuple = require('./tuple'); -exports.Uuid = Uuid; -exports.unset = unset; -exports.generateTimestamp = generateTimestamp; +const DriverError = errors.DriverError; + +export { + opcodes, + consistencies, + consistencyToString, + dataTypes, + getDataTypeNameByCode, + distance, + frameFlags, + protocolEvents, + protocolVersion, + responseErrorCodes, + resultKind, + timeuuid, + uuid, + BigDecimal, + Duration, + FrameHeader, + InetAddress, + Integer, + LocalDate, + LocalTime, + Long, + ResultSet, + ResultStream, + Row, + DriverError, + TimeoutError, + TimeUuid, + Tuple, + Uuid, + unset, + generateTimestamp +} + +export default { + opcodes, + consistencies, + consistencyToString, + dataTypes, + getDataTypeNameByCode, + distance, + frameFlags, + protocolEvents, + protocolVersion, + responseErrorCodes, + resultKind, + timeuuid, + uuid, + BigDecimal, + Duration, + FrameHeader, + InetAddress, + Integer, + LocalDate, + LocalTime, + Long, + ResultSet, + ResultStream, + Row, + DriverError, + TimeoutError, + TimeUuid, + Tuple, + Uuid, + unset, + generateTimestamp +} diff --git a/lib/utils.ts b/lib/utils.ts index 77c97687..d58cfa9d 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -70,7 +70,7 @@ function allocBufferFillDeprecated(size) { return b; } -function allocBufferFromStringDeprecated(text, encoding) { +function allocBufferFromStringDeprecated(text, encoding?) { if (typeof text !== 'string') { throw new TypeError('Expected string, obtained ' + util.inspect(text)); } @@ -1038,48 +1038,48 @@ function whilst(condition, fn, callback) { } } -exports.adaptNamedParamsPrepared = adaptNamedParamsPrepared; -exports.adaptNamedParamsWithHints = adaptNamedParamsWithHints; -exports.AddressResolver = AddressResolver; -exports.allocBuffer = allocBuffer; -exports.allocBufferUnsafe = allocBufferUnsafe; -exports.allocBufferFromArray = allocBufferFromArray; -exports.allocBufferFromString = allocBufferFromString; -exports.arrayIterator = arrayIterator; -exports.binarySearch = binarySearch; -exports.callbackOnce = callbackOnce; -exports.copyBuffer = copyBuffer; -exports.deepExtend = deepExtend; -exports.each = each; -exports.eachSeries = eachSeries; -/** @const */ -exports.emptyArray = Object.freeze([]); -/** @const */ -exports.emptyObject = emptyObject; -exports.extend = extend; -exports.fixStack = fixStack; -exports.forEachOf = forEachOf; -exports.funcCompare = funcCompare; -exports.ifUndefined = ifUndefined; -exports.ifUndefined3 = ifUndefined3; -exports.insertSorted = insertSorted; -exports.iteratorToArray = iteratorToArray; -exports.log = log; -exports.map = map; -exports.mapSeries = mapSeries; -exports.maxInt = maxInt; -exports.noop = noop; -exports.objectValues = objectValues; -exports.parallel = parallel; -exports.promiseWrapper = promiseWrapper; -exports.propCompare = propCompare; -exports.series = series; -exports.shuffleArray = shuffleArray; -exports.stringRepeat = stringRepeat; -exports.times = times; -exports.timesLimit = timesLimit; -exports.timesSeries = timesSeries; -exports.totalLength = totalLength; -exports.validateFn = validateFn; -exports.whilst = whilst; -exports.HashSet = HashSet; \ No newline at end of file +export default { + adaptNamedParamsPrepared, + adaptNamedParamsWithHints, + AddressResolver, + allocBuffer, + allocBufferUnsafe, + allocBufferFromArray, + allocBufferFromString, + arrayIterator, + binarySearch, + callbackOnce, + copyBuffer, + deepExtend, + each, + eachSeries, + emptyArray, + emptyObject, + extend, + fixStack, + forEachOf, + funcCompare, + ifUndefined, + ifUndefined3, + insertSorted, + iteratorToArray, + log, + map, + mapSeries, + maxInt, + noop, + objectValues, + parallel, + promiseWrapper, + propCompare, + series, + shuffleArray, + stringRepeat, + times, + timesLimit, + timesSeries, + totalLength, + validateFn, + whilst, + HashSet +}; \ No newline at end of file diff --git a/lib/writers.ts b/lib/writers.ts index 7a3bdb95..9f531b1a 100644 --- a/lib/writers.ts +++ b/lib/writers.ts @@ -306,3 +306,5 @@ class WriteQueue extends events.EventEmitter { } } } + +export { FrameWriter, WriteQueue }; \ No newline at end of file diff --git a/package.json b/package.json index 2c5a7091..1dd82dd7 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,5 @@ "eslint": "eslint lib test", "test-ts": "npx ts-mocha test/unit test/integration/short --extension .ts --recursive --exit" }, - "engines": {"node": ">=16"}, - "type": "module" + "engines": {"node": ">=16"} } \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index bbb25a62..d494168f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,21 +1,26 @@ { "compilerOptions": { - "module": "nodenext", - "lib": ["es2015"], - "target": "es2015", - "sourceMap": true, - "strict": false, - "noImplicitAny": false, - "outDir": "out", - "declaration": true, - "allowJs": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "declarationMap": true, - "moduleDetection": "force", - "moduleResolution": "nodenext" + "module": "NodeNext", + "lib": ["es2015"], + "target": "es2015", + "sourceMap": true, + "strict": false, + "noImplicitAny": false, + "outDir": "out", + "declaration": true, + "allowJs": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "declarationMap": true, + "moduleDetection": "force", + "resolveJsonModule": true }, - "include": ["lib/**/*.ts", "index.ts"], - "exclude": ["node_modules"] -} \ No newline at end of file + "include": [ + "lib/**/*.ts", + "index.ts" + ], + "exclude": [ + "node_modules" + ] + } \ No newline at end of file From e00a1596e6088a26f98f11fb350df2de8118b46e Mon Sep 17 00:00:00 2001 From: janehe Date: Tue, 4 Mar 2025 22:48:00 -0800 Subject: [PATCH 11/19] rm tsdoc-metadata.json --- .gitignore | 4 +++- tsdoc-metadata.json | 11 ----------- 2 files changed, 3 insertions(+), 12 deletions(-) delete mode 100644 tsdoc-metadata.json diff --git a/.gitignore b/.gitignore index 1677f5bc..4388222d 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,6 @@ out/ /docs **/typescript/*.js **/typescript/*.js.map -**/typescript/generated.ts \ No newline at end of file +**/typescript/generated.ts + +tsdoc-metadata.json \ No newline at end of file diff --git a/tsdoc-metadata.json b/tsdoc-metadata.json deleted file mode 100644 index 88a94013..00000000 --- a/tsdoc-metadata.json +++ /dev/null @@ -1,11 +0,0 @@ -// This file is read by tools that parse documentation comments conforming to the TSDoc standard. -// It should be published with your NPM package. It should not be tracked by Git. -{ - "tsdocVersion": "0.12", - "toolPackages": [ - { - "packageName": "@microsoft/api-extractor", - "packageVersion": "7.49.1" - } - ] -} From f4785892fc14b14512cbd6bfd18ff5d4e1b78244 Mon Sep 17 00:00:00 2001 From: janehe Date: Wed, 5 Mar 2025 21:53:24 -0800 Subject: [PATCH 12/19] delete ".js" in import --- index.ts | 34 ++-- lib/auth/base-dse-authenticator.ts | 2 +- lib/auth/dse-gssapi-auth-provider.ts | 8 +- lib/auth/dse-plain-text-auth-provider.ts | 6 +- lib/auth/gssapi-client.ts | 2 +- lib/auth/index.ts | 10 +- lib/auth/no-auth-provider.ts | 6 +- lib/auth/plain-text-auth-provider.ts | 4 +- lib/client-options.ts | 12 +- lib/client.ts | 30 ++-- lib/concurrent/index.ts | 2 +- lib/connection.ts | 22 +-- lib/control-connection.ts | 18 +- lib/datastax/cloud/index.ts | 6 +- lib/datastax/graph/complex-type-helper.ts | 6 +- lib/datastax/graph/custom-type-serializers.ts | 12 +- lib/datastax/graph/graph-executor.ts | 12 +- lib/datastax/graph/graph-serializer.ts | 2 +- lib/datastax/graph/index.ts | 8 +- lib/datastax/graph/options.ts | 6 +- lib/datastax/graph/result-set.ts | 2 +- lib/datastax/graph/type-serializers.ts | 2 +- lib/datastax/graph/wrappers.ts | 2 +- lib/datastax/index.ts | 4 +- lib/datastax/search/date-range.ts | 2 +- lib/datastax/search/index.ts | 2 +- lib/encoder.ts | 14 +- lib/execution-options.ts | 6 +- lib/execution-profile.ts | 6 +- lib/geometry/index.ts | 8 +- lib/geometry/line-string.ts | 6 +- lib/geometry/point.ts | 4 +- lib/geometry/polygon.ts | 8 +- lib/host-connection-pool.ts | 10 +- lib/host.ts | 10 +- lib/insights-client.ts | 14 +- lib/mapping/cache.ts | 2 +- lib/mapping/doc-info-adapter.ts | 4 +- lib/mapping/index.ts | 14 +- lib/mapping/mapper.ts | 16 +- lib/mapping/mapping-handler.ts | 16 +- lib/mapping/model-batch-item.ts | 2 +- lib/mapping/model-batch-mapper.ts | 4 +- lib/mapping/model-mapper.ts | 2 +- lib/mapping/model-mapping-info.ts | 2 +- lib/mapping/q.ts | 2 +- lib/mapping/query-generator.ts | 6 +- lib/mapping/result-mapper.ts | 4 +- lib/mapping/result.ts | 2 +- lib/metadata/client-state.ts | 2 +- lib/metadata/event-debouncer.ts | 4 +- lib/metadata/index.ts | 18 +- lib/metadata/materialized-view.ts | 2 +- lib/metadata/schema-index.ts | 4 +- lib/metadata/schema-parser.ts | 18 +- lib/metadata/table-metadata.ts | 2 +- lib/metrics/default-metrics.ts | 2 +- lib/metrics/index.ts | 4 +- lib/operation-state.ts | 6 +- lib/policies/address-resolution.ts | 2 +- lib/policies/index.ts | 12 +- lib/policies/load-balancing.ts | 6 +- lib/policies/speculative-execution.ts | 2 +- lib/policies/timestamp-generation.ts | 4 +- lib/prepare-handler.ts | 8 +- lib/readers.ts | 6 +- lib/request-execution.ts | 12 +- lib/request-handler.ts | 10 +- lib/requests.ts | 8 +- lib/stream-id-stack.ts | 2 +- lib/streams.ts | 8 +- lib/token.ts | 2 +- lib/tokenizer.ts | 8 +- lib/tracker/index.ts | 4 +- lib/tracker/request-logger.ts | 4 +- lib/types/big-decimal.ts | 4 +- lib/types/duration.ts | 2 +- lib/types/index.ts | 32 ++-- lib/types/inet-address.ts | 2 +- lib/types/integer.ts | 2 +- lib/types/local-date.ts | 2 +- lib/types/local-time.ts | 2 +- lib/types/protocol-version.ts | 4 +- lib/types/result-set.ts | 4 +- lib/types/result-stream.ts | 6 +- lib/types/time-uuid.ts | 4 +- lib/types/uuid.ts | 2 +- lib/utils.ts | 51 +++++- lib/writers.ts | 4 +- package-lock.json | 169 +----------------- package.json | 3 +- test/integration/short/vector-tests.ts | 6 +- test/unit/encoder-tests.ts | 2 +- 93 files changed, 367 insertions(+), 478 deletions(-) diff --git a/index.ts b/index.ts index d4f4dd0a..dc2ed9d2 100644 --- a/index.ts +++ b/index.ts @@ -13,25 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import auth from './lib/auth/index.js'; -import clientOptions from "./lib/client-options.js"; -import Client from "./lib/client.js"; -import types from "./lib/types/index.js"; -import errors from "./lib/errors.js"; -import policies from "./lib/policies/index.js"; -import mapping from "./lib/mapping/index.js"; -import tracker from "./lib/tracker/index.js"; -import metrics from "./lib/metrics/index.js"; -import concurrent from "./lib/concurrent/index.js"; -import Token from "./lib/token.js"; -import Metadata from "./lib/metadata/index.js"; -import Encoder from "./lib/encoder.js"; -import geometry from "./lib/geometry/index.js"; -import datastax from "./lib/datastax/index.js"; +import auth from './lib/auth/index'; +import clientOptions from "./lib/client-options"; +import Client from "./lib/client"; +import types from "./lib/types/index"; +import errors from "./lib/errors"; +import policies from "./lib/policies/index"; +import mapping from "./lib/mapping/index"; +import tracker from "./lib/tracker/index"; +import metrics from "./lib/metrics/index"; +import concurrent from "./lib/concurrent/index"; +import Token from "./lib/token"; +import Metadata from "./lib/metadata/index"; +import Encoder from "./lib/encoder"; +import geometry from "./lib/geometry/index"; +import datastax from "./lib/datastax/index"; import packageJson from './package.json'; -import { ExecutionProfile } from './lib/execution-profile.js'; -import { ExecutionOptions } from './lib/execution-options.js'; +import { ExecutionProfile } from './lib/execution-profile'; +import { ExecutionOptions } from './lib/execution-options'; const token = { Token: Token.Token, diff --git a/lib/auth/base-dse-authenticator.ts b/lib/auth/base-dse-authenticator.ts index 171ad891..5002800d 100644 --- a/lib/auth/base-dse-authenticator.ts +++ b/lib/auth/base-dse-authenticator.ts @@ -14,7 +14,7 @@ * limitations under the License. */ 'use strict'; -import { Authenticator } from './provider.js'; +import { Authenticator } from './provider'; import util from "util"; const dseAuthenticatorName = 'com.datastax.bdp.cassandra.auth.DseAuthenticator'; diff --git a/lib/auth/dse-gssapi-auth-provider.ts b/lib/auth/dse-gssapi-auth-provider.ts index d8ed9c11..09ec4021 100644 --- a/lib/auth/dse-gssapi-auth-provider.ts +++ b/lib/auth/dse-gssapi-auth-provider.ts @@ -14,12 +14,12 @@ * limitations under the License. */ 'use strict'; -import BaseDseAuthenticator from './base-dse-authenticator.js'; -import GssapiClient from './gssapi-client.js'; +import BaseDseAuthenticator from './base-dse-authenticator'; +import GssapiClient from './gssapi-client'; import util from "util"; -import { AuthProvider } from "./provider.js"; +import { AuthProvider } from "./provider"; import dns from "dns"; -import utils from "../utils.js"; +import utils from "../utils"; const mechanism = utils.allocBufferFromString('GSSAPI'); const initialServerChallenge = 'GSSAPI-START'; const emptyBuffer = utils.allocBuffer(0); diff --git a/lib/auth/dse-plain-text-auth-provider.ts b/lib/auth/dse-plain-text-auth-provider.ts index 95efd6aa..3f9879be 100644 --- a/lib/auth/dse-plain-text-auth-provider.ts +++ b/lib/auth/dse-plain-text-auth-provider.ts @@ -14,10 +14,10 @@ * limitations under the License. */ 'use strict'; -import { AuthProvider } from './provider.js'; -import BaseDseAuthenticator from './base-dse-authenticator.js'; +import { AuthProvider } from './provider'; +import BaseDseAuthenticator from './base-dse-authenticator'; import util from "util"; -import utils from "../utils.js"; +import utils from "../utils"; const mechanism = utils.allocBufferFromString('PLAIN'); const separatorBuffer = utils.allocBufferFromArray([0]); const initialServerChallenge = 'PLAIN-START'; diff --git a/lib/auth/gssapi-client.ts b/lib/auth/gssapi-client.ts index 6ab64d3e..6ced68d9 100644 --- a/lib/auth/gssapi-client.ts +++ b/lib/auth/gssapi-client.ts @@ -14,7 +14,7 @@ * limitations under the License. */ import util from "util"; -import utils from "../utils.js"; +import utils from "../utils"; 'use strict'; diff --git a/lib/auth/index.ts b/lib/auth/index.ts index 016a88b0..c377e814 100644 --- a/lib/auth/index.ts +++ b/lib/auth/index.ts @@ -23,11 +23,11 @@ * @module auth */ -import { Authenticator, AuthProvider } from './provider.js'; -import { PlainTextAuthProvider } from './plain-text-auth-provider.js'; -import DseGssapiAuthProvider from './dse-gssapi-auth-provider.js'; -import DsePlainTextAuthProvider from './dse-plain-text-auth-provider.js'; -import NoAuthProvider from './no-auth-provider.js'; +import { Authenticator, AuthProvider } from './provider'; +import { PlainTextAuthProvider } from './plain-text-auth-provider'; +import DseGssapiAuthProvider from './dse-gssapi-auth-provider'; +import DsePlainTextAuthProvider from './dse-plain-text-auth-provider'; +import NoAuthProvider from './no-auth-provider'; export { Authenticator, diff --git a/lib/auth/no-auth-provider.ts b/lib/auth/no-auth-provider.ts index bf32669a..7532c26b 100644 --- a/lib/auth/no-auth-provider.ts +++ b/lib/auth/no-auth-provider.ts @@ -16,9 +16,9 @@ 'use strict'; -import { AuthProvider, Authenticator } from './provider.js'; -import { PlainTextAuthenticator } from './plain-text-auth-provider.js'; -import errors from "../errors.js"; +import { AuthProvider, Authenticator } from './provider'; +import { PlainTextAuthenticator } from './plain-text-auth-provider'; +import errors from "../errors"; const dseAuthenticator = 'com.datastax.bdp.cassandra.auth.DseAuthenticator'; /** diff --git a/lib/auth/plain-text-auth-provider.ts b/lib/auth/plain-text-auth-provider.ts index 7ebced40..7e8b3497 100644 --- a/lib/auth/plain-text-auth-provider.ts +++ b/lib/auth/plain-text-auth-provider.ts @@ -14,9 +14,9 @@ * limitations under the License. */ 'use strict'; -import * as provider from './provider.js'; +import * as provider from './provider'; import util from "util"; -import utils from "../utils.js"; +import utils from "../utils"; const AuthProvider = provider.AuthProvider; const Authenticator = provider.Authenticator; /** diff --git a/lib/client-options.ts b/lib/client-options.ts index a6c1b2be..fbe599eb 100644 --- a/lib/client-options.ts +++ b/lib/client-options.ts @@ -14,12 +14,12 @@ * limitations under the License. */ import util from "util"; -import policies from "./policies/index.js"; -import types from "./types/index.js"; -import utils from "./utils.js"; -import tracker from "./tracker/index.js"; -import metrics from "./metrics/index.js"; -import auth from "./auth/index.js"; +import policies from "./policies/index"; +import types from "./types/index"; +import utils from "./utils"; +import tracker from "./tracker/index"; +import metrics from "./metrics/index"; +import auth from "./auth/index"; 'use strict'; /** Core connections per host for protocol versions 1 and 2 */ diff --git a/lib/client.ts b/lib/client.ts index 3f1cd9c2..8165e38c 100644 --- a/lib/client.ts +++ b/lib/client.ts @@ -15,21 +15,21 @@ */ import events from "events"; import util from "util"; -import utils from "./utils.js"; -import errors from "./errors.js"; -import types from "./types/index.js"; -import { ProfileManager } from "./execution-profile.js"; -import requests from "./requests.js"; -import clientOptions from "./client-options.js"; -import ClientState from "./metadata/client-state.js"; -import { DefaultExecutionOptions } from "./execution-options.js"; -import ControlConnection from "./control-connection.js"; -import RequestHandler from "./request-handler.js"; -import PrepareHandler from "./prepare-handler.js"; -import InsightsClient from "./insights-client.js"; -import cloud from "./datastax/cloud/index.js"; -import GraphExecutor from "./datastax/graph/graph-executor.js"; -import promiseUtils from "./promise-utils.js"; +import utils from "./utils"; +import errors from "./errors"; +import types from "./types/index"; +import { ProfileManager } from "./execution-profile"; +import requests from "./requests"; +import clientOptions from "./client-options"; +import ClientState from "./metadata/client-state"; +import { DefaultExecutionOptions } from "./execution-options"; +import ControlConnection from "./control-connection"; +import RequestHandler from "./request-handler"; +import PrepareHandler from "./prepare-handler"; +import InsightsClient from "./insights-client"; +import cloud from "./datastax/cloud/index"; +import GraphExecutor from "./datastax/graph/graph-executor"; +import promiseUtils from "./promise-utils"; import packageInfo from '../package.json' assert {type: 'json'}; 'use strict'; diff --git a/lib/concurrent/index.ts b/lib/concurrent/index.ts index e505bc60..c5623000 100644 --- a/lib/concurrent/index.ts +++ b/lib/concurrent/index.ts @@ -14,7 +14,7 @@ * limitations under the License. */ import { Stream } from "stream"; -import utils from "../utils.js"; +import utils from "../utils"; 'use strict'; diff --git a/lib/connection.ts b/lib/connection.ts index b200d66f..40779647 100644 --- a/lib/connection.ts +++ b/lib/connection.ts @@ -17,17 +17,17 @@ import events from "events"; import util from "util"; import tls from "tls"; import net from "net"; -import Encoder from "./encoder.js"; -import { WriteQueue } from "./writers.js"; -import requests from "./requests.js"; -import streams from "./streams.js"; -import utils from "./utils.js"; -import types from "./types/index.js"; -import errors from "./errors.js"; -import StreamIdStack from "./stream-id-stack.js"; -import OperationState from "./operation-state.js"; -import promiseUtils from "./promise-utils.js"; -import { ExecutionOptions } from "./execution-options.js"; +import Encoder from "./encoder"; +import { WriteQueue } from "./writers"; +import requests from "./requests"; +import streams from "./streams"; +import utils from "./utils"; +import types from "./types/index"; +import errors from "./errors"; +import StreamIdStack from "./stream-id-stack"; +import OperationState from "./operation-state"; +import promiseUtils from "./promise-utils"; +import { ExecutionOptions } from "./execution-options"; 'use strict'; diff --git a/lib/control-connection.ts b/lib/control-connection.ts index 2df78d79..b53345c8 100644 --- a/lib/control-connection.ts +++ b/lib/control-connection.ts @@ -17,15 +17,15 @@ import events from "events"; import util from "util"; import net from "net"; import dns from "dns"; -import errors from "./errors.js"; -import { Host, HostMap } from "./host.js"; -import Metadata from "./metadata/index.js"; -import EventDebouncer from "./metadata/event-debouncer.js"; -import Connection from "./connection.js"; -import requests from "./requests.js"; -import utils from "./utils.js"; -import types from "./types/index.js"; -import promiseUtils from "./promise-utils.js"; +import errors from "./errors"; +import { Host, HostMap } from "./host"; +import Metadata from "./metadata/index"; +import EventDebouncer from "./metadata/event-debouncer"; +import Connection from "./connection"; +import requests from "./requests"; +import utils from "./utils"; +import types from "./types/index"; +import promiseUtils from "./promise-utils"; 'use strict'; const f = util.format; diff --git a/lib/datastax/cloud/index.ts b/lib/datastax/cloud/index.ts index 3e60fb31..4487b57d 100644 --- a/lib/datastax/cloud/index.ts +++ b/lib/datastax/cloud/index.ts @@ -15,14 +15,14 @@ */ 'use strict'; -import { DsePlainTextAuthProvider, NoAuthProvider } from '../../auth/index.js'; +import { DsePlainTextAuthProvider, NoAuthProvider } from '../../auth/index'; import https from "https"; import fs from "fs"; import util from "util"; import AdmZip from "adm-zip"; import { URL } from "url"; -import errors from "../../errors.js"; -import utils from "../../utils.js"; +import errors from "../../errors"; +import utils from "../../utils"; // Use the callback-based method fs.readFile() instead of fs.promises as we have to support Node.js 8+ const readFile = util.promisify(fs.readFile); diff --git a/lib/datastax/graph/complex-type-helper.ts b/lib/datastax/graph/complex-type-helper.ts index d9c59443..7a435a79 100644 --- a/lib/datastax/graph/complex-type-helper.ts +++ b/lib/datastax/graph/complex-type-helper.ts @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { GraphTypeWrapper, UdtGraphWrapper } from "./wrappers.js"; -import types from "../../types/index.js"; -import Encoder from "../../encoder.js"; +import { GraphTypeWrapper, UdtGraphWrapper } from "./wrappers"; +import types from "../../types/index"; +import Encoder from "../../encoder"; 'use strict'; const { dataTypes } = types; diff --git a/lib/datastax/graph/custom-type-serializers.ts b/lib/datastax/graph/custom-type-serializers.ts index 208a670a..aac012c5 100644 --- a/lib/datastax/graph/custom-type-serializers.ts +++ b/lib/datastax/graph/custom-type-serializers.ts @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import types from "../../types/index.js"; -import utils from "../../utils.js"; -import { getTypeDefinitionByValue, getUdtTypeDefinitionByValue } from "./complex-type-helper.js"; -import { Point, Polygon, LineString } from "../../geometry/index.js"; -import { Edge } from "./structure.js"; -import { GraphTypeWrapper, UdtGraphWrapper } from "./wrappers.js"; +import types from "../../types/index"; +import utils from "../../utils"; +import { getTypeDefinitionByValue, getUdtTypeDefinitionByValue } from "./complex-type-helper"; +import { Point, Polygon, LineString } from "../../geometry/index"; +import { Edge } from "./structure"; +import { GraphTypeWrapper, UdtGraphWrapper } from "./wrappers"; 'use strict'; const { Tuple, dataTypes } = types; diff --git a/lib/datastax/graph/graph-executor.ts b/lib/datastax/graph/graph-executor.ts index 5e5f0f3c..2f482e12 100644 --- a/lib/datastax/graph/graph-executor.ts +++ b/lib/datastax/graph/graph-executor.ts @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import utils from "../../utils.js"; -import policies from "../../policies/index.js"; -import GraphResultSet from "./result-set.js"; -import { GraphSON2Reader, GraphSON2Writer, GraphSON3Reader, GraphSON3Writer } from "./graph-serializer.js"; -import getCustomTypeSerializers from "./custom-type-serializers.js"; -import { GraphExecutionOptions, graphProtocol } from "./options.js"; +import utils from "../../utils"; +import policies from "../../policies/index"; +import GraphResultSet from "./result-set"; +import { GraphSON2Reader, GraphSON2Writer, GraphSON3Reader, GraphSON3Writer } from "./graph-serializer"; +import getCustomTypeSerializers from "./custom-type-serializers"; +import { GraphExecutionOptions, graphProtocol } from "./options"; 'use strict'; const graphLanguageGroovyString = 'gremlin-groovy'; diff --git a/lib/datastax/graph/graph-serializer.ts b/lib/datastax/graph/graph-serializer.ts index 857d9807..5af153fc 100644 --- a/lib/datastax/graph/graph-serializer.ts +++ b/lib/datastax/graph/graph-serializer.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import typeSerializers from "./type-serializers.js"; +import typeSerializers from "./type-serializers"; /** * @module datastax/graph/tinkerpop/graphSerializers diff --git a/lib/datastax/graph/index.ts b/lib/datastax/graph/index.ts index bf63df1c..4a716fac 100644 --- a/lib/datastax/graph/index.ts +++ b/lib/datastax/graph/index.ts @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import GraphResultSet from "./result-set.js"; -import getCustomTypeSerializers from "./custom-type-serializers.js"; -import { asInt, asDouble, asFloat, asTimestamp, asUdt, UdtGraphWrapper, GraphTypeWrapper} from "./wrappers.js"; -import { Edge, Element, Path, Property, Vertex, VertexProperty } from "./structure.js"; +import GraphResultSet from "./result-set"; +import getCustomTypeSerializers from "./custom-type-serializers"; +import { asInt, asDouble, asFloat, asTimestamp, asUdt, UdtGraphWrapper, GraphTypeWrapper} from "./wrappers"; +import { Edge, Element, Path, Property, Vertex, VertexProperty } from "./structure"; 'use strict'; diff --git a/lib/datastax/graph/options.ts b/lib/datastax/graph/options.ts index 23c351f9..407354d8 100644 --- a/lib/datastax/graph/options.ts +++ b/lib/datastax/graph/options.ts @@ -14,9 +14,9 @@ * limitations under the License. */ import util from "util"; -import types from "../../types/index.js"; -import utils from "../../utils.js"; -import { DefaultExecutionOptions, proxyExecuteKey } from "../../execution-options.js"; +import types from "../../types/index"; +import utils from "../../utils"; +import { DefaultExecutionOptions, proxyExecuteKey } from "../../execution-options"; 'use strict'; const Long = types.Long; diff --git a/lib/datastax/graph/result-set.ts b/lib/datastax/graph/result-set.ts index c54d946b..286e1ea5 100644 --- a/lib/datastax/graph/result-set.ts +++ b/lib/datastax/graph/result-set.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import utils from "../../utils.js"; +import utils from "../../utils"; 'use strict'; diff --git a/lib/datastax/graph/type-serializers.ts b/lib/datastax/graph/type-serializers.ts index 7d874d11..f809a0c0 100644 --- a/lib/datastax/graph/type-serializers.ts +++ b/lib/datastax/graph/type-serializers.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import g from "./index.js"; +import g from "./index"; /** * @module datastax/graph/tinkerpop/typeSerializers diff --git a/lib/datastax/graph/wrappers.ts b/lib/datastax/graph/wrappers.ts index 004a68d3..3e4c2c3e 100644 --- a/lib/datastax/graph/wrappers.ts +++ b/lib/datastax/graph/wrappers.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import types from "../../types/index.js"; +import types from "../../types/index"; 'use strict'; const { dataTypes } = types; diff --git a/lib/datastax/index.ts b/lib/datastax/index.ts index ee29f737..39a1e14a 100644 --- a/lib/datastax/index.ts +++ b/lib/datastax/index.ts @@ -24,8 +24,8 @@ * @module datastax */ -import graph from "./graph/index.js"; -import { DateRange } from "./search/index.js"; +import graph from "./graph/index"; +import { DateRange } from "./search/index"; export default { graph, diff --git a/lib/datastax/search/date-range.ts b/lib/datastax/search/date-range.ts index 70c551a3..70db343d 100644 --- a/lib/datastax/search/date-range.ts +++ b/lib/datastax/search/date-range.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import utils from "../../utils.js"; +import utils from "../../utils"; import Long from "long"; 'use strict'; diff --git a/lib/datastax/search/index.ts b/lib/datastax/search/index.ts index b216f05b..515aed04 100644 --- a/lib/datastax/search/index.ts +++ b/lib/datastax/search/index.ts @@ -23,4 +23,4 @@ * @module datastax/search */ -export * from "./date-range.js"; \ No newline at end of file +export * from "./date-range"; \ No newline at end of file diff --git a/lib/encoder.ts b/lib/encoder.ts index 4106904a..f08bc27f 100644 --- a/lib/encoder.ts +++ b/lib/encoder.ts @@ -14,13 +14,13 @@ * limitations under the License. */ import util from "util"; -import types from "./types/index.js"; -import MutableLong from "./types/mutable-long.js"; -import utils from "./utils.js"; -import token from "./token.js"; -import { DateRange } from "./datastax/search/index.js"; -import geo from "./geometry/index.js"; -import Vector from "./types/vector.js"; +import types from "./types/index"; +import MutableLong from "./types/mutable-long"; +import utils from "./utils"; +import token from "./token"; +import { DateRange } from "./datastax/search/index"; +import geo from "./geometry/index"; +import Vector from "./types/vector"; 'use strict'; const dataTypes = types.dataTypes; diff --git a/lib/execution-options.ts b/lib/execution-options.ts index ab439fab..df6b842d 100644 --- a/lib/execution-options.ts +++ b/lib/execution-options.ts @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import utils from "./utils.js"; -import types from "./types/index.js"; -import errors from "./errors.js"; +import utils from "./utils"; +import types from "./types/index"; +import errors from "./errors"; 'use strict'; const proxyExecuteKey = 'ProxyExecute'; diff --git a/lib/execution-profile.ts b/lib/execution-profile.ts index 8ac1c0f2..694fba09 100644 --- a/lib/execution-profile.ts +++ b/lib/execution-profile.ts @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import utils from "./utils.js"; -import types from "./types/index.js"; -import promiseUtils from "./promise-utils.js"; +import utils from "./utils"; +import types from "./types/index"; +import promiseUtils from "./promise-utils"; 'use strict'; diff --git a/lib/geometry/index.ts b/lib/geometry/index.ts index 32cd0038..171552c0 100644 --- a/lib/geometry/index.ts +++ b/lib/geometry/index.ts @@ -24,10 +24,10 @@ * @module geometry */ -import Point from './point.js'; -import LineString from './line-string.js'; -import Polygon from './polygon.js'; -import Geometry from './geometry.js'; +import Point from './point'; +import LineString from './line-string'; +import Polygon from './polygon'; +import Geometry from './geometry'; export default { Point, diff --git a/lib/geometry/line-string.ts b/lib/geometry/line-string.ts index 9dfd9204..308a95c2 100644 --- a/lib/geometry/line-string.ts +++ b/lib/geometry/line-string.ts @@ -14,9 +14,9 @@ * limitations under the License. */ import util from "util"; -import utils from "../utils.js"; -import Geometry from "./geometry.js"; -import Point from "./point.js"; +import utils from "../utils"; +import Geometry from "./geometry"; +import Point from "./point"; 'use strict'; diff --git a/lib/geometry/point.ts b/lib/geometry/point.ts index 9566f9e5..ace2d38c 100644 --- a/lib/geometry/point.ts +++ b/lib/geometry/point.ts @@ -14,8 +14,8 @@ * limitations under the License. */ import util from "util"; -import utils from "../utils.js"; -import Geometry from "./geometry.js"; +import utils from "../utils"; +import Geometry from "./geometry"; 'use strict'; diff --git a/lib/geometry/polygon.ts b/lib/geometry/polygon.ts index 1e447d76..81fff43f 100644 --- a/lib/geometry/polygon.ts +++ b/lib/geometry/polygon.ts @@ -14,10 +14,10 @@ * limitations under the License. */ import util from "util"; -import utils from "../utils.js"; -import Geometry from "./geometry.js"; -import Point from "./point.js"; -import LineString from "./line-string.js"; +import utils from "../utils"; +import Geometry from "./geometry"; +import Point from "./point"; +import LineString from "./line-string"; 'use strict'; diff --git a/lib/host-connection-pool.ts b/lib/host-connection-pool.ts index 1c2b153f..058127fb 100644 --- a/lib/host-connection-pool.ts +++ b/lib/host-connection-pool.ts @@ -15,11 +15,11 @@ */ import util from "util"; import events from "events"; -import Connection from "./connection.js"; -import utils from "./utils.js"; -import promiseUtils from "./promise-utils.js"; -import errors from "./errors.js"; -import clientOptions from "./client-options.js"; +import Connection from "./connection"; +import utils from "./utils"; +import promiseUtils from "./promise-utils"; +import errors from "./errors"; +import clientOptions from "./client-options"; 'use strict'; // Used to get the index of the connection with less in-flight requests diff --git a/lib/host.ts b/lib/host.ts index f1ed776f..14d6ac64 100644 --- a/lib/host.ts +++ b/lib/host.ts @@ -14,11 +14,11 @@ * limitations under the License. */ import events from "events"; -import utils from "./utils.js"; -import types from "./types/index.js"; -import HostConnectionPool from "./host-connection-pool.js"; -import PrepareHandler from "./prepare-handler.js"; -import promiseUtils from "./promise-utils.js"; +import utils from "./utils"; +import types from "./types/index"; +import HostConnectionPool from "./host-connection-pool"; +import PrepareHandler from "./prepare-handler"; +import promiseUtils from "./promise-utils"; 'use strict'; const healthResponseCountInterval = 200; diff --git a/lib/insights-client.ts b/lib/insights-client.ts index 400f122d..fa110e5b 100644 --- a/lib/insights-client.ts +++ b/lib/insights-client.ts @@ -15,17 +15,17 @@ */ 'use strict'; -import { NoAuthProvider } from './auth/index.js'; +import { NoAuthProvider } from './auth/index'; import os from "os"; import path from "path"; import fs from "fs"; -import utils from "./utils.js"; -import promiseUtils from "./promise-utils.js"; -import types from "./types/index.js"; -import requests from "./requests.js"; -import { ExecutionOptions } from "./execution-options.js"; +import utils from "./utils"; +import promiseUtils from "./promise-utils"; +import types from "./types/index"; +import requests from "./requests"; +import { ExecutionOptions } from "./execution-options"; import packageInfo from "../package.json" assert {type: 'json'}; -import VersionNumber from "./types/version-number.js"; +import VersionNumber from "./types/version-number"; import { assert } from 'console'; let kerberosModule; diff --git a/lib/mapping/cache.ts b/lib/mapping/cache.ts index fd00f29b..a3e21cf3 100644 --- a/lib/mapping/cache.ts +++ b/lib/mapping/cache.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import qModule from "./q.js"; +import qModule from "./q"; 'use strict'; const QueryOperator = qModule.QueryOperator; diff --git a/lib/mapping/doc-info-adapter.ts b/lib/mapping/doc-info-adapter.ts index b2adfa7b..38f474cf 100644 --- a/lib/mapping/doc-info-adapter.ts +++ b/lib/mapping/doc-info-adapter.ts @@ -13,8 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import errors from "../errors.js"; -import utils from "../utils.js"; +import errors from "../errors"; +import utils from "../utils"; 'use strict'; diff --git a/lib/mapping/index.ts b/lib/mapping/index.ts index 7ba0468f..8a2f44af 100644 --- a/lib/mapping/index.ts +++ b/lib/mapping/index.ts @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import Mapper from './mapper.js'; -import ModelMapper from "./model-mapper.js"; -import ModelBatchMapper from "./model-batch-mapper.js"; -import { ModelBatchItem } from './model-batch-item.js'; -import Result from "./result.js"; -import { q } from "./q.js"; -import {TableMappings, DefaultTableMappings, UnderscoreCqlToCamelCaseMappings} from "./table-mappings.js"; +import Mapper from './mapper'; +import ModelMapper from "./model-mapper"; +import ModelBatchMapper from "./model-batch-mapper"; +import { ModelBatchItem } from './model-batch-item'; +import Result from "./result"; +import { q } from "./q"; +import {TableMappings, DefaultTableMappings, UnderscoreCqlToCamelCaseMappings} from "./table-mappings"; 'use strict'; diff --git a/lib/mapping/mapper.ts b/lib/mapping/mapper.ts index dba290d5..dec16e99 100644 --- a/lib/mapping/mapper.ts +++ b/lib/mapping/mapper.ts @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import ModelMapper from "./model-mapper.js"; -import MappingHandler from "./mapping-handler.js"; -import DocInfoAdapter from "./doc-info-adapter.js"; -import errors from "../errors.js"; -import Result from "./result.js"; -import ResultMapper from "./result-mapper.js"; -import ModelMappingInfo from "./model-mapping-info.js"; -import { ModelBatchItem } from "./model-batch-item.js"; +import ModelMapper from "./model-mapper"; +import MappingHandler from "./mapping-handler"; +import DocInfoAdapter from "./doc-info-adapter"; +import errors from "../errors"; +import Result from "./result"; +import ResultMapper from "./result-mapper"; +import ModelMappingInfo from "./model-mapping-info"; +import { ModelBatchItem } from "./model-batch-item"; 'use strict'; diff --git a/lib/mapping/mapping-handler.ts b/lib/mapping/mapping-handler.ts index 8083ca33..2ac80d47 100644 --- a/lib/mapping/mapping-handler.ts +++ b/lib/mapping/mapping-handler.ts @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import utils from "../utils.js"; -import QueryGenerator from "./query-generator.js"; -import ResultMapper from "./result-mapper.js"; -import Result from "./result.js"; -import Cache from "./cache.js"; -import Tree from "./tree.js"; -import ObjectSelector from "./object-selector.js"; -import DocInfoAdapter from "./doc-info-adapter.js"; +import utils from "../utils"; +import QueryGenerator from "./query-generator"; +import ResultMapper from "./result-mapper"; +import Result from "./result"; +import Cache from "./cache"; +import Tree from "./tree"; +import ObjectSelector from "./object-selector"; +import DocInfoAdapter from "./doc-info-adapter"; 'use strict'; const cacheHighWaterMark = 100; diff --git a/lib/mapping/model-batch-item.ts b/lib/mapping/model-batch-item.ts index 9c253bd5..b3180bc3 100644 --- a/lib/mapping/model-batch-item.ts +++ b/lib/mapping/model-batch-item.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import Cache from "./cache.js"; +import Cache from "./cache"; 'use strict'; diff --git a/lib/mapping/model-batch-mapper.ts b/lib/mapping/model-batch-mapper.ts index 0bd3ee15..03d1935e 100644 --- a/lib/mapping/model-batch-mapper.ts +++ b/lib/mapping/model-batch-mapper.ts @@ -13,8 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import Tree from "./tree.js"; -import * as moduleBatchItemModule from "./model-batch-item.js"; +import Tree from "./tree"; +import * as moduleBatchItemModule from "./model-batch-item"; 'use strict'; const InsertModelBatchItem = moduleBatchItemModule.InsertModelBatchItem; diff --git a/lib/mapping/model-mapper.ts b/lib/mapping/model-mapper.ts index 3d15108e..2035ce17 100644 --- a/lib/mapping/model-mapper.ts +++ b/lib/mapping/model-mapper.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import ModelBatchMapper from "./model-batch-mapper.js"; +import ModelBatchMapper from "./model-batch-mapper"; 'use strict'; diff --git a/lib/mapping/model-mapping-info.ts b/lib/mapping/model-mapping-info.ts index c6d46e9c..d3e98274 100644 --- a/lib/mapping/model-mapping-info.ts +++ b/lib/mapping/model-mapping-info.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import tableMappingsModule from "./table-mappings.js"; +import tableMappingsModule from "./table-mappings"; 'use strict'; const TableMappings = tableMappingsModule.TableMappings; diff --git a/lib/mapping/q.ts b/lib/mapping/q.ts index 1802b499..a34d3fee 100644 --- a/lib/mapping/q.ts +++ b/lib/mapping/q.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import errors from "../errors.js"; +import errors from "../errors"; 'use strict'; diff --git a/lib/mapping/query-generator.ts b/lib/mapping/query-generator.ts index 4c59430e..d446df30 100644 --- a/lib/mapping/query-generator.ts +++ b/lib/mapping/query-generator.ts @@ -14,15 +14,15 @@ * limitations under the License. */ import vm from "vm"; -import qModule from "./q.js"; -import types from "../types/index.js"; +import qModule from "./q"; +import types from "../types/index"; 'use strict'; const QueryOperator = qModule.QueryOperator; const QueryAssignment = qModule.QueryAssignment; const dataTypes = types.dataTypes; -const vmFileName = 'gen-param-getter.js'; +const vmFileName = 'gen-param-getter'; /** * Provides methods to generate a query and parameter handlers. diff --git a/lib/mapping/result-mapper.ts b/lib/mapping/result-mapper.ts index 6ea29842..8f7679eb 100644 --- a/lib/mapping/result-mapper.ts +++ b/lib/mapping/result-mapper.ts @@ -14,8 +14,8 @@ * limitations under the License. */ import vm from "vm"; -import utils from "../utils.js"; -import types from "../types/index.js"; +import utils from "../utils"; +import types from "../types/index"; 'use strict'; diff --git a/lib/mapping/result.ts b/lib/mapping/result.ts index 24efd72b..c8a59f4f 100644 --- a/lib/mapping/result.ts +++ b/lib/mapping/result.ts @@ -14,7 +14,7 @@ * limitations under the License. */ import util from "util"; -import utils from "../utils.js"; +import utils from "../utils"; 'use strict'; const inspectMethod = util.inspect.custom || 'inspect'; diff --git a/lib/metadata/client-state.ts b/lib/metadata/client-state.ts index a4b5778d..94b4e22b 100644 --- a/lib/metadata/client-state.ts +++ b/lib/metadata/client-state.ts @@ -14,7 +14,7 @@ * limitations under the License. */ import util from "util"; -import errors from "../errors.js"; +import errors from "../errors"; 'use strict'; diff --git a/lib/metadata/event-debouncer.ts b/lib/metadata/event-debouncer.ts index 20dc378e..059a837a 100644 --- a/lib/metadata/event-debouncer.ts +++ b/lib/metadata/event-debouncer.ts @@ -14,8 +14,8 @@ * limitations under the License. */ import util from "util"; -import utils from "../utils.js"; -import promiseUtils from "../promise-utils.js"; +import utils from "../utils"; +import promiseUtils from "../promise-utils"; 'use strict'; const _queueOverflowThreshold = 1000; diff --git a/lib/metadata/index.ts b/lib/metadata/index.ts index 58d68a70..8c2a0617 100644 --- a/lib/metadata/index.ts +++ b/lib/metadata/index.ts @@ -15,15 +15,15 @@ */ import events from "events"; import util from "util"; -import t from "../tokenizer.js"; -import utils from "../utils.js"; -import errors from "../errors.js"; -import types from "../types/index.js"; -import requests from "../requests.js"; -import schemaParserFactory from "./schema-parser.js"; -import promiseUtils from "../promise-utils.js"; -import { TokenRange } from "../token.js"; -import { ExecutionOptions } from "../execution-options.js"; +import t from "../tokenizer"; +import utils from "../utils"; +import errors from "../errors"; +import types from "../types/index"; +import requests from "../requests"; +import schemaParserFactory from "./schema-parser"; +import promiseUtils from "../promise-utils"; +import { TokenRange } from "../token"; +import { ExecutionOptions } from "../execution-options"; 'use strict'; /** diff --git a/lib/metadata/materialized-view.ts b/lib/metadata/materialized-view.ts index 1ca420aa..873699b6 100644 --- a/lib/metadata/materialized-view.ts +++ b/lib/metadata/materialized-view.ts @@ -14,7 +14,7 @@ * limitations under the License. */ import util from "util"; -import DataCollection from "./data-collection.js"; +import DataCollection from "./data-collection"; 'use strict'; diff --git a/lib/metadata/schema-index.ts b/lib/metadata/schema-index.ts index cad3d34f..1f307e62 100644 --- a/lib/metadata/schema-index.ts +++ b/lib/metadata/schema-index.ts @@ -14,8 +14,8 @@ * limitations under the License. */ import util from "util"; -import utils from "../utils.js"; -import types from "../types/index.js"; +import utils from "../utils"; +import types from "../types/index"; 'use strict'; /** @private */ diff --git a/lib/metadata/schema-parser.ts b/lib/metadata/schema-parser.ts index e039bfb3..120d8bd2 100644 --- a/lib/metadata/schema-parser.ts +++ b/lib/metadata/schema-parser.ts @@ -15,15 +15,15 @@ */ import util from "util"; import events from "events"; -import types from "../types/index.js"; -import utils from "../utils.js"; -import errors from "../errors.js"; -import promiseUtils from "../promise-utils.js"; -import TableMetadata from "./table-metadata.js"; -import Aggregate from "./aggregate.js"; -import SchemaFunction from "./schema-function.js"; -import Index from "./schema-index.js"; -import MaterializedView from "./materialized-view.js"; +import types from "../types/index"; +import utils from "../utils"; +import errors from "../errors"; +import promiseUtils from "../promise-utils"; +import TableMetadata from "./table-metadata"; +import Aggregate from "./aggregate"; +import SchemaFunction from "./schema-function"; +import Index from "./schema-index"; +import MaterializedView from "./materialized-view"; 'use strict'; const { format } = util; diff --git a/lib/metadata/table-metadata.ts b/lib/metadata/table-metadata.ts index e5992c68..9e93a041 100644 --- a/lib/metadata/table-metadata.ts +++ b/lib/metadata/table-metadata.ts @@ -14,7 +14,7 @@ * limitations under the License. */ import util from "util"; -import DataCollection from "./data-collection.js"; +import DataCollection from "./data-collection"; 'use strict'; diff --git a/lib/metrics/default-metrics.ts b/lib/metrics/default-metrics.ts index 8926d6e5..66328390 100644 --- a/lib/metrics/default-metrics.ts +++ b/lib/metrics/default-metrics.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import ClientMetrics from "./client-metrics.js"; +import ClientMetrics from "./client-metrics"; import EventEmitter from "events"; 'use strict'; diff --git a/lib/metrics/index.ts b/lib/metrics/index.ts index ed12a388..9e2e3286 100644 --- a/lib/metrics/index.ts +++ b/lib/metrics/index.ts @@ -13,8 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import ClientMetrics from "./client-metrics.js"; -import DefaultMetrics from "./default-metrics.js"; +import ClientMetrics from "./client-metrics"; +import DefaultMetrics from "./default-metrics"; 'use strict'; diff --git a/lib/operation-state.ts b/lib/operation-state.ts index 608a6a32..d9d9f501 100644 --- a/lib/operation-state.ts +++ b/lib/operation-state.ts @@ -14,9 +14,9 @@ * limitations under the License. */ import util from "util"; -import utils from "./utils.js"; -import errors from "./errors.js"; -import requests from "./requests.js"; +import utils from "./utils"; +import errors from "./errors"; +import requests from "./requests"; 'use strict'; const ExecuteRequest = requests.ExecuteRequest; diff --git a/lib/policies/address-resolution.ts b/lib/policies/address-resolution.ts index 7d5ac23d..77d7cff9 100644 --- a/lib/policies/address-resolution.ts +++ b/lib/policies/address-resolution.ts @@ -15,7 +15,7 @@ */ import dns from "dns"; import util from "util"; -import utils from "../utils.js"; +import utils from "../utils"; 'use strict'; diff --git a/lib/policies/index.ts b/lib/policies/index.ts index 0bf6c439..a142eff8 100644 --- a/lib/policies/index.ts +++ b/lib/policies/index.ts @@ -15,12 +15,12 @@ */ 'use strict'; -import * as addressResolution from './address-resolution.js'; -import * as loadBalancing from './load-balancing.js'; -import * as reconnection from './reconnection.js'; -import * as retry from './retry.js'; -import * as speculativeExecution from './speculative-execution.js'; -import * as timestampGeneration from './timestamp-generation.js'; +import * as addressResolution from './address-resolution'; +import * as loadBalancing from './load-balancing'; +import * as reconnection from './reconnection'; +import * as retry from './retry'; +import * as speculativeExecution from './speculative-execution'; +import * as timestampGeneration from './timestamp-generation'; /** * Returns a new instance of the default address translator policy used by the driver. diff --git a/lib/policies/load-balancing.ts b/lib/policies/load-balancing.ts index bbb9a6ac..c3c9891f 100644 --- a/lib/policies/load-balancing.ts +++ b/lib/policies/load-balancing.ts @@ -14,9 +14,9 @@ * limitations under the License. */ import util from "util"; -import types from "../types/index.js"; -import utils from "../utils.js"; -import errors from "../errors.js"; +import types from "../types/index"; +import utils from "../utils"; +import errors from "../errors"; 'use strict'; const doneIteratorObject = Object.freeze({ done: true }); diff --git a/lib/policies/speculative-execution.ts b/lib/policies/speculative-execution.ts index ccd79bc5..93d7948e 100644 --- a/lib/policies/speculative-execution.ts +++ b/lib/policies/speculative-execution.ts @@ -14,7 +14,7 @@ * limitations under the License. */ import util from "util"; -import errors from "../errors.js"; +import errors from "../errors"; 'use strict'; diff --git a/lib/policies/timestamp-generation.ts b/lib/policies/timestamp-generation.ts index cb2a4622..cb3b280c 100644 --- a/lib/policies/timestamp-generation.ts +++ b/lib/policies/timestamp-generation.ts @@ -14,8 +14,8 @@ * limitations under the License. */ import util from "util"; -import { Long } from "../types/index.js"; -import errors from "../errors.js"; +import { Long } from "../types/index"; +import errors from "../errors"; 'use strict'; /** @module policies/timestampGeneration */ diff --git a/lib/prepare-handler.ts b/lib/prepare-handler.ts index ad0e4212..15c38d8a 100644 --- a/lib/prepare-handler.ts +++ b/lib/prepare-handler.ts @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import errors from "./errors.js"; -import utils from "./utils.js"; -import types from "./types/index.js"; -import promiseUtils from "./promise-utils.js"; +import errors from "./errors"; +import utils from "./utils"; +import types from "./types/index"; +import promiseUtils from "./promise-utils"; 'use strict'; diff --git a/lib/readers.ts b/lib/readers.ts index 0eb4496e..5aa49116 100644 --- a/lib/readers.ts +++ b/lib/readers.ts @@ -14,9 +14,9 @@ * limitations under the License. */ import util from "util"; -import utils from "./utils.js"; -import types from "./types/index.js"; -import errors from "./errors.js"; +import utils from "./utils"; +import types from "./types/index"; +import errors from "./errors"; 'use strict'; /** diff --git a/lib/request-execution.ts b/lib/request-execution.ts index 3ca7054e..a7edf36f 100644 --- a/lib/request-execution.ts +++ b/lib/request-execution.ts @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import errors from "./errors.js"; -import requests from "./requests.js"; -import retry from "./policies/retry.js"; -import types from "./types/index.js"; -import utils from "./utils.js"; -import promiseUtils from "./promise-utils.js"; +import errors from "./errors"; +import requests from "./requests"; +import retry from "./policies/retry"; +import types from "./types/index"; +import utils from "./utils"; +import promiseUtils from "./promise-utils"; 'use strict'; const retryOnCurrentHost = Object.freeze({ diff --git a/lib/request-handler.ts b/lib/request-handler.ts index d079d34f..f14ab685 100644 --- a/lib/request-handler.ts +++ b/lib/request-handler.ts @@ -14,11 +14,11 @@ * limitations under the License. */ import util from "util"; -import errors from "./errors.js"; -import types from "./types/index.js"; -import utils from "./utils.js"; -import RequestExecution from "./request-execution.js"; -import promiseUtils from "./promise-utils.js"; +import errors from "./errors"; +import types from "./types/index"; +import utils from "./utils"; +import RequestExecution from "./request-execution"; +import promiseUtils from "./promise-utils"; 'use strict'; diff --git a/lib/requests.ts b/lib/requests.ts index 481a6c9b..92877e1b 100644 --- a/lib/requests.ts +++ b/lib/requests.ts @@ -14,10 +14,10 @@ * limitations under the License. */ import util from "util"; -import { FrameWriter } from "./writers.js"; -import types from "./types/index.js"; -import utils from "./utils.js"; -import { ExecutionOptions } from "./execution-options.js"; +import { FrameWriter } from "./writers"; +import types from "./types/index"; +import utils from "./utils"; +import { ExecutionOptions } from "./execution-options"; import packageInfo from "../package.json" assert {type: 'json'}; 'use strict'; diff --git a/lib/stream-id-stack.ts b/lib/stream-id-stack.ts index 25b12804..6eeda569 100644 --- a/lib/stream-id-stack.ts +++ b/lib/stream-id-stack.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import types from "./types/index.js"; +import types from "./types/index"; 'use strict'; /** diff --git a/lib/streams.ts b/lib/streams.ts index 7071787b..00fc7001 100644 --- a/lib/streams.ts +++ b/lib/streams.ts @@ -15,10 +15,10 @@ */ import util from "util"; import { Transform, Writable } from "stream"; -import types from "./types/index.js"; -import utils from "./utils.js"; -import errors from "./errors.js"; -import { FrameReader } from "./readers.js"; +import types from "./types/index"; +import utils from "./utils"; +import errors from "./errors"; +import { FrameReader } from "./readers"; 'use strict'; const { FrameHeader } = types; diff --git a/lib/token.ts b/lib/token.ts index e7110b46..2dd7830c 100644 --- a/lib/token.ts +++ b/lib/token.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import types from "./types/index.js"; +import types from "./types/index"; import util from "util"; 'use strict'; diff --git a/lib/tokenizer.ts b/lib/tokenizer.ts index 36c90069..2340e2ed 100644 --- a/lib/tokenizer.ts +++ b/lib/tokenizer.ts @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import types from "./types/index.js"; -import token from "./token.js"; -import utils from "./utils.js"; -import MutableLong from "./types/mutable-long.js"; +import types from "./types/index"; +import token from "./token"; +import utils from "./utils"; +import MutableLong from "./types/mutable-long"; 'use strict'; const { Integer } = types; diff --git a/lib/tracker/index.ts b/lib/tracker/index.ts index bf0255a5..3e11bf53 100644 --- a/lib/tracker/index.ts +++ b/lib/tracker/index.ts @@ -21,8 +21,8 @@ * @module tracker */ -import RequestTracker from "./request-tracker.js"; -import RequestLogger from "./request-logger.js"; +import RequestTracker from "./request-tracker"; +import RequestLogger from "./request-logger"; export { RequestTracker, RequestLogger diff --git a/lib/tracker/request-logger.ts b/lib/tracker/request-logger.ts index 47d73148..ff42ddae 100644 --- a/lib/tracker/request-logger.ts +++ b/lib/tracker/request-logger.ts @@ -14,8 +14,8 @@ * limitations under the License. */ import events from "events"; -import RequestTracker from "./request-tracker.js"; -import errors from "../errors.js"; +import RequestTracker from "./request-tracker"; +import errors from "../errors"; import { format } from "util"; 'use strict'; diff --git a/lib/types/big-decimal.ts b/lib/types/big-decimal.ts index bf755193..9cc84010 100644 --- a/lib/types/big-decimal.ts +++ b/lib/types/big-decimal.ts @@ -13,8 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import Integer from "./integer.js"; -import utils from "../utils.js"; +import Integer from "./integer"; +import utils from "../utils"; 'use strict'; diff --git a/lib/types/duration.ts b/lib/types/duration.ts index fcf944ca..934e1f58 100644 --- a/lib/types/duration.ts +++ b/lib/types/duration.ts @@ -15,7 +15,7 @@ */ import Long from "long"; import util from "util"; -import utils from "../utils.js"; +import utils from "../utils"; const VIntCoding = utils.VIntCoding; diff --git a/lib/types/index.ts b/lib/types/index.ts index 0821b35a..04e98430 100644 --- a/lib/types/index.ts +++ b/lib/types/index.ts @@ -14,23 +14,23 @@ * limitations under the License. */ import util from "util"; -import errors from "../errors.js"; -import TimeUuid from "./time-uuid.js"; -import Uuid from "./uuid.js"; -import protocolVersion from "./protocol-version.js"; -import utils from "../utils.js"; +import errors from "../errors"; +import TimeUuid from "./time-uuid"; +import Uuid from "./uuid"; +import protocolVersion from "./protocol-version"; +import utils from "../utils"; import Long from "long"; -import BigDecimal from './big-decimal.js'; -import Duration from './duration.js'; -import InetAddress from './inet-address.js'; -import Integer from './integer.js'; -import LocalDate from './local-date.js'; -import LocalTime from './local-time.js'; -import ResultSet from './result-set.js'; -import ResultStream from './result-stream.js'; -import Row from './row.js'; -import Tuple from './tuple.js'; -import Vector from "./vector.js"; +import BigDecimal from './big-decimal'; +import Duration from './duration'; +import InetAddress from './inet-address'; +import Integer from './integer'; +import LocalDate from './local-date'; +import LocalTime from './local-time'; +import ResultSet from './result-set'; +import ResultStream from './result-stream'; +import Row from './row'; +import Tuple from './tuple'; +import Vector from "./vector"; 'use strict'; diff --git a/lib/types/inet-address.ts b/lib/types/inet-address.ts index 1edacb04..2f819987 100644 --- a/lib/types/inet-address.ts +++ b/lib/types/inet-address.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import utils from "../utils.js"; +import utils from "../utils"; 'use strict'; diff --git a/lib/types/integer.ts b/lib/types/integer.ts index 6f05ef2c..ae7e2539 100644 --- a/lib/types/integer.ts +++ b/lib/types/integer.ts @@ -1,4 +1,4 @@ -import utils from "../utils.js"; +import utils from "../utils"; // Copyright 2009 The Closure Library Authors. All Rights Reserved. // diff --git a/lib/types/local-date.ts b/lib/types/local-date.ts index a3fd09ca..5d32847f 100644 --- a/lib/types/local-date.ts +++ b/lib/types/local-date.ts @@ -14,7 +14,7 @@ * limitations under the License. */ import util from "util"; -import utils from "../utils.js"; +import utils from "../utils"; 'use strict'; /** @module types */ diff --git a/lib/types/local-time.ts b/lib/types/local-time.ts index 468d23b9..cb0b28ab 100644 --- a/lib/types/local-time.ts +++ b/lib/types/local-time.ts @@ -15,7 +15,7 @@ */ import Long from "long"; import util from "util"; -import utils from "../utils.js"; +import utils from "../utils"; 'use strict'; /** @module types */ diff --git a/lib/types/protocol-version.ts b/lib/types/protocol-version.ts index 2a0f805e..670c4ad1 100644 --- a/lib/types/protocol-version.ts +++ b/lib/types/protocol-version.ts @@ -13,8 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import utils from "../utils.js"; -import VersionNumber from "./version-number.js"; +import utils from "../utils"; +import VersionNumber from "./version-number"; 'use strict'; const v200 = VersionNumber.parse('2.0.0'); diff --git a/lib/types/result-set.ts b/lib/types/result-set.ts index e6a6931a..453d3b65 100644 --- a/lib/types/result-set.ts +++ b/lib/types/result-set.ts @@ -13,8 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import utils from "../utils.js"; -import errors from "../errors.js"; +import utils from "../utils"; +import errors from "../errors"; 'use strict'; const asyncIteratorSymbol = Symbol.asyncIterator || '@@asyncIterator'; diff --git a/lib/types/result-stream.ts b/lib/types/result-stream.ts index c95ca262..736883bb 100644 --- a/lib/types/result-stream.ts +++ b/lib/types/result-stream.ts @@ -14,9 +14,9 @@ * limitations under the License. */ import { Readable } from "stream"; -import utils from "../utils.js"; -import errors from "../errors.js"; -import clientOptions from "../client-options.js"; +import utils from "../utils"; +import errors from "../errors"; +import clientOptions from "../client-options"; 'use strict'; diff --git a/lib/types/time-uuid.ts b/lib/types/time-uuid.ts index 4ab69ba3..6ac83e4e 100644 --- a/lib/types/time-uuid.ts +++ b/lib/types/time-uuid.ts @@ -16,8 +16,8 @@ import util from "util"; import crypto from "crypto"; import Long from "long"; -import Uuid from "./uuid.js"; -import utils from "../utils.js"; +import Uuid from "./uuid"; +import utils from "../utils"; 'use strict'; /** @module types */ diff --git a/lib/types/uuid.ts b/lib/types/uuid.ts index 9ec0d3ca..3fae3346 100644 --- a/lib/types/uuid.ts +++ b/lib/types/uuid.ts @@ -14,7 +14,7 @@ * limitations under the License. */ import crypto from "crypto"; -import utils from "../utils.js"; +import utils from "../utils"; 'use strict'; diff --git a/lib/utils.ts b/lib/utils.ts index 8aecdbf5..90f04b13 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -16,8 +16,8 @@ import util from "util"; import net from "net"; import { EventEmitter } from "events"; -import errors from "./errors.js"; -import promiseUtils from "./promise-utils.js"; +import errors from "./errors"; +import promiseUtils from "./promise-utils"; 'use strict'; /** @@ -1413,3 +1413,50 @@ export default { HashSet, VIntCoding }; + +export { + adaptNamedParamsPrepared, + adaptNamedParamsWithHints, + AddressResolver, + allocBuffer, + allocBufferUnsafe, + allocBufferFromArray, + allocBufferFromString, + arrayIterator, + binarySearch, + callbackOnce, + copyBuffer, + deepExtend, + each, + eachSeries, + emptyArray, + emptyObject, + extend, + fixStack, + forEachOf, + funcCompare, + ifUndefined, + ifUndefined3, + insertSorted, + iteratorToArray, + log, + map, + mapSeries, + maxInt, + noop, + objectValues, + parallel, + promiseWrapper, + propCompare, + series, + shuffleArray, + stringRepeat, + times, + timesLimit, + timesSeries, + totalLength, + validateFn, + whilst, + HashSet, + VIntCoding +}; diff --git a/lib/writers.ts b/lib/writers.ts index 9f531b1a..031ee3fd 100644 --- a/lib/writers.ts +++ b/lib/writers.ts @@ -14,8 +14,8 @@ * limitations under the License. */ import events from "events"; -import types from "./types/index.js"; -import utils from "./utils.js"; +import types from "./types/index"; +import utils from "./utils"; 'use strict'; const FrameHeader = types.FrameHeader; diff --git a/package-lock.json b/package-lock.json index 89a2bee7..8b4f0278 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "cassandra-driver", - "version": "4.8.0", + "name": "@SiyaoIsHiding/cassandra-driver", + "version": "0.0.8", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "cassandra-driver", - "version": "4.8.0", + "name": "@SiyaoIsHiding/cassandra-driver", + "version": "0.0.8", "license": "Apache-2.0", "dependencies": { "@types/node": "^18.11.18", @@ -21,9 +21,7 @@ "mocha-jenkins-reporter": "~0.4.8", "proxyquire": "~2.1.3", "sinon": "~15.2.0", - "temp": ">= 0.8.3", - "ts-mocha": "^10.0.0", - "typescript": "^5.7.3" + "temp": ">= 0.8.3" }, "engines": { "node": ">=18" @@ -73,13 +71,6 @@ "integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==", "dev": true }, - "node_modules/@types/json5": { - "version": "0.0.29", - "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", - "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", - "dev": true, - "optional": true - }, "node_modules/@types/mocha": { "version": "10.0.10", "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.10.tgz", @@ -154,15 +145,6 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "dev": true }, - "node_modules/arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", @@ -293,12 +275,6 @@ "ieee754": "^1.1.13" } }, - "node_modules/buffer-from": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true - }, "node_modules/camelcase": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", @@ -893,19 +869,6 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/json5": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", - "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", - "dev": true, - "optional": true, - "dependencies": { - "minimist": "^1.2.0" - }, - "bin": { - "json5": "lib/cli.js" - } - }, "node_modules/just-extend": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz", @@ -978,12 +941,6 @@ "get-func-name": "^2.0.0" } }, - "node_modules/make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true - }, "node_modules/merge-descriptors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", @@ -1573,25 +1530,6 @@ "node": ">=8" } }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/source-map-support": { - "version": "0.5.21", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", - "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", - "dev": true, - "dependencies": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, "node_modules/string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", @@ -1633,16 +1571,6 @@ "node": ">=8" } }, - "node_modules/strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", - "dev": true, - "optional": true, - "engines": { - "node": ">=4" - } - }, "node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -1749,71 +1677,6 @@ "node": ">=8.0" } }, - "node_modules/ts-mocha": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/ts-mocha/-/ts-mocha-10.0.0.tgz", - "integrity": "sha512-VRfgDO+iiuJFlNB18tzOfypJ21xn2xbuZyDvJvqpTbWgkAgD17ONGr8t+Tl8rcBtOBdjXp5e/Rk+d39f7XBHRw==", - "dev": true, - "dependencies": { - "ts-node": "7.0.1" - }, - "bin": { - "ts-mocha": "bin/ts-mocha" - }, - "engines": { - "node": ">= 6.X.X" - }, - "optionalDependencies": { - "tsconfig-paths": "^3.5.0" - }, - "peerDependencies": { - "mocha": "^3.X.X || ^4.X.X || ^5.X.X || ^6.X.X || ^7.X.X || ^8.X.X || ^9.X.X || ^10.X.X" - } - }, - "node_modules/ts-node": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-7.0.1.tgz", - "integrity": "sha512-BVwVbPJRspzNh2yfslyT1PSbl5uIk03EZlb493RKHN4qej/D06n1cEhjlOJG69oFsE7OT8XjpTUcYf6pKTLMhw==", - "dev": true, - "dependencies": { - "arrify": "^1.0.0", - "buffer-from": "^1.1.0", - "diff": "^3.1.0", - "make-error": "^1.1.1", - "minimist": "^1.2.0", - "mkdirp": "^0.5.1", - "source-map-support": "^0.5.6", - "yn": "^2.0.0" - }, - "bin": { - "ts-node": "dist/bin.js" - }, - "engines": { - "node": ">=4.2.0" - } - }, - "node_modules/ts-node/node_modules/diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/tsconfig-paths": { - "version": "3.15.0", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", - "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", - "dev": true, - "optional": true, - "dependencies": { - "@types/json5": "^0.0.29", - "json5": "^1.0.2", - "minimist": "^1.2.6", - "strip-bom": "^3.0.0" - } - }, "node_modules/tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -1835,19 +1698,6 @@ "node": ">=4" } }, - "node_modules/typescript": { - "version": "5.7.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.3.tgz", - "integrity": "sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", @@ -1945,15 +1795,6 @@ "node": ">=10" } }, - "node_modules/yn": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz", - "integrity": "sha512-uTv8J/wiWTgUTg+9vLTi//leUl5vDQS6uii/emeTb2ssY7vl6QWf2fFbIIGjnhjvbdKlU0ed7QPgY1htTC86jQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/package.json b/package.json index e06f761a..e489e476 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "long": "~5.2.3" }, "devDependencies": { + "@types/mocha": "^10.0.10", "chai": "~4.3.8", "kerberos": "~2.0.3", "mocha": "~10.2.0", @@ -51,7 +52,7 @@ "ci_unit_appveyor": ".\\\"node_modules/.bin/mocha\" test/unit --recursive -R mocha-appveyor-reporter --exit", "server_api": "./node_modules/.bin/mocha test/integration/short -g '@SERVER_API' --recursive --exit", "eslint": "eslint lib test", - "test-ts": "npx ts-mocha test/unit test/integration/short --extension .ts --recursive --exit" + "test-ts": "npx ts-mocha test/unit test/integration/short --extension .ts --recursive --exit" }, "engines": { "node": ">=18" diff --git a/test/integration/short/vector-tests.ts b/test/integration/short/vector-tests.ts index 77a3b522..4d05fa34 100644 --- a/test/integration/short/vector-tests.ts +++ b/test/integration/short/vector-tests.ts @@ -15,10 +15,10 @@ */ 'use strict'; const assert = require('assert'); -const helper = require('../../test-helper.js'); +const helper = require('../../test-helper'); -const { types } = require('../../../index.js'); -const Vector = require('../../../lib/types/vector.js'); +const { types } = require('../../../index'); +const Vector = require('../../../lib/types/vector'); const util = require('node:util'); const vdescribe = helper.vdescribe; vdescribe('5.0.0', 'Vector tests', function () { diff --git a/test/unit/encoder-tests.ts b/test/unit/encoder-tests.ts index 354dcba9..ad5c5bd2 100644 --- a/test/unit/encoder-tests.ts +++ b/test/unit/encoder-tests.ts @@ -22,7 +22,7 @@ const tokenizer = require('../../lib/tokenizer'); const token = require('../../lib/token'); const Vector = require('../../lib/types/vector'); const Encoder = require('../../lib/encoder'); -const { types } = require('../../index.js'); +const { types } = require('../../index'); const ExecutionOptions = require('../../lib/execution-options').ExecutionOptions; const dataTypes = types.dataTypes; const helper = require('../test-helper'); From 2f1eb9f073136ff63280d67d81a662aff56c515a Mon Sep 17 00:00:00 2001 From: janehe Date: Mon, 10 Mar 2025 17:07:27 -0700 Subject: [PATCH 13/19] Update import syntax for tests. Pass tests except for constructor errors --- index.ts | 24 ++++++ lib/utils.ts | 1 + .../integration/long/client-metadata-tests.ts | 17 ++--- test/integration/long/event-tests.ts | 11 ++- test/integration/long/load-balancing-tests.ts | 14 ++-- .../auth/dse-gssapi-auth-provider-tests.ts | 8 +- .../dse-plain-text-auth-provider-tests.ts | 6 +- .../short/auth/proxy-authentication-test.ts | 12 +-- test/integration/short/client-batch-tests.ts | 16 ++-- .../short/client-each-row-tests.ts | 17 ++--- .../short/client-execute-prepared-tests.ts | 23 +++--- .../short/client-execute-simulator-tests.ts | 20 ++--- .../integration/short/client-execute-tests.ts | 23 +++--- test/integration/short/client-pool-tests.ts | 27 ++++--- test/integration/short/client-stream-tests.ts | 17 ++--- test/integration/short/cloud/cloud-helper.ts | 13 ++-- test/integration/short/cloud/cloud-tests.ts | 25 +++---- .../concurrent/execute-concurrent-tests.ts | 15 ++-- test/integration/short/connection-tests.ts | 21 +++--- .../control-connection-simulator-tests.ts | 16 ++-- .../short/control-connection-tests.ts | 21 +++--- .../integration/short/custom-payload-tests.ts | 14 ++-- test/integration/short/duration-type-tests.ts | 12 +-- .../short/error-simulator-tests.ts | 19 +++-- test/integration/short/error-tests.ts | 14 ++-- .../short/execution-profile-tests.ts | 19 ++--- .../short/geometry/line-string-tests.ts | 15 ++-- .../integration/short/geometry/point-tests.ts | 15 ++-- .../short/geometry/polygon-tests.ts | 15 ++-- .../short/graph/graph-olap-tests.ts | 22 +++--- .../short/graph/graph-test-helper.ts | 73 ++++++++++--------- test/integration/short/graph/graph-tests.ts | 26 +++---- .../short/graph/graph-timeout-tests.ts | 16 ++-- .../short/graph/graph-with-down-node-tests.ts | 16 ++-- .../short/insights-simulator-tests.ts | 14 ++-- .../short/load-balancing-simulator-tests.ts | 22 +++--- .../integration/short/load-balancing-tests.ts | 16 ++-- .../short/mapping/custom-queries-tests.ts | 12 ++- .../from-and-to-model-function-tests.ts | 13 ++-- .../short/mapping/mapper-test-helper.ts | 21 +++--- .../integration/short/mapping/mapper-tests.ts | 19 +++-- .../short/mapping/model-mapper-tests.ts | 19 +++-- .../short/metadata-simulator-tests.ts | 10 +-- test/integration/short/metadata-tests.ts | 13 ++-- test/integration/short/numeric-tests.ts | 14 ++-- test/integration/short/paging-tests.ts | 14 ++-- .../integration/short/pool-simulator-tests.ts | 23 +++--- .../short/prepare-simulator-tests.ts | 18 ++--- .../short/retry-simulator-tests.ts | 15 ++-- .../short/search/date-range-tests.ts | 15 ++-- .../speculative-execution-simulator-tests.ts | 18 ++--- test/integration/short/ssl-tests.ts | 17 ++--- .../short/timeout-simulator-tests.ts | 13 ++-- .../short/tracker-simulator-tests.ts | 21 +++--- test/integration/short/udf-tests.ts | 12 +-- test/integration/short/vector-tests.ts | 12 +-- test/integration/simulacron.ts | 16 ++-- test/other/memory/basic-profile.ts | 13 ++-- test/other/memory/profile-keeping-ref.ts | 13 ++-- test/test-helper.ts | 41 +++++------ test/unit/address-resolution-tests.ts | 8 +- test/unit/api-tests.ts | 10 +-- test/unit/basic-tests.ts | 37 +++++----- test/unit/big-decimal-tests.ts | 9 +-- test/unit/client-tests.ts | 36 ++++----- .../cloud/certificate-validation-tests.ts | 6 +- .../concurrent/execute-concurrent-tests.ts | 14 ++-- test/unit/connection-tests.ts | 24 +++--- test/unit/control-connection-tests.ts | 29 ++++---- .../default-load-balancing-policy-tests.ts | 25 +++---- test/unit/dse-gssapi-auth-provider-tests.ts | 6 +- .../dse-plain-text-auth-provider-tests.ts | 2 +- test/unit/duration-type-tests.ts | 9 ++- test/unit/encoder-tests.ts | 24 +++--- test/unit/encoder-vector-tests.ts | 12 +-- test/unit/error-tests.ts | 10 +-- test/unit/event-debouncer-tests.ts | 12 ++- test/unit/execution-options-tests.ts | 16 ++-- test/unit/execution-profile-tests.ts | 12 ++- test/unit/geometry/line-string-tests.ts | 11 ++- test/unit/geometry/point-tests.ts | 9 +-- test/unit/geometry/polygon-tests.ts | 11 ++- test/unit/graph/executor-tests.ts | 20 +++-- test/unit/graph/graph-result-tests.ts | 11 ++- test/unit/graph/graphson-tests.ts | 18 ++--- test/unit/host-tests.ts | 27 ++++--- test/unit/inet-address-tests.ts | 8 +- test/unit/insights-client-tests.ts | 26 +++---- test/unit/license-tests.ts | 8 +- test/unit/load-balancing-tests.ts | 24 +++--- test/unit/mapping/cache-tests.ts | 8 +- test/unit/mapping/mapper-tests.ts | 14 ++-- test/unit/mapping/mapper-unit-test-helper.ts | 13 ++-- test/unit/mapping/mapping-handler-tests.ts | 14 ++-- .../mapping/model-mapper-mutation-tests.ts | 11 ++- .../unit/mapping/model-mapper-select-tests.ts | 12 ++- test/unit/mapping/model-mapping-info-tests.ts | 7 +- test/unit/mapping/result-mapper-tests.ts | 9 +-- test/unit/mapping/result-tests.ts | 8 +- test/unit/mapping/table-mappings-tests.ts | 5 +- test/unit/mapping/tree-tests.ts | 6 +- test/unit/metadata-tests.ts | 37 +++++----- test/unit/mutable-long-tests.ts | 9 +-- test/unit/parser-tests.ts | 19 +++-- test/unit/prepare-handler-tests.ts | 15 ++-- test/unit/protocol-stream-tests.ts | 9 +-- test/unit/protocol-version-tests.ts | 9 ++- test/unit/reconnection-test.ts | 10 +-- test/unit/request-handler-tests.ts | 33 ++++----- test/unit/requests-test.ts | 14 ++-- test/unit/result-set-tests.ts | 12 +-- test/unit/retry-policy-tests.ts | 11 +-- test/unit/search/date-range-tests.ts | 10 +-- test/unit/speculative-execution-tests.ts | 6 +- test/unit/stream-id-stack-tests.ts | 8 +- test/unit/timestamp-tests.ts | 9 +-- test/unit/token-tests.ts | 8 +- test/unit/tokenizer-tests.ts | 17 ++--- test/unit/tracker-tests.ts | 12 ++- test/unit/utils-tests.ts | 9 ++- test/unit/uuid-tests.ts | 10 +-- test/unit/version-number-tests.ts | 7 +- tsconfig.json | 4 +- 123 files changed, 915 insertions(+), 1001 deletions(-) diff --git a/index.ts b/index.ts index dc2ed9d2..40826b41 100644 --- a/index.ts +++ b/index.ts @@ -66,4 +66,28 @@ export { */ defaultOptions, version +}; + +export default { + Client, + ExecutionProfile, + ExecutionOptions, + types, + errors, + policies, + auth, + mapping, + tracker, + metrics, + concurrent, + token, + metadata, + Encoder, + geometry, + datastax, + /** + * Returns a new instance of the default [options]{@link ClientOptions} used by the driver. + */ + defaultOptions, + version }; \ No newline at end of file diff --git a/lib/utils.ts b/lib/utils.ts index 90f04b13..e4c8886a 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import Long from "long"; import util from "util"; import net from "net"; import { EventEmitter } from "events"; diff --git a/test/integration/long/client-metadata-tests.ts b/test/integration/long/client-metadata-tests.ts index 6833f913..48a7ca83 100644 --- a/test/integration/long/client-metadata-tests.ts +++ b/test/integration/long/client-metadata-tests.ts @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const assert = require('assert'); -const util = require('util'); - -const helper = require('../../test-helper'); -const Encoder = require('../../../lib/encoder'); -const Client = require('../../../lib/client'); -const utils = require('../../../lib/utils'); -const tokenizer = require('../../../lib/tokenizer'); +import assert from "assert"; +import util from "util"; +import helper from "../../test-helper"; +import Encoder from "../../../lib/encoder"; +import Client from "../../../lib/client"; +import utils from "../../../lib/utils"; +import tokenizer from "../../../lib/tokenizer"; +'use strict'; describe('Client', function () { this.timeout(240000); describe('#getReplicas() with MurmurPartitioner', function () { diff --git a/test/integration/long/event-tests.ts b/test/integration/long/event-tests.ts index b3cfc3d6..693b9803 100644 --- a/test/integration/long/event-tests.ts +++ b/test/integration/long/event-tests.ts @@ -14,13 +14,12 @@ * limitations under the License. */ 'use strict'; -const assert = require('assert'); -const helper = require('../../test-helper'); -const Host = require('../../../lib/host').Host; -const utils = require('../../../lib/utils'); - -const Client = require('../../../lib/client'); +import assert from "assert"; +import helper from "../../test-helper"; +import utils from "../../../lib/utils"; +import Client from "../../../lib/client"; +import { Host } from "../../../lib/host"; describe('Client', function () { describe('events', function () { diff --git a/test/integration/long/load-balancing-tests.ts b/test/integration/long/load-balancing-tests.ts index d28f6dd3..72dd989a 100644 --- a/test/integration/long/load-balancing-tests.ts +++ b/test/integration/long/load-balancing-tests.ts @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const assert = require('assert'); -const util = require('util'); +import assert from "assert"; +import util from "util"; +import helper from "../../test-helper"; +import Client from "../../../lib/client"; +import utils from "../../../lib/utils"; +import loadBalancing from "../../../lib/policies/load-balancing"; -const helper = require('../../test-helper'); -const Client = require('../../../lib/client'); -const utils = require('../../../lib/utils'); -const loadBalancing = require('../../../lib/policies/load-balancing'); +'use strict'; const DCAwareRoundRobinPolicy = loadBalancing.DCAwareRoundRobinPolicy; const TokenAwarePolicy = loadBalancing.TokenAwarePolicy; diff --git a/test/integration/short/auth/dse-gssapi-auth-provider-tests.ts b/test/integration/short/auth/dse-gssapi-auth-provider-tests.ts index 82e49d7a..b47934c6 100644 --- a/test/integration/short/auth/dse-gssapi-auth-provider-tests.ts +++ b/test/integration/short/auth/dse-gssapi-auth-provider-tests.ts @@ -14,11 +14,11 @@ * limitations under the License. */ 'use strict'; -const assert = require('assert'); -const helper = require('../../../test-helper'); import DseGssapiAuthProvider from '../../../../lib/auth/dse-gssapi-auth-provider'; -const Client = require('../../../../lib/client'); -const errors = require('../../../../lib/errors'); +import assert from "assert"; +import helper from "../../../test-helper"; +import Client from "../../../../lib/client"; +import errors from "../../../../lib/errors"; const ads = helper.ads; const cDescribe = helper.conditionalDescribe( helper.requireOptional('kerberos') && helper.isDseGreaterThan('5.0'), 'kerberos and DSE required to run'); diff --git a/test/integration/short/auth/dse-plain-text-auth-provider-tests.ts b/test/integration/short/auth/dse-plain-text-auth-provider-tests.ts index 2f1c0aa3..ad464314 100644 --- a/test/integration/short/auth/dse-plain-text-auth-provider-tests.ts +++ b/test/integration/short/auth/dse-plain-text-auth-provider-tests.ts @@ -14,10 +14,10 @@ * limitations under the License. */ 'use strict'; -const { assert } = require('chai'); -const helper = require('../../../test-helper'); import DsePlainTextAuthProvider from '../../../../lib/auth/dse-plain-text-auth-provider'; -const Client = require('../../../../lib/client'); +import { assert } from "chai"; +import helper from "../../../test-helper"; +import Client from "../../../../lib/client"; const vdescribe = helper.vdescribe; vdescribe('dse-5.0', 'DsePlainTextAuthProvider @SERVER_API', function () { diff --git a/test/integration/short/auth/proxy-authentication-test.ts b/test/integration/short/auth/proxy-authentication-test.ts index f751299c..ceb0881d 100644 --- a/test/integration/short/auth/proxy-authentication-test.ts +++ b/test/integration/short/auth/proxy-authentication-test.ts @@ -14,14 +14,14 @@ * limitations under the License. */ 'use strict'; -const assert = require('assert'); -const helper = require('../../../test-helper'); import DsePlainTextAuthProvider from '../../../../lib/auth/dse-plain-text-auth-provider'; import DseGssapiAuthProvider from '../../../../lib/auth/dse-gssapi-auth-provider'; -const Client = require('../../../../lib/client'); -const utils = require('../../../../lib/utils'); -const errors = require('../../../../lib/errors'); -const types = require('../../../../lib/types'); +import assert from "assert"; +import helper from "../../../test-helper"; +import Client from "../../../../lib/client"; +import utils from "../../../../lib/utils"; +import errors from "../../../../lib/errors"; +import types from "../../../../lib/types/index"; const vdescribe = helper.vdescribe; const ads = helper.ads; const cDescribe = helper.conditionalDescribe(helper.requireOptional('kerberos'), 'kerberos required to run'); diff --git a/test/integration/short/client-batch-tests.ts b/test/integration/short/client-batch-tests.ts index 662a7f80..7c796e6d 100644 --- a/test/integration/short/client-batch-tests.ts +++ b/test/integration/short/client-batch-tests.ts @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const assert = require('assert'); -const util = require('util'); +import assert from "assert"; +import util from "util"; +import helper from "../../test-helper"; +import Client from "../../../lib/client"; +import types from "../../../lib/types/index"; +import utils from "../../../lib/utils"; +import errors from "../../../lib/errors"; -const helper = require('../../test-helper'); -const Client = require('../../../lib/client'); -const types = require('../../../lib/types'); -const utils = require('../../../lib/utils'); -const errors = require('../../../lib/errors'); +'use strict'; const vit = helper.vit; describe('Client @SERVER_API', function () { diff --git a/test/integration/short/client-each-row-tests.ts b/test/integration/short/client-each-row-tests.ts index 552a5dbd..552cf861 100644 --- a/test/integration/short/client-each-row-tests.ts +++ b/test/integration/short/client-each-row-tests.ts @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import util from "util"; +import sinon from "sinon"; +import helper from "../../test-helper"; +import Client from "../../../lib/client"; +import types from "../../../lib/types/index"; +import utils from "../../../lib/utils"; +import errors from "../../../lib/errors"; +import { assert } from "chai"; "use strict"; -const assert = require('chai').assert; -const util = require('util'); -const sinon = require('sinon'); - -const helper = require('../../test-helper'); -const Client = require('../../../lib/client'); -const types = require('../../../lib/types'); -const utils = require('../../../lib/utils'); -const errors = require('../../../lib/errors'); const vit = helper.vit; describe('Client', function () { diff --git a/test/integration/short/client-execute-prepared-tests.ts b/test/integration/short/client-execute-prepared-tests.ts index 864eaee2..eea63599 100644 --- a/test/integration/short/client-execute-prepared-tests.ts +++ b/test/integration/short/client-execute-prepared-tests.ts @@ -13,23 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const assert = require('assert'); -const util = require('util'); +import assert from "assert"; +import util from "util"; +import helper from "../../test-helper"; +import Client from "../../../lib/client"; +import types from "../../../lib/types/index"; +import utils from "../../../lib/utils"; +import errors from "../../../lib/errors"; +import loadBalancing from "../../../lib/policies/load-balancing"; +import numericTests from "./numeric-tests"; +import pagingTests from "./paging-tests"; -const helper = require('../../test-helper'); -const Client = require('../../../lib/client'); -const types = require('../../../lib/types'); -const utils = require('../../../lib/utils'); -const errors = require('../../../lib/errors'); -const loadBalancing = require('../../../lib/policies/load-balancing'); +'use strict'; const vit = helper.vit; const vdescribe = helper.vdescribe; const Uuid = types.Uuid; const commonKs = helper.getRandomName('ks'); -const numericTests = require('./numeric-tests'); -const pagingTests = require('./paging-tests'); - describe('Client @SERVER_API', function () { this.timeout(120000); describe('#execute(query, params, {prepare: 1}, callback)', function () { diff --git a/test/integration/short/client-execute-simulator-tests.ts b/test/integration/short/client-execute-simulator-tests.ts index b79a6c29..5264dd41 100644 --- a/test/integration/short/client-execute-simulator-tests.ts +++ b/test/integration/short/client-execute-simulator-tests.ts @@ -13,20 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +import { assert } from "chai"; +import simulacron from "../simulacron"; +import helper from "../../test-helper"; +import utils from "../../../lib/utils"; +import errors from "../../../lib/errors"; +import { responseErrorCodes } from "../../../lib/types/index"; +import Client from "../../../lib/client"; +import {AllowListPolicy, DCAwareRoundRobinPolicy} from "../../../lib/policies/load-balancing"; 'use strict'; -const { assert } = require('chai'); - -const simulacron = require('../simulacron'); -const helper = require('../../test-helper'); -const utils = require('../../../lib/utils'); -const errors = require('../../../lib/errors'); - -const { responseErrorCodes } = require('../../../lib/types'); -const Client = require('../../../lib/client'); -const { AllowListPolicy, DCAwareRoundRobinPolicy } = require('../../../lib/policies').loadBalancing; - const query = "select * from data"; const clusterSize = 3; const buffer10Kb = utils.allocBuffer(10240); diff --git a/test/integration/short/client-execute-tests.ts b/test/integration/short/client-execute-tests.ts index 9a24f241..aa2cf86e 100644 --- a/test/integration/short/client-execute-tests.ts +++ b/test/integration/short/client-execute-tests.ts @@ -13,21 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const assert = require('assert'); -const util = require('util'); +import assert from "assert"; +import util from "util"; +import helper from "../../test-helper"; +import Client from "../../../lib/client"; +import types from "../../../lib/types/index"; +import utils from "../../../lib/utils"; +import errors from "../../../lib/errors"; +import numericTests from "./numeric-tests"; +import pagingTests from "./paging-tests"; +import {ExecutionProfile} from "../../../lib/execution-profile"; -const helper = require('../../test-helper'); -const Client = require('../../../lib/client'); -const ExecutionProfile = require('../../../lib/execution-profile').ExecutionProfile; -const types = require('../../../lib/types'); -const utils = require('../../../lib/utils'); -const errors = require('../../../lib/errors'); +'use strict'; const vit = helper.vit; const vdescribe = helper.vdescribe; -const numericTests = require('./numeric-tests'); -const pagingTests = require('./paging-tests'); - describe('Client @SERVER_API', function () { this.timeout(120000); describe('#execute(query, params, {prepare: 0}, callback)', function () { diff --git a/test/integration/short/client-pool-tests.ts b/test/integration/short/client-pool-tests.ts index 6e900924..e6698575 100644 --- a/test/integration/short/client-pool-tests.ts +++ b/test/integration/short/client-pool-tests.ts @@ -14,21 +14,20 @@ * limitations under the License. */ 'use strict'; +import { RoundRobinPolicy } from '../../../lib/policies/load-balancing'; +import { Murmur3Tokenizer } from '../../../lib/tokenizer'; +import { PlainTextAuthProvider } from '../../../lib/auth/index'; +import { assert } from "chai"; +import dns from "dns"; +import util from "util"; +import helper from "../../test-helper"; +import Client from "../../../lib/client"; +import clientOptions from "../../../lib/client-options"; +import utils from "../../../lib/utils"; +import errors from "../../../lib/errors"; +import types from "../../../lib/types/index"; +import policies from "../../../lib/policies/index"; -const { assert } = require('chai'); -const dns = require('dns'); -const util = require('util'); - -const helper = require('../../test-helper'); -const Client = require('../../../lib/client'); -const clientOptions = require('../../../lib/client-options'); -const utils = require('../../../lib/utils'); -const errors = require('../../../lib/errors'); -const types = require('../../../lib/types'); -const policies = require('../../../lib/policies'); -const RoundRobinPolicy = require('../../../lib/policies/load-balancing').RoundRobinPolicy; -const Murmur3Tokenizer = require('../../../lib/tokenizer').Murmur3Tokenizer; -import { PlainTextAuthProvider } from '../../../lib/auth'; const ConstantSpeculativeExecutionPolicy = policies.speculativeExecution.ConstantSpeculativeExecutionPolicy; const OrderedLoadBalancingPolicy = helper.OrderedLoadBalancingPolicy; const vit = helper.vit; diff --git a/test/integration/short/client-stream-tests.ts b/test/integration/short/client-stream-tests.ts index d7ca1ff7..a48107a1 100644 --- a/test/integration/short/client-stream-tests.ts +++ b/test/integration/short/client-stream-tests.ts @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const assert = require('assert'); -const util = require('util'); +import assert from "assert"; +import util from "util"; +import helper from "../../test-helper"; +import Client from "../../../lib/client"; +import types from "../../../lib/types/index"; +import utils from "../../../lib/utils"; +import errors from "../../../lib/errors"; -const helper = require('../../test-helper'); +'use strict'; const vit = helper.vit; -const Client = require('../../../lib/client'); -const types = require('../../../lib/types'); -const utils = require('../../../lib/utils'); -const errors = require('../../../lib/errors'); - describe('Client', function () { this.timeout(120000); describe('#stream(query, params, {prepare: 0})', function () { diff --git a/test/integration/short/cloud/cloud-helper.ts b/test/integration/short/cloud/cloud-helper.ts index 11eaf5f7..16052d80 100644 --- a/test/integration/short/cloud/cloud-helper.ts +++ b/test/integration/short/cloud/cloud-helper.ts @@ -13,15 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; - -const format = require('util').format; -const path = require('path'); -const exec = require('child_process').exec; - -const Client = require('../../../../lib/client'); -const helper = require('../../../test-helper'); +import path from "path"; +import Client from "../../../../lib/client"; +import helper from "../../../test-helper"; +import { format } from "util"; +import { exec } from "child_process"; const ccmCmdString = 'docker exec $(docker ps -a -q --filter ancestor=single_endpoint) ccm %s'; diff --git a/test/integration/short/cloud/cloud-tests.ts b/test/integration/short/cloud/cloud-tests.ts index c0ab629c..c5b36d70 100644 --- a/test/integration/short/cloud/cloud-tests.ts +++ b/test/integration/short/cloud/cloud-tests.ts @@ -13,20 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; +import { assert } from "chai"; +import sinon from "sinon"; +import proxyquire from "proxyquire"; +import cloudHelper from "./cloud-helper"; +import helper from "../../../test-helper"; +import policies from "../../../../lib/policies/index"; +import errors from "../../../../lib/errors"; +import auth from "../../../../lib/auth/index"; +import utils from "../../../../lib/utils"; +import types from "../../../../lib/types/index"; +import promiseUtils from "../../../../lib/promise-utils"; -const { assert } = require('chai'); -const sinon = require('sinon'); -const proxyquire = require('proxyquire'); - -const cloudHelper = require('./cloud-helper'); -const helper = require('../../../test-helper'); -const policies = require('../../../../lib/policies'); -const errors = require('../../../../lib/errors'); -const auth = require('../../../../lib/auth'); -const utils = require('../../../../lib/utils'); -const types = require('../../../../lib/types'); -const promiseUtils = require('../../../../lib/promise-utils'); +'use strict'; const vdescribe = helper.vdescribe; const port = 9042; diff --git a/test/integration/short/concurrent/execute-concurrent-tests.ts b/test/integration/short/concurrent/execute-concurrent-tests.ts index 312bf06f..c9da65ec 100644 --- a/test/integration/short/concurrent/execute-concurrent-tests.ts +++ b/test/integration/short/concurrent/execute-concurrent-tests.ts @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; +import assert from "assert"; +import fs from "fs"; +import types from "../../../../lib/types/index"; +import errors from "../../../../lib/errors"; +import helper from "../../../test-helper"; +import { Transform } from "stream"; +import {executeConcurrent} from "../../../../lib/concurrent"; -const assert = require('assert'); -const fs = require('fs'); -const types = require('../../../../lib/types'); -const errors = require('../../../../lib/errors'); -const helper = require('../../../test-helper'); -const Transform = require('stream').Transform; const Uuid = types.Uuid; -const executeConcurrent = require('../../../../lib/concurrent').executeConcurrent; const insertQuery1 = 'INSERT INTO table1 (key1, key2, value) VALUES (?, ?, ?)'; const insertQuery2 = 'INSERT INTO table2 (id, value) VALUES (?, ?)'; diff --git a/test/integration/short/connection-tests.ts b/test/integration/short/connection-tests.ts index 90318c3c..771d4be9 100644 --- a/test/integration/short/connection-tests.ts +++ b/test/integration/short/connection-tests.ts @@ -13,19 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import sinon from "sinon"; +import Connection from "../../../lib/connection"; +import utils from "../../../lib/utils"; +import requests from "../../../lib/requests"; +import helper from "../../test-helper"; +import errors from "../../../lib/errors"; +import types from "../../../lib/types/index"; +import { assert } from "chai"; +import { defaultOptions } from "../../../lib/client-options"; +import { protocolVersion } from "../../../lib/types"; "use strict"; -const assert = require('chai').assert; -const sinon = require('sinon'); - -const Connection = require('../../../lib/connection'); -const defaultOptions = require('../../../lib/client-options').defaultOptions(); -const utils = require('../../../lib/utils'); -const requests = require('../../../lib/requests'); -const protocolVersion = require('../../../lib/types').protocolVersion; -const helper = require('../../test-helper'); -const errors = require('../../../lib/errors'); -const types = require('../../../lib/types'); const vit = helper.vit; describe('Connection', function () { diff --git a/test/integration/short/control-connection-simulator-tests.ts b/test/integration/short/control-connection-simulator-tests.ts index 13deac50..52468823 100644 --- a/test/integration/short/control-connection-simulator-tests.ts +++ b/test/integration/short/control-connection-simulator-tests.ts @@ -13,16 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; - -const assert = require('assert'); -const net = require('net'); -const simulacron = require('../simulacron'); -const utils = require('../../../lib/utils'); -const types = require('../../../lib/types'); - -const Client = require('../../../lib/client'); +import assert from "assert"; +import net from "net"; +import simulacron from "../simulacron"; +import utils from "../../../lib/utils"; +import types from "../../../lib/types/index"; +import Client from "../../../lib/client"; +'use strict'; describe('ControlConnection', function() { this.timeout(5000); diff --git a/test/integration/short/control-connection-tests.ts b/test/integration/short/control-connection-tests.ts index 4908638a..4adf08fd 100644 --- a/test/integration/short/control-connection-tests.ts +++ b/test/integration/short/control-connection-tests.ts @@ -14,17 +14,16 @@ * limitations under the License. */ 'use strict'; -const assert = require('assert'); -const util = require('util'); - -const helper = require('../../test-helper'); -const Client = require('../../../lib/client'); -const ControlConnection = require('../../../lib/control-connection'); -const utils = require('../../../lib/utils'); -const types = require('../../../lib/types'); -const clientOptions = require('../../../lib/client-options'); -const policies = require('../../../lib/policies'); -const ProfileManager = require('../../../lib/execution-profile').ProfileManager; +import assert from "assert"; +import util from "util"; +import helper from "../../test-helper"; +import Client from "../../../lib/client"; +import ControlConnection from "../../../lib/control-connection"; +import utils from "../../../lib/utils"; +import types from "../../../lib/types/index"; +import clientOptions from "../../../lib/client-options"; +import policies from "../../../lib/policies/index"; +import {ProfileManager} from "../../../lib/execution-profile"; describe('ControlConnection', function () { this.timeout(240000); diff --git a/test/integration/short/custom-payload-tests.ts b/test/integration/short/custom-payload-tests.ts index 1fcfff27..19636066 100644 --- a/test/integration/short/custom-payload-tests.ts +++ b/test/integration/short/custom-payload-tests.ts @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const assert = require('assert'); -const util = require('util'); +import assert from "assert"; +import util from "util"; +import helper from "../../test-helper"; +import Client from "../../../lib/client"; +import utils from "../../../lib/utils"; +import types from "../../../lib/types/index"; -const helper = require('../../test-helper'); -const Client = require('../../../lib/client'); -const utils = require('../../../lib/utils'); -const types = require('../../../lib/types'); +'use strict'; const vit = helper.vit; describe('custom payload @SERVER_API', function () { diff --git a/test/integration/short/duration-type-tests.ts b/test/integration/short/duration-type-tests.ts index 8bffa89c..3b5f5725 100644 --- a/test/integration/short/duration-type-tests.ts +++ b/test/integration/short/duration-type-tests.ts @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const assert = require('assert'); -const util = require('util'); -const helper = require('../../test-helper'); -const types = require('../../../lib/types'); -const utils = require('../../../lib/utils'); +import assert from "assert"; +import util from "util"; +import helper from "../../test-helper"; +import types from "../../../lib/types/index"; +import utils from "../../../lib/utils"; +'use strict'; const vdescribe = helper.vdescribe; const Duration = types.Duration; diff --git a/test/integration/short/error-simulator-tests.ts b/test/integration/short/error-simulator-tests.ts index 83536bb3..8472ac58 100644 --- a/test/integration/short/error-simulator-tests.ts +++ b/test/integration/short/error-simulator-tests.ts @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const assert = require('assert'); -const errors = require('../../../lib/errors'); -const types = require('../../../lib/types'); -const simulacron = require('../simulacron'); -const helper = require('../../test-helper'); -const utils = require('../../../lib/utils'); - -const Client = require('../../../lib/client'); -const { OrderedLoadBalancingPolicy } = require('../../test-helper'); +import assert from "assert"; +import errors from "../../../lib/errors"; +import types from "../../../lib/types/index"; +import simulacron from "../simulacron"; +import helper from "../../test-helper"; +import utils from "../../../lib/utils"; +import Client from "../../../lib/client"; +import { OrderedLoadBalancingPolicy } from "../../test-helper"; +'use strict'; const query = "select * from data"; describe('Client', function() { diff --git a/test/integration/short/error-tests.ts b/test/integration/short/error-tests.ts index 1e9a9242..6c758a00 100644 --- a/test/integration/short/error-tests.ts +++ b/test/integration/short/error-tests.ts @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const assert = require('assert'); -const util = require('util'); +import assert from "assert"; +import util from "util"; +import helper from "../../test-helper"; +import types from "../../../lib/types/index"; +import utils from "../../../lib/utils"; +import errors from "../../../lib/errors"; -const helper = require('../../test-helper'); -const types = require('../../../lib/types'); -const utils = require('../../../lib/utils'); -const errors = require('../../../lib/errors'); +'use strict'; const protocolVersion = types.protocolVersion; const vdescribe = helper.vdescribe; const vit = helper.vit; diff --git a/test/integration/short/execution-profile-tests.ts b/test/integration/short/execution-profile-tests.ts index 154941d8..bd518647 100644 --- a/test/integration/short/execution-profile-tests.ts +++ b/test/integration/short/execution-profile-tests.ts @@ -13,19 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import assert from "assert"; +import helper from "../../test-helper"; +import Client from "../../../lib/client"; +import types from "../../../lib/types/index"; +import utils from "../../../lib/utils"; +import simulacron from "../simulacron"; +import { AllowListPolicy, DCAwareRoundRobinPolicy } from "../../../lib/policies/load-balancing"; +import { ExecutionProfile } from "../../../lib/execution-profile"; 'use strict'; - -const assert = require('assert'); - -const helper = require('../../test-helper'); -const Client = require('../../../lib/client'); -const types = require('../../../lib/types'); -const utils = require('../../../lib/utils'); -const simulacron = require('../simulacron'); -const { AllowListPolicy, DCAwareRoundRobinPolicy } = require('../../../lib/policies/load-balancing'); -const { ExecutionProfile } = require('../../../lib/execution-profile'); - describe('ProfileManager', function() { this.timeout(40000); before(done => simulacron.start(done)); diff --git a/test/integration/short/geometry/line-string-tests.ts b/test/integration/short/geometry/line-string-tests.ts index 7effd3cc..050a99c7 100644 --- a/test/integration/short/geometry/line-string-tests.ts +++ b/test/integration/short/geometry/line-string-tests.ts @@ -13,15 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import assert from "assert"; +import util from "util"; +import helper from "../../../test-helper"; +import Client from "../../../../lib/client"; +import geometry from "../../../../lib/geometry/index"; +import types from "../../../../lib/types/index"; +import utils from "../../../../lib/utils"; + 'use strict'; -const assert = require('assert'); -const util = require('util'); -const helper = require('../../../test-helper'); -const Client = require('../../../../lib/client'); const vdescribe = helper.vdescribe; -const geometry = require('../../../../lib/geometry'); -const types = require('../../../../lib/types'); -const utils = require('../../../../lib/utils'); const Point = geometry.Point; const LineString = geometry.LineString; const Uuid = types.Uuid; diff --git a/test/integration/short/geometry/point-tests.ts b/test/integration/short/geometry/point-tests.ts index 3a95c59f..d1f00165 100644 --- a/test/integration/short/geometry/point-tests.ts +++ b/test/integration/short/geometry/point-tests.ts @@ -13,15 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import assert from "assert"; +import util from "util"; +import helper from "../../../test-helper"; +import Client from "../../../../lib/client"; +import geometry from "../../../../lib/geometry/index"; +import types from "../../../../lib/types/index"; +import utils from "../../../../lib/utils"; + 'use strict'; -const assert = require('assert'); -const util = require('util'); -const helper = require('../../../test-helper'); -const Client = require('../../../../lib/client'); const vdescribe = helper.vdescribe; -const geometry = require('../../../../lib/geometry'); -const types = require('../../../../lib/types'); -const utils = require('../../../../lib/utils'); const Point = geometry.Point; const Uuid = types.Uuid; const Tuple = types.Tuple; diff --git a/test/integration/short/geometry/polygon-tests.ts b/test/integration/short/geometry/polygon-tests.ts index 41715487..dab66ef4 100644 --- a/test/integration/short/geometry/polygon-tests.ts +++ b/test/integration/short/geometry/polygon-tests.ts @@ -13,15 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import assert from "assert"; +import util from "util"; +import helper from "../../../test-helper"; +import Client from "../../../../lib/client"; +import geometry from "../../../../lib/geometry/index"; +import types from "../../../../lib/types/index"; +import utils from "../../../../lib/utils"; + 'use strict'; -const assert = require('assert'); -const util = require('util'); -const helper = require('../../../test-helper'); -const Client = require('../../../../lib/client'); const vdescribe = helper.vdescribe; -const geometry = require('../../../../lib/geometry'); -const types = require('../../../../lib/types'); -const utils = require('../../../../lib/utils'); const Point = geometry.Point; const Polygon = geometry.Polygon; const Uuid = types.Uuid; diff --git a/test/integration/short/graph/graph-olap-tests.ts b/test/integration/short/graph/graph-olap-tests.ts index 41789bf1..9843265b 100644 --- a/test/integration/short/graph/graph-olap-tests.ts +++ b/test/integration/short/graph/graph-olap-tests.ts @@ -13,22 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; +import { assert } from "chai"; +import util from "util"; +import Client from "../../../../lib/client"; +import promiseUtils from "../../../../lib/promise-utils"; +import helper from "../../../test-helper"; +import loadBalancing from "../../../../lib/policies/load-balancing"; +import utils from "../../../../lib/utils"; +import graphModule from "../../../../lib/datastax/graph/index"; +import graphTestHelper from "./graph-test-helper"; +import { ExecutionProfile } from "../../../../lib/execution-profile"; -const { assert } = require('chai'); -const util = require('util'); -const Client = require('../../../../lib/client'); -const promiseUtils = require('../../../../lib/promise-utils'); -const helper = require('../../../test-helper'); const vdescribe = helper.vdescribe; -const loadBalancing = require('../../../../lib/policies/load-balancing'); const DefaultLoadBalancingPolicy = loadBalancing.DefaultLoadBalancingPolicy; -const ExecutionProfile = require('../../../../lib/execution-profile').ExecutionProfile; -const utils = require('../../../../lib/utils'); -const graphModule = require('../../../../lib/datastax/graph'); -const graphTestHelper = require('./graph-test-helper'); - vdescribe('dse-5.0', 'Client with spark workload', function () { this.timeout(360000); diff --git a/test/integration/short/graph/graph-test-helper.ts b/test/integration/short/graph/graph-test-helper.ts index 3e2264e5..bc1ad647 100644 --- a/test/integration/short/graph/graph-test-helper.ts +++ b/test/integration/short/graph/graph-test-helper.ts @@ -13,43 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import utils from "../../../../lib/utils"; 'use strict'; - -const utils = require('../../../../lib/utils'); - -module.exports = { - - /** - * Creates the modern schema and graph - * @param {Client} client - * @param {Function} callback - */ - createModernGraph: function (client, callback) { - utils.series([ - next => client.executeGraph(modernSchema, null, {graphName: "name1"}, next), - next => client.executeGraph(modernGraph, null, {graphName: "name1"}, next) - ], callback); - }, - - /** - * Sets the schema mode to "production". - * @param {Client} client - */ - makeStrict: function (client) { - return client.executeGraph(makeStrictQuery, null, { graphName: 'name1'}); - }, - - /** - * Sets the allow_scan flag. - * @param {Client} client - */ - allowScans: function (client) { - return client.executeGraph(allowScansQuery, null, { graphName: 'name1'}); - } -}; - - const makeStrictQuery = 'schema.config().option("graph.schema_mode").set("production")'; const allowScansQuery = 'schema.config().option("graph.allow_scan").set("true")'; @@ -78,4 +44,39 @@ const modernGraph = 'marko.addEdge("created", lop, "weight", 0.4f);\n' + 'josh.addEdge("created", ripple, "weight", 1.0f);\n' + 'josh.addEdge("created", lop, "weight", 0.4f);\n' + - 'peter.addEdge("created", lop, "weight", 0.2f);'; \ No newline at end of file + 'peter.addEdge("created", lop, "weight", 0.2f);'; + + +/** + * Creates the modern schema and graph + * @param {Client} client + * @param {Function} callback + */ +const createModernGraph = function (client, callback) { + utils.series([ + next => client.executeGraph(modernSchema, null, { graphName: "name1" }, next), + next => client.executeGraph(modernGraph, null, { graphName: "name1" }, next) + ], callback); +}; + +/** + * Sets the schema mode to "production". + * @param {Client} client + */ +const makeStrict = function (client) { + return client.executeGraph(makeStrictQuery, null, { graphName: 'name1' }); +}; + +/** + * Sets the allow_scan flag. + * @param {Client} client + */ +const allowScans = function (client) { + return client.executeGraph(allowScansQuery, null, { graphName: 'name1' }); +}; + +export default { + createModernGraph, + makeStrict, + allowScans +} \ No newline at end of file diff --git a/test/integration/short/graph/graph-tests.ts b/test/integration/short/graph/graph-tests.ts index 81e641e7..62e0d917 100644 --- a/test/integration/short/graph/graph-tests.ts +++ b/test/integration/short/graph/graph-tests.ts @@ -14,24 +14,22 @@ * limitations under the License. */ 'use strict'; -const sinon = require('sinon'); -const { assert } = require('chai'); - -const util = require('util'); -const Client = require('../../../../lib/client'); -const helper = require('../../../test-helper'); +import sinon from "sinon"; +import { assert } from "chai"; +import util from "util"; +import Client from "../../../../lib/client"; +import helper from "../../../test-helper"; +import { Point, LineString, Polygon } from "../../../../lib/geometry/index"; +import types from "../../../../lib/types/index"; +import utils from "../../../../lib/utils"; +import graphModule from "../../../../lib/datastax/graph/index"; +import { graphProtocol } from "../../../../lib/datastax/graph/options"; +import graphTestHelper from "./graph-test-helper"; +import { ExecutionProfile } from "../../../../lib/execution-profile"; const vdescribe = helper.vdescribe; const vit = helper.vit; -const { Point, LineString, Polygon } = require('../../../../lib/geometry'); -const types = require('../../../../lib/types'); const { InetAddress, Uuid, Tuple } = types; -const ExecutionProfile = require('../../../../lib/execution-profile').ExecutionProfile; -const utils = require('../../../../lib/utils'); -const graphModule = require('../../../../lib/datastax/graph'); const { asInt, asFloat, asUdt, t, Edge, direction } = graphModule; -const { graphProtocol } = require('../../../../lib/datastax/graph/options'); -const graphTestHelper = require('./graph-test-helper'); - const graphLanguageBytecode = 'bytecode-json'; let schemaCounter = 1000; diff --git a/test/integration/short/graph/graph-timeout-tests.ts b/test/integration/short/graph/graph-timeout-tests.ts index 09b5c863..29af4f05 100644 --- a/test/integration/short/graph/graph-timeout-tests.ts +++ b/test/integration/short/graph/graph-timeout-tests.ts @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; +import assert from "assert"; +import errors from "../../../../lib/errors"; +import helper from "../../../test-helper"; +import utils from "../../../../lib/utils"; +import Client from "../../../../lib/client"; +import {ExecutionProfile} from "../../../../lib/execution-profile"; +import {DefaultRetryPolicy} from "../../../../lib/policies/retry"; + -const assert = require('assert'); -const errors = require('../../../../lib/errors'); -const helper = require('../../../test-helper'); const vdescribe = helper.vdescribe; -const utils = require('../../../../lib/utils'); -const Client = require('../../../../lib/client'); -const ExecutionProfile = require('../../../../lib/execution-profile').ExecutionProfile; -const DefaultRetryPolicy = require('../../../../lib/policies/retry').RetryPolicy; vdescribe('dse-5.0', 'graph query client timeouts', function () { this.timeout(120000); diff --git a/test/integration/short/graph/graph-with-down-node-tests.ts b/test/integration/short/graph/graph-with-down-node-tests.ts index 7b130853..29da2873 100644 --- a/test/integration/short/graph/graph-with-down-node-tests.ts +++ b/test/integration/short/graph/graph-with-down-node-tests.ts @@ -13,19 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; +import assert from "assert"; +import Client from "../../../../lib/client"; +import helper from "../../../test-helper"; +import types from "../../../../lib/types/index"; +import utils from "../../../../lib/utils"; +import graphTestHelper from "./graph-test-helper"; +import {ExecutionProfile} from "../../../../lib/execution-profile"; -const assert = require('assert'); -const Client = require('../../../../lib/client'); -const helper = require('../../../test-helper'); const vdescribe = helper.vdescribe; -const types = require('../../../../lib/types'); const cl = types.consistencies; -const ExecutionProfile = require('../../../../lib/execution-profile').ExecutionProfile; -const utils = require('../../../../lib/utils'); -const graphTestHelper = require('./graph-test-helper'); - // DSP-15333 prevents this suite to be tested against DSE 5.0 vdescribe('dse-5.1', 'Client with down node', function () { this.timeout(270000); diff --git a/test/integration/short/insights-simulator-tests.ts b/test/integration/short/insights-simulator-tests.ts index e2f364d8..059d8b67 100644 --- a/test/integration/short/insights-simulator-tests.ts +++ b/test/integration/short/insights-simulator-tests.ts @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import assert from "assert"; +import simulacron from "../simulacron"; +import helper from "../../test-helper"; +import Client from "../../../lib/client"; +import utils from "../../../lib/utils"; +import InsightsClient from "../../../lib/insights-client"; 'use strict'; - -const assert = require('assert'); -const simulacron = require('../simulacron'); -const helper = require('../../test-helper'); -const Client = require('../../../lib/client'); -const utils = require('../../../lib/utils'); const vdescribe = helper.vdescribe; -const InsightsClient = require('../../../lib/insights-client'); - const insightsRpcQuery = 'CALL InsightsRpc.reportInsight(?)'; vdescribe('dse-6.7', 'InsightsClient', function () { diff --git a/test/integration/short/load-balancing-simulator-tests.ts b/test/integration/short/load-balancing-simulator-tests.ts index cbcfe7d2..af08d5dc 100644 --- a/test/integration/short/load-balancing-simulator-tests.ts +++ b/test/integration/short/load-balancing-simulator-tests.ts @@ -13,18 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; +import assert from "assert"; +import util from "util"; +import simulacron from "../simulacron"; +import utils from "../../../lib/utils"; +import helper from "../../test-helper"; +import policies from "../../../lib/policies/index"; +import errors from "../../../lib/errors"; +import promiseUtils from "../../../lib/promise-utils"; +import { ExecutionProfile } from "../../../lib/execution-profile"; +import Client from "../../../lib/client"; -const assert = require('assert'); -const util = require('util'); -const simulacron = require('../simulacron'); -const utils = require('../../../lib/utils'); -const helper = require('../../test-helper'); -const policies = require('../../../lib/policies'); -const errors = require('../../../lib/errors'); -const promiseUtils = require('../../../lib/promise-utils'); -const { ExecutionProfile } = require('../../../lib/execution-profile'); -const Client = require('../../../lib/client'); +'use strict'; const { loadBalancing } = policies; const queryOptions = { prepare: true, routingKey: utils.allocBuffer(16), keyspace: 16 }; diff --git a/test/integration/short/load-balancing-tests.ts b/test/integration/short/load-balancing-tests.ts index d1d11193..78bf4087 100644 --- a/test/integration/short/load-balancing-tests.ts +++ b/test/integration/short/load-balancing-tests.ts @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const assert = require('assert'); -const util = require('util'); +import assert from "assert"; +import util from "util"; +import helper from "../../test-helper"; +import Client from "../../../lib/client"; +import utils from "../../../lib/utils"; +import types from "../../../lib/types/index"; +import { RoundRobinPolicy, AllowListPolicy, TokenAwarePolicy} from "../../../lib/policies/load-balancing"; -const helper = require('../../test-helper'); -const Client = require('../../../lib/client'); -const utils = require('../../../lib/utils'); -const types = require('../../../lib/types'); -const { RoundRobinPolicy, AllowListPolicy, TokenAwarePolicy} = require('../../../lib/policies/load-balancing'); +'use strict'; const vdescribe = helper.vdescribe; const maxInFlightRequests = 16; diff --git a/test/integration/short/mapping/custom-queries-tests.ts b/test/integration/short/mapping/custom-queries-tests.ts index 4847f9d0..11c913bb 100644 --- a/test/integration/short/mapping/custom-queries-tests.ts +++ b/test/integration/short/mapping/custom-queries-tests.ts @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import assert from "assert"; +import types from "../../../../lib/types/index"; +import Result from "../../../../lib/mapping/result"; +import mapperTestHelper from "./mapper-test-helper"; +import helper from "../../../test-helper"; 'use strict'; - -const assert = require('assert'); -const types = require('../../../../lib/types'); -const Result = require('../../../../lib/mapping/result'); const Uuid = types.Uuid; -const mapperTestHelper = require('./mapper-test-helper'); const assertRowMatchesDoc = mapperTestHelper.assertRowMatchesDoc; -const helper = require('../../../test-helper'); - describe('ModelMapper', function () { mapperTestHelper.setupOnce(this); diff --git a/test/integration/short/mapping/from-and-to-model-function-tests.ts b/test/integration/short/mapping/from-and-to-model-function-tests.ts index 35457581..2230a754 100644 --- a/test/integration/short/mapping/from-and-to-model-function-tests.ts +++ b/test/integration/short/mapping/from-and-to-model-function-tests.ts @@ -13,16 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { assert } from "chai"; +import { Uuid } from "../../../../lib/types/index"; +import mapperTestHelper from "./mapper-test-helper"; +import helper from "../../../test-helper"; +import { UnderscoreCqlToCamelCaseMappings } from "../../../../lib/mapping/table-mappings"; 'use strict'; - -const { assert } = require('chai'); - -const { Uuid } = require('../../../../lib/types'); -const mapperTestHelper = require('./mapper-test-helper'); -const helper = require('../../../test-helper'); -const { UnderscoreCqlToCamelCaseMappings } = require('../../../../lib/mapping/table-mappings'); - describe('Mapper', function () { mapperTestHelper.setupOnce(this); diff --git a/test/integration/short/mapping/mapper-test-helper.ts b/test/integration/short/mapping/mapper-test-helper.ts index cccf0b9d..8f98aa02 100644 --- a/test/integration/short/mapping/mapper-test-helper.ts +++ b/test/integration/short/mapping/mapper-test-helper.ts @@ -13,25 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import assert from "assert"; +import types from "../../../../lib/types/index"; +import helper from "../../../test-helper"; +import tableMappingsModule from "../../../../lib/mapping/table-mappings"; +import Mapper from "../../../../lib/mapping/mapper"; +import Client from "../../../../lib/client"; +import utils from "../../../../lib/utils"; 'use strict'; - -const assert = require('assert'); -const types = require('../../../../lib/types'); const Uuid = types.Uuid; -const helper = require('../../../test-helper'); -const tableMappingsModule = require('../../../../lib/mapping/table-mappings'); const UnderscoreCqlToCamelCaseMappings = tableMappingsModule.UnderscoreCqlToCamelCaseMappings; -const Mapper = require('../../../../lib/mapping/mapper'); -const Client = require('../../../../lib/client'); -const utils = require('../../../../lib/utils'); - const videoColumnsToProperties = new Map([ ['videoid', 'id'], ['userid', 'userId'], ['added_date', 'addedDate'], ['location_type', 'locationType'], ['preview_image_location', 'preview'], ['preview_thumbnails', 'thumbnails']]); let hasBeenSetup = false; -const mapperHelper = module.exports = { +const mapperHelper = { setupOnce: function (testInstance) { testInstance.timeout(60000); @@ -191,3 +189,6 @@ const mapperHelper = module.exports = { }); } }; + + +export default mapperHelper; \ No newline at end of file diff --git a/test/integration/short/mapping/mapper-tests.ts b/test/integration/short/mapping/mapper-tests.ts index dda7d8e5..8f75c26e 100644 --- a/test/integration/short/mapping/mapper-tests.ts +++ b/test/integration/short/mapping/mapper-tests.ts @@ -13,20 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; +import assert from "assert"; +import types from "../../../../lib/types/index"; +import utils from "../../../../lib/utils"; +import Mapper from "../../../../lib/mapping/mapper"; +import Client from "../../../../lib/client"; +import mapperTestHelper from "./mapper-test-helper"; +import helper from "../../../test-helper"; +import Result from "../../../../lib/mapping/result"; +import { q } from "../../../../lib/mapping/q"; -const assert = require('assert'); -const types = require('../../../../lib/types'); -const utils = require('../../../../lib/utils'); -const Mapper = require('../../../../lib/mapping/mapper'); -const Client = require('../../../../lib/client'); const Uuid = types.Uuid; -const mapperTestHelper = require('./mapper-test-helper'); const assertRowMatchesDoc = mapperTestHelper.assertRowMatchesDoc; -const helper = require('../../../test-helper'); -const Result = require('../../../../lib/mapping/result'); -const q = require('../../../../lib/mapping/q').q; describe('Mapper', function () { diff --git a/test/integration/short/mapping/model-mapper-tests.ts b/test/integration/short/mapping/model-mapper-tests.ts index 7892ad47..035c9423 100644 --- a/test/integration/short/mapping/model-mapper-tests.ts +++ b/test/integration/short/mapping/model-mapper-tests.ts @@ -13,20 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; +import assert from "assert"; +import util from "util"; +import helper from "../../../test-helper"; +import mapperTestHelper from "./mapper-test-helper"; +import types from "../../../../lib/types/index"; +import utils from "../../../../lib/utils"; +import Mapper from "../../../../lib/mapping/mapper"; +import Result from "../../../../lib/mapping/result"; +import {q} from "../../../../lib/mapping/q"; -const assert = require('assert'); -const util = require('util'); -const helper = require('../../../test-helper'); -const mapperTestHelper = require('./mapper-test-helper'); -const types = require('../../../../lib/types'); -const utils = require('../../../../lib/utils'); const Uuid = types.Uuid; -const q = require('../../../../lib/mapping/q').q; -const Mapper = require('../../../../lib/mapping/mapper'); const assertRowMatchesDoc = mapperTestHelper.assertRowMatchesDoc; -const Result = require('../../../../lib/mapping/result'); const vit = helper.vit; describe('ModelMapper', function () { diff --git a/test/integration/short/metadata-simulator-tests.ts b/test/integration/short/metadata-simulator-tests.ts index acce5077..356f8391 100644 --- a/test/integration/short/metadata-simulator-tests.ts +++ b/test/integration/short/metadata-simulator-tests.ts @@ -14,11 +14,11 @@ * limitations under the License. */ 'use strict'; -const assert = require('chai').assert; -const utils = require('../../../lib/utils'); -const types = require('../../../lib/types/index'); -const simulacron = require('../simulacron'); -const util = require('util'); +import utils from "../../../lib/utils"; +import types from "../../../lib/types/index"; +import simulacron from "../simulacron"; +import util from "util"; +import {assert} from "chai"; describe('Metadata', function () { this.timeout(20000); diff --git a/test/integration/short/metadata-tests.ts b/test/integration/short/metadata-tests.ts index 9941e1a3..dd3bd3c8 100644 --- a/test/integration/short/metadata-tests.ts +++ b/test/integration/short/metadata-tests.ts @@ -13,15 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - "use strict"; -const assert = require('chai').assert; +import helper from "../../test-helper"; +import Client from "../../../lib/client"; +import utils from "../../../lib/utils"; +import types from "../../../lib/types/index"; +import packageInfo from "../../../package.json"; +import { assert } from "chai"; -const helper = require('../../test-helper'); -const Client = require('../../../lib/client'); -const utils = require('../../../lib/utils'); -const types = require('../../../lib/types'); -const packageInfo = require('../../../package.json'); const vit = helper.vit; const vdescribe = helper.vdescribe; diff --git a/test/integration/short/numeric-tests.ts b/test/integration/short/numeric-tests.ts index 0b5c6a32..5237ff8f 100644 --- a/test/integration/short/numeric-tests.ts +++ b/test/integration/short/numeric-tests.ts @@ -13,13 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; +import Client from "../../../lib/client"; +import types from "../../../lib/types/index"; +import helper from "../../test-helper"; +import { expect } from 'chai'; -const expect = require('chai').expect; -const Client = require('../../../lib/client'); -const types = require('../../../lib/types'); -const helper = require('../../test-helper'); const Uuid = types.Uuid; const createTableNumericValuesCql = @@ -44,7 +43,10 @@ const createTableNumericCollectionsCql = set_int set)`; // Exported to be called on other fixtures to take advantage from existing setups -module.exports = function (keyspace, prepare) { + + +// Exported to be called on other fixtures to take advantage from existing setups +export default function (keyspace, prepare) { context('with numeric values', () => { diff --git a/test/integration/short/paging-tests.ts b/test/integration/short/paging-tests.ts index 3d4fd8b9..1a77feaa 100644 --- a/test/integration/short/paging-tests.ts +++ b/test/integration/short/paging-tests.ts @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { assert } from "chai"; +import Client from "../../../lib/client"; +import types from "../../../lib/types/index"; +import helper from "../../test-helper"; +import promiseUtils from "../../../lib/promise-utils"; 'use strict'; - -const { assert } = require('chai'); -const Client = require('../../../lib/client'); -const types = require('../../../lib/types'); -const helper = require('../../test-helper'); -const promiseUtils = require('../../../lib/promise-utils'); +// Exported to be called on other fixtures to take advantage from existing setups // Exported to be called on other fixtures to take advantage from existing setups -module.exports = function (keyspace, prepare) { +export default function (keyspace, prepare) { context('with paging', function () { const client = new Client({ diff --git a/test/integration/short/pool-simulator-tests.ts b/test/integration/short/pool-simulator-tests.ts index 0b7aa872..d4d50d3f 100644 --- a/test/integration/short/pool-simulator-tests.ts +++ b/test/integration/short/pool-simulator-tests.ts @@ -13,22 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { assert } from "chai"; +import simulacron from "../simulacron"; +import helper from "../../test-helper"; +import errors from "../../../lib/errors"; +import utils from "../../../lib/utils"; +import types from "../../../lib/types/index"; +import policies from "../../../lib/policies/index"; +import promiseUtils from "../../../lib/promise-utils"; +import { version } from "../../../index"; +import Client from "../../../lib/client"; 'use strict'; - -const { assert } = require('chai'); -const simulacron = require('../simulacron'); -const helper = require('../../test-helper'); -const errors = require('../../../lib/errors'); -const utils = require('../../../lib/utils'); -const types = require('../../../lib/types'); -const policies = require('../../../lib/policies'); -const promiseUtils = require('../../../lib/promise-utils'); -const { version } = require('../../../index'); const { distance } = types; - -const Client = require('../../../lib/client'); - const healthResponseCountInterval = 200; describe('pool', function () { diff --git a/test/integration/short/prepare-simulator-tests.ts b/test/integration/short/prepare-simulator-tests.ts index d697df7f..7d8b3890 100644 --- a/test/integration/short/prepare-simulator-tests.ts +++ b/test/integration/short/prepare-simulator-tests.ts @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; - -const { assert } = require('chai'); - -const Client = require('../../../lib/client'); -const types = require('../../../lib/types/index'); -const utils = require('../../../lib/utils'); -const helper = require('../../test-helper'); -const reconnection = require('../../../lib/policies/reconnection'); -const simulacron = require('../simulacron'); +import { assert } from "chai"; +import Client from "../../../lib/client"; +import types from "../../../lib/types/index"; +import utils from "../../../lib/utils"; +import helper from "../../test-helper"; +import reconnection from "../../../lib/policies/reconnection"; +import simulacron from "../simulacron"; +'use strict'; describe('Client', function () { this.timeout(20000); diff --git a/test/integration/short/retry-simulator-tests.ts b/test/integration/short/retry-simulator-tests.ts index 6aca93f4..ebb63a45 100644 --- a/test/integration/short/retry-simulator-tests.ts +++ b/test/integration/short/retry-simulator-tests.ts @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import assert from "assert"; +import Client from "../../../lib/client"; +import metrics from "../../../lib/metrics/index"; +import errors from "../../../lib/errors"; +import simulacron from "../simulacron"; +import helper from "../../test-helper"; +import policies from "../../../lib/policies/index"; 'use strict'; - -const assert = require('assert'); -const Client = require('../../../lib/client'); -const metrics = require('../../../lib/metrics'); -const errors = require('../../../lib/errors'); -const simulacron = require('../simulacron'); -const helper = require('../../test-helper'); -const policies = require('../../../lib/policies'); const RetryPolicy = policies.retry.RetryPolicy; const queries = { diff --git a/test/integration/short/search/date-range-tests.ts b/test/integration/short/search/date-range-tests.ts index 5326a393..be587b45 100644 --- a/test/integration/short/search/date-range-tests.ts +++ b/test/integration/short/search/date-range-tests.ts @@ -13,15 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import assert from "assert"; +import util from "util"; +import helper from "../../../test-helper"; +import utils from "../../../../lib/utils"; +import types from "../../../../lib/types/index"; +import * as dateRangeModule from "../../../../lib/datastax/search/date-range"; +import Client from "../../../../lib/client"; + 'use strict'; -const assert = require('assert'); -const util = require('util'); -const helper = require('../../../test-helper'); const vdescribe = helper.vdescribe; -const utils = require('../../../../lib/utils'); -const types = require('../../../../lib/types'); -const dateRangeModule = require('../../../../lib/datastax/search/date-range'); -const Client = require('../../../../lib/client'); const DateRange = dateRangeModule.DateRange; vdescribe('dse-5.1', 'DateRange', function () { diff --git a/test/integration/short/speculative-execution-simulator-tests.ts b/test/integration/short/speculative-execution-simulator-tests.ts index d19e8e95..7737fa4a 100644 --- a/test/integration/short/speculative-execution-simulator-tests.ts +++ b/test/integration/short/speculative-execution-simulator-tests.ts @@ -14,16 +14,14 @@ * limitations under the License. */ 'use strict'; -const assert = require('assert'); -const responseErrorCodes = require('../../../lib/types').responseErrorCodes; -const simulacron = require('../simulacron'); -const helper = require('../../test-helper'); -const utils = require('../../../lib/utils'); - -const Client = require('../../../lib/client'); -const ConstantSpeculativeExecutionPolicy = require('../../../lib/policies/speculative-execution').ConstantSpeculativeExecutionPolicy; -const NoSpeculativeExecutionPolicy = require('../../../lib/policies/speculative-execution').NoSpeculativeExecutionPolicy; -const OrderedLoadBalancingPolicy = require('../../test-helper').OrderedLoadBalancingPolicy; +import assert from "assert"; +import simulacron from "../simulacron"; +import helper from "../../test-helper"; +import utils from "../../../lib/utils"; +import Client from "../../../lib/client"; +import { responseErrorCodes } from "../../../lib/types"; +import { ConstantSpeculativeExecutionPolicy, NoSpeculativeExecutionPolicy } from "../../../lib/policies/speculative-execution"; +import { OrderedLoadBalancingPolicy } from "../../test-helper"; const query = "select * from data"; const delay = 100; diff --git a/test/integration/short/ssl-tests.ts b/test/integration/short/ssl-tests.ts index acdd2159..bdf55076 100644 --- a/test/integration/short/ssl-tests.ts +++ b/test/integration/short/ssl-tests.ts @@ -13,16 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const assert = require('assert'); -const util = require('util'); - -const helper = require('../../test-helper'); -const Client = require('../../../lib/client'); -const errors = require('../../../lib/errors'); -const utils = require('../../../lib/utils'); -const types = require('../../../lib/types'); +import assert from "assert"; +import util from "util"; +import helper from "../../test-helper"; +import Client from "../../../lib/client"; +import errors from "../../../lib/errors"; +import utils from "../../../lib/utils"; +import types from "../../../lib/types/index"; +'use strict'; describe('Client @SERVER_API', function () { this.timeout(60000); context('with ssl enabled', function () { diff --git a/test/integration/short/timeout-simulator-tests.ts b/test/integration/short/timeout-simulator-tests.ts index b7cb4bb2..68436500 100644 --- a/test/integration/short/timeout-simulator-tests.ts +++ b/test/integration/short/timeout-simulator-tests.ts @@ -13,15 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { assert } from "chai"; +import Client from "../../../lib/client"; +import errors from "../../../lib/errors"; +import promiseUtils from "../../../lib/promise-utils"; +import helper from "../../test-helper"; +import simulacron from "../simulacron"; 'use strict'; - -const { assert } = require('chai'); -const Client = require('../../../lib/client'); -const errors = require('../../../lib/errors'); -const promiseUtils = require('../../../lib/promise-utils'); -const helper = require('../../test-helper'); -const simulacron = require('../simulacron'); const { OrderedLoadBalancingPolicy } = helper; const queryDelayedOnNode0 = 'INSERT INTO paused_on_first_node'; diff --git a/test/integration/short/tracker-simulator-tests.ts b/test/integration/short/tracker-simulator-tests.ts index 89ddd4d3..485d9de5 100644 --- a/test/integration/short/tracker-simulator-tests.ts +++ b/test/integration/short/tracker-simulator-tests.ts @@ -13,19 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; - -const { assert } = require('chai'); -const sinon = require('sinon'); - -const tracker = require('../../../lib/tracker'); -const errors = require('../../../lib/errors'); -const utils = require('../../../lib/utils'); -const types = require('../../../lib/types'); -const Client = require('../../../lib/client'); -const Host = require('../../../lib/host').Host; -const simulacron = require('../simulacron'); +import { assert } from "chai"; +import sinon from "sinon"; +import tracker from "../../../lib/tracker/index"; +import errors from "../../../lib/errors"; +import utils from "../../../lib/utils"; +import types from "../../../lib/types/index"; +import Client from "../../../lib/client"; +import simulacron from "../simulacron"; +import { Host } from "../../../lib/host"; const queryDelayed = 'INSERT INTO delayed (id) VALUES (?)'; diff --git a/test/integration/short/udf-tests.ts b/test/integration/short/udf-tests.ts index 1da74fd1..8dc6867c 100644 --- a/test/integration/short/udf-tests.ts +++ b/test/integration/short/udf-tests.ts @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const assert = require('assert'); +import assert from "assert"; +import helper from "../../test-helper"; +import Client from "../../../lib/client"; +import utils from "../../../lib/utils"; +import types from "../../../lib/types/index"; -const helper = require('../../test-helper'); +'use strict'; const vit = helper.vit; -const Client = require('../../../lib/client'); -const utils = require('../../../lib/utils'); -const types = require('../../../lib/types'); const vdescribe = helper.vdescribe; vdescribe('2.2', 'Metadata @SERVER_API', function () { diff --git a/test/integration/short/vector-tests.ts b/test/integration/short/vector-tests.ts index 4d05fa34..4428f7f3 100644 --- a/test/integration/short/vector-tests.ts +++ b/test/integration/short/vector-tests.ts @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const assert = require('assert'); -const helper = require('../../test-helper'); +import assert from "assert"; +import helper from "../../test-helper"; +import { types } from "../../../index"; +import Vector from "../../../lib/types/vector"; +import util from "node:util"; -const { types } = require('../../../index'); -const Vector = require('../../../lib/types/vector'); -const util = require('node:util'); +'use strict'; const vdescribe = helper.vdescribe; vdescribe('5.0.0', 'Vector tests', function () { this.timeout(120000); diff --git a/test/integration/simulacron.ts b/test/integration/simulacron.ts index 88d4481e..bdc94695 100644 --- a/test/integration/simulacron.ts +++ b/test/integration/simulacron.ts @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import helper from "../test-helper"; +import http from "http"; +import util from "util"; +import fs from "fs"; +import utils from "../../lib/utils"; +import Client from "../../lib/client"; +import { spawn } from "child_process"; 'use strict'; -const helper = require('../test-helper'); -const http = require('http'); -const spawn = require('child_process').spawn; -const util = require('util'); -const fs = require('fs'); -const utils = require('../../lib/utils'); -const Client = require('../../lib/client'); const simulacronHelper = { _execute: function(processName, params, cb) { @@ -573,4 +573,4 @@ SimulacronNode.prototype._filterLogs = function(data) { return data.data_centers[0].nodes[0].queries; }; -module.exports = simulacronHelper; +export default simulacronHelper; diff --git a/test/other/memory/basic-profile.ts b/test/other/memory/basic-profile.ts index 50b75c40..8d7b9e78 100644 --- a/test/other/memory/basic-profile.ts +++ b/test/other/memory/basic-profile.ts @@ -14,8 +14,12 @@ * limitations under the License. */ 'use strict'; -const assert = require('assert'); -const util = require('util'); +import assert from "assert"; +import util from "util"; +import helper from "../../test-helper"; +import cassandra from "../../../index"; +import utils from "../../../lib/utils"; + let heapdump; const heapdumpPath = '/var/log/nodejs-driver'; try { @@ -26,13 +30,8 @@ try { catch (e) { console.error('There was an error while trying to import heapdump', e); } - -const helper = require('../../test-helper'); -const cassandra = require('../../../index'); const Client = cassandra.Client; const types = cassandra.types; -const utils = require('../../../lib/utils'); - let client = new Client(utils.extend({ encoding: { copyBuffer: true}}, helper.baseOptions)); const keyspace = helper.getRandomName('ks'); const table = keyspace + '.' + helper.getRandomName('tbl'); diff --git a/test/other/memory/profile-keeping-ref.ts b/test/other/memory/profile-keeping-ref.ts index 1decb83f..055def79 100644 --- a/test/other/memory/profile-keeping-ref.ts +++ b/test/other/memory/profile-keeping-ref.ts @@ -13,10 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import assert from "assert"; +import util from "util"; +import helper from "../../test-helper"; +import cassandra from "../../../index"; +import utils from "../../../lib/utils"; + 'use strict'; /* eslint-disable no-console, no-undef */ -const assert = require('assert'); -const util = require('util'); let heapdump; const heapdumpPath = '/var/log/nodejs-driver'; try { @@ -26,13 +30,8 @@ try { catch (e) { console.log(e); } - -const helper = require('../../test-helper'); -const cassandra = require('../../../index'); const Client = cassandra.Client; const types = cassandra.types; -const utils = require('../../../lib/utils'); - let client = new Client(utils.extend({ encoding: { copyBuffer: true}}, helper.baseOptions)); const keyspace = helper.getRandomName('ks'); const table = keyspace + '.' + helper.getRandomName('tbl'); diff --git a/test/test-helper.ts b/test/test-helper.ts index 2a01576b..9d21a96c 100644 --- a/test/test-helper.ts +++ b/test/test-helper.ts @@ -13,28 +13,28 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { assert } from "chai"; +import sinon from "sinon"; +import util from "util"; +import path from "path"; +import policies from "../lib/policies/index"; +import types from "../lib/types/index"; +import utils from "../lib/utils"; +import http from "http"; +import Client from "../lib/client"; +import { Host, HostMap } from "../lib/host"; +import OperationState from "../lib/operation-state"; +import promiseUtils from "../lib/promise-utils"; +import { spawn, exec } from "child_process"; +import { defaultOptions } from "../lib/client-options"; +import Temp from "temp"; 'use strict'; -const { assert } = require('chai'); -const sinon = require('sinon'); -const util = require('util'); -const path = require('path'); -const policies = require('../lib/policies'); -const types = require('../lib/types'); -// const { types } = require('../lib/types'); -const utils = require('../lib/utils'); -const spawn = require('child_process').spawn; -const childProcessExec = require('child_process').exec; -const http = require('http'); -const temp = require('temp').track(true); -const Client = require('../lib/client'); -const defaultOptions = require('../lib/client-options').defaultOptions; -const { Host, HostMap } = require('../lib/host'); -const OperationState = require('../lib/operation-state'); -const promiseUtils = require('../lib/promise-utils'); +const temp = Temp.track(true); const Vector = types.Vector; + util.inherits(RetryMultipleTimes, policies.retry.RetryPolicy); const cassandraVersionByDse = { @@ -2040,8 +2040,7 @@ class OrderedLoadBalancingPolicy extends policies.loadBalancing.RoundRobinPolicy } } +export default helper; - -module.exports = helper; -module.exports.RetryMultipleTimes = RetryMultipleTimes; -module.exports.OrderedLoadBalancingPolicy = OrderedLoadBalancingPolicy; +export { RetryMultipleTimes }; +export { OrderedLoadBalancingPolicy }; diff --git a/test/unit/address-resolution-tests.ts b/test/unit/address-resolution-tests.ts index b6297bd2..f403dba8 100644 --- a/test/unit/address-resolution-tests.ts +++ b/test/unit/address-resolution-tests.ts @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const assert = require('assert'); -const dns = require('dns'); +import assert from "assert"; +import dns from "dns"; +import * as addressResolution from "../../lib/policies/address-resolution"; -const addressResolution = require('../../lib/policies/address-resolution'); +'use strict'; const EC2MultiRegionTranslator = addressResolution.EC2MultiRegionTranslator; describe('EC2MultiRegionTranslator', function () { diff --git a/test/unit/api-tests.ts b/test/unit/api-tests.ts index b62f6763..95fb30ae 100644 --- a/test/unit/api-tests.ts +++ b/test/unit/api-tests.ts @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const { assert } = require('chai'); -const api = require('../../index'); -const auth = require('../../lib/auth'); -const helper = require('../test-helper'); +import { assert } from "chai"; +import api from "../../index"; +import auth from "../../lib/auth/index"; +import helper from "../test-helper"; +'use strict'; describe('API', function () { it('should expose auth module', function () { assert.ok(api.auth); diff --git a/test/unit/basic-tests.ts b/test/unit/basic-tests.ts index 067448c2..3168bf3e 100644 --- a/test/unit/basic-tests.ts +++ b/test/unit/basic-tests.ts @@ -15,26 +15,25 @@ */ "use strict"; -const { assert } = require('chai'); -const sinon = require('sinon'); -const util = require('util'); -const events = require('events'); - -const Client = require('../../lib/client'); -const clientOptions = require('../../lib/client-options'); -import * as auth from '../../lib/auth'; -const types = require('../../lib/types'); -const { dataTypes } = types; -const loadBalancing = require('../../lib/policies/load-balancing'); -const retry = require('../../lib/policies/retry'); -const speculativeExecution = require('../../lib/policies/speculative-execution'); -const timestampGeneration = require('../../lib/policies/timestamp-generation'); -const Encoder = require('../../lib/encoder'); -const utils = require('../../lib/utils'); -const writers = require('../../lib/writers'); -const OperationState = require('../../lib/operation-state'); -const helper = require('../test-helper'); +import * as auth from '../../lib/auth/index'; +import { assert } from "chai"; +import sinon from "sinon"; +import util from "util"; +import events from "events"; +import Client from "../../lib/client"; +import clientOptions from "../../lib/client-options"; +import types from "../../lib/types/index"; +import loadBalancing from "../../lib/policies/load-balancing"; +import retry from "../../lib/policies/retry"; +import speculativeExecution from "../../lib/policies/speculative-execution"; +import timestampGeneration from "../../lib/policies/timestamp-generation"; +import Encoder from "../../lib/encoder"; +import utils from "../../lib/utils"; +import * as writers from "../../lib/writers"; +import OperationState from "../../lib/operation-state"; +import helper from "../test-helper"; +const { dataTypes } = types; const contactPoints = ['a']; describe('types', function () { diff --git a/test/unit/big-decimal-tests.ts b/test/unit/big-decimal-tests.ts index beace400..8335ff76 100644 --- a/test/unit/big-decimal-tests.ts +++ b/test/unit/big-decimal-tests.ts @@ -13,12 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; - -const assert = require('assert'); -const types = require('../../lib/types'); -const utils = require('../../lib/utils'); +import assert from "assert"; +import types from "../../lib/types/index"; +import utils from "../../lib/utils"; +'use strict'; describe('BigDecimal', function () { const BigDecimal = types.BigDecimal; const Integer = types.Integer; diff --git a/test/unit/client-tests.ts b/test/unit/client-tests.ts index a117d798..d7c60c55 100644 --- a/test/unit/client-tests.ts +++ b/test/unit/client-tests.ts @@ -13,27 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { assert } from "chai"; +import util from "util"; +import proxyquire from "proxyquire"; +import sinon from "sinon"; +import Client from "../../lib/client"; +import policies from "../../lib/policies/index"; +import helper from "../test-helper"; +import errors from "../../lib/errors"; +import utils from "../../lib/utils"; +import types from "../../lib/types/index"; +import Metadata from "../../lib/metadata/index"; +import Encoder from "../../lib/encoder"; +import clientOptions from "../../lib/client-options"; +import PrepareHandler from "../../lib/prepare-handler"; +import {Host, HostMap} from "../../lib/host"; +import { ProfileManager, ExecutionProfile } from "../../lib/execution-profile"; 'use strict'; -const { assert } = require('chai'); -const util = require('util'); -const proxyquire = require('proxyquire'); -const sinon = require('sinon'); - -const Client = require('../../lib/client'); -const policies = require('../../lib/policies'); -const helper = require('../test-helper'); -const errors = require('../../lib/errors'); -const utils = require('../../lib/utils'); -const types = require('../../lib/types'); -const HostMap = require('../../lib/host').HostMap; -const Host = require('../../lib/host').Host; -const Metadata = require('../../lib/metadata'); -const Encoder = require('../../lib/encoder'); -const ProfileManager = require('../../lib/execution-profile').ProfileManager; -const ExecutionProfile = require('../../lib/execution-profile').ExecutionProfile; -const clientOptions = require('../../lib/client-options'); -const PrepareHandler = require('../../lib/prepare-handler'); - describe('Client', function () { describe('constructor', function () { it('should throw an exception when contactPoints are not provided', function () { diff --git a/test/unit/cloud/certificate-validation-tests.ts b/test/unit/cloud/certificate-validation-tests.ts index 46c94bf7..088df4cf 100644 --- a/test/unit/cloud/certificate-validation-tests.ts +++ b/test/unit/cloud/certificate-validation-tests.ts @@ -13,12 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { assert } from "chai"; +import { checkServerIdentity } from "../../../lib/datastax/cloud/index"; 'use strict'; - -const { assert } = require('chai'); -const { checkServerIdentity } = require('../../../lib/datastax/cloud'); - describe('checkServerIdentity()', () => { const port = 32598; const sampleHostName = 'host1.datastax.com'; diff --git a/test/unit/concurrent/execute-concurrent-tests.ts b/test/unit/concurrent/execute-concurrent-tests.ts index add4cb17..17c01bae 100644 --- a/test/unit/concurrent/execute-concurrent-tests.ts +++ b/test/unit/concurrent/execute-concurrent-tests.ts @@ -13,15 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; - -const assert = require('assert'); -const Readable = require('stream').Readable; -const types = require('../../../lib/types'); -const utils = require('../../../lib/utils'); -const helper = require('../../test-helper'); -const executeConcurrent = require('../../../lib/concurrent').executeConcurrent; +import assert from "assert"; +import types from "../../../lib/types/index"; +import utils from "../../../lib/utils"; +import helper from "../../test-helper"; +import { Readable } from "stream"; +import { executeConcurrent } from "../../../lib/concurrent"; describe('executeConcurrent(client, query, parameters)', function () { this.timeout(10000); diff --git a/test/unit/connection-tests.ts b/test/unit/connection-tests.ts index d3100ad3..9d729ccb 100644 --- a/test/unit/connection-tests.ts +++ b/test/unit/connection-tests.ts @@ -14,19 +14,19 @@ * limitations under the License. */ 'use strict'; -const assert = require('assert'); -const EventEmitter = require('events'); -const proxyquire = require('proxyquire'); -const sinon = require('sinon'); - -const Connection = require('../../lib/connection'); -const requests = require('../../lib/requests'); -const defaultOptions = require('../../lib/client-options').defaultOptions(); -const utils = require('../../lib/utils'); -const errors = require('../../lib/errors'); -const ExecutionOptions = require('../../lib/execution-options').ExecutionOptions; -const helper = require('../test-helper'); +import assert from "assert"; +import EventEmitter from "events"; +import proxyquire from "proxyquire"; +import sinon from "sinon"; +import Connection from "../../lib/connection"; +import requests from "../../lib/requests"; +import utils from "../../lib/utils"; +import errors from "../../lib/errors"; +import helper from "../test-helper"; +import ClientOptions from "../../lib/client-options"; +import { ExecutionOptions } from "../../lib/execution-options"; +const defaultOptions = ClientOptions.defaultOptions(); describe('Connection', function () { describe('constructor', function () { it('should parse host endpoint into address and port', function () { diff --git a/test/unit/control-connection-tests.ts b/test/unit/control-connection-tests.ts index 8b6529fe..23fd9b58 100644 --- a/test/unit/control-connection-tests.ts +++ b/test/unit/control-connection-tests.ts @@ -14,21 +14,20 @@ * limitations under the License. */ 'use strict'; -const { assert } = require('chai'); -const events = require('events'); -const proxyquire = require('proxyquire'); -const util = require('util'); - -const helper = require('../test-helper'); -const ControlConnection = require('../../lib/control-connection'); -const Host = require('../../lib/host').Host; -const utils = require('../../lib/utils'); -const Metadata = require('../../lib/metadata'); -const types = require('../../lib/types'); -const errors = require('../../lib/errors'); -const policies = require('../../lib/policies'); -const clientOptions = require('../../lib/client-options'); -const ProfileManager = require('../../lib/execution-profile').ProfileManager; +import { assert } from "chai"; +import events from "events"; +import proxyquire from "proxyquire"; +import util from "util"; +import helper from "../test-helper"; +import ControlConnection from "../../lib/control-connection"; +import utils from "../../lib/utils"; +import Metadata from "../../lib/metadata/index"; +import types from "../../lib/types/index"; +import errors from "../../lib/errors"; +import policies from "../../lib/policies/index"; +import clientOptions from "../../lib/client-options"; +import { Host } from "../../lib/host"; +import { ProfileManager } from "../../lib/execution-profile"; describe('ControlConnection', function () { describe('constructor', function () { diff --git a/test/unit/default-load-balancing-policy-tests.ts b/test/unit/default-load-balancing-policy-tests.ts index 315bc7d7..2733adfd 100644 --- a/test/unit/default-load-balancing-policy-tests.ts +++ b/test/unit/default-load-balancing-policy-tests.ts @@ -13,20 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; - -const { assert } = require('chai'); -const util = require('util'); -const helper = require('../test-helper'); -const policies = require('../../lib/policies'); -const clientOptions = require('../../lib/client-options'); -const { Host, HostMap } = require('../../lib/host'); -const types = require('../../lib/types'); -const utils = require('../../lib/utils'); -const { ExecutionOptions } = require('../../lib/execution-options'); -const errors = require('../../lib/errors'); -const Client = require('../../lib/client'); +import { assert } from "chai"; +import util from "util"; +import helper from "../test-helper"; +import policies from "../../lib/policies/index"; +import clientOptions from "../../lib/client-options"; +import { Host, HostMap } from "../../lib/host"; +import types from "../../lib/types/index"; +import utils from "../../lib/utils"; +import { ExecutionOptions } from "../../lib/execution-options"; +import errors from "../../lib/errors"; +import Client from "../../lib/client"; +'use strict'; const { loadBalancing } = policies; const { DefaultLoadBalancingPolicy } = loadBalancing; const { lastOctetOf } = helper; diff --git a/test/unit/dse-gssapi-auth-provider-tests.ts b/test/unit/dse-gssapi-auth-provider-tests.ts index 05ec1eee..761d9700 100644 --- a/test/unit/dse-gssapi-auth-provider-tests.ts +++ b/test/unit/dse-gssapi-auth-provider-tests.ts @@ -14,10 +14,10 @@ * limitations under the License. */ 'use strict'; -const assert = require('assert'); import DseGssapiAuthProvider from '../../lib/auth/dse-gssapi-auth-provider'; -const helper = require('../test-helper'); -const utils = require('../../lib/utils'); +import assert from "assert"; +import helper from "../test-helper"; +import utils from "../../lib/utils"; const cDescribe = helper.conditionalDescribe(helper.requireOptional('kerberos'), 'kerberos required to run'); const dseAuthenticatorName = 'com.datastax.bdp.cassandra.auth.DseAuthenticator'; diff --git a/test/unit/dse-plain-text-auth-provider-tests.ts b/test/unit/dse-plain-text-auth-provider-tests.ts index 22adc98a..8c1bab1f 100644 --- a/test/unit/dse-plain-text-auth-provider-tests.ts +++ b/test/unit/dse-plain-text-auth-provider-tests.ts @@ -14,9 +14,9 @@ * limitations under the License. */ 'use strict'; -const assert = require('assert'); import { Authenticator } from '../../lib/auth/provider'; import DsePlainTextAuthProvider from '../../lib/auth/dse-plain-text-auth-provider'; +import assert from "assert"; describe('DsePlainTextAuthProvider', function () { describe('#newAuthenticator()', function () { diff --git a/test/unit/duration-type-tests.ts b/test/unit/duration-type-tests.ts index 151977a7..45a3e7b4 100644 --- a/test/unit/duration-type-tests.ts +++ b/test/unit/duration-type-tests.ts @@ -13,11 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import assert from "assert"; +import util from "util"; +import types from "../../lib/types/index"; +import utils from "../../lib/utils"; + 'use strict'; -const assert = require('assert'); -const util = require('util'); -const types = require('../../lib/types'); -const utils = require('../../lib/utils'); const Duration = types.Duration; const Long = types.Long; diff --git a/test/unit/encoder-tests.ts b/test/unit/encoder-tests.ts index ad5c5bd2..12c36dd6 100644 --- a/test/unit/encoder-tests.ts +++ b/test/unit/encoder-tests.ts @@ -14,19 +14,19 @@ * limitations under the License. */ 'use strict'; -const { assert } = require('chai'); -const sinon = require('sinon'); -const util = require('util'); -const utils = require('../../lib/utils'); -const tokenizer = require('../../lib/tokenizer'); -const token = require('../../lib/token'); -const Vector = require('../../lib/types/vector'); -const Encoder = require('../../lib/encoder'); -const { types } = require('../../index'); -const ExecutionOptions = require('../../lib/execution-options').ExecutionOptions; -const dataTypes = types.dataTypes; -const helper = require('../test-helper'); +import { assert } from "chai"; +import sinon from "sinon"; +import util from "util"; +import utils from "../../lib/utils"; +import tokenizer from "../../lib/tokenizer"; +import token from "../../lib/token"; +import Vector from "../../lib/types/vector"; +import Encoder from "../../lib/encoder"; +import { types } from "../../index"; +import helper from "../test-helper"; +import { ExecutionOptions } from "../../lib/execution-options"; +const dataTypes = types.dataTypes; const zeroLengthTypesSupported = new Set([ dataTypes.text, dataTypes.ascii, diff --git a/test/unit/encoder-vector-tests.ts b/test/unit/encoder-vector-tests.ts index 4b3cc356..3d681558 100644 --- a/test/unit/encoder-vector-tests.ts +++ b/test/unit/encoder-vector-tests.ts @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const { assert, util } = require('chai'); -const Encoder = require('../../lib/encoder'); -const { types } = require('../../index'); -const Vector = require('../../lib/types/vector'); -const helper = require('../test-helper'); +import { assert, util } from "chai"; +import Encoder from "../../lib/encoder"; +import { types } from "../../index"; +import Vector from "../../lib/types/vector"; +import helper from "../test-helper"; +'use strict'; describe('Vector tests', function () { const encoder = new Encoder(4, {}); diff --git a/test/unit/error-tests.ts b/test/unit/error-tests.ts index de49d96d..2e430ac0 100644 --- a/test/unit/error-tests.ts +++ b/test/unit/error-tests.ts @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; +import assert from "assert"; +import path from "path"; +import errors from "../../lib/errors"; +import helper from "../test-helper"; -const assert = require('assert'); -const path = require('path'); -const errors = require('../../lib/errors'); -const helper = require('../test-helper'); +'use strict'; const fileName = path.basename(__filename); describe('DriverError', function () { diff --git a/test/unit/event-debouncer-tests.ts b/test/unit/event-debouncer-tests.ts index d2363e1a..5d4c9226 100644 --- a/test/unit/event-debouncer-tests.ts +++ b/test/unit/event-debouncer-tests.ts @@ -13,14 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; - -const { assert } = require('chai'); -const sinon = require('sinon'); - -const helper = require('../test-helper'); -const EventDebouncer = require('../../lib/metadata/event-debouncer'); +import { assert } from "chai"; +import sinon from "sinon"; +import helper from "../test-helper"; +import EventDebouncer from "../../lib/metadata/event-debouncer"; +'use strict'; describe('EventDebouncer', function () { describe('timeoutElapsed()', function () { it('should set the queue to null', function (done) { diff --git a/test/unit/execution-options-tests.ts b/test/unit/execution-options-tests.ts index 16dbdc03..347eabd8 100644 --- a/test/unit/execution-options-tests.ts +++ b/test/unit/execution-options-tests.ts @@ -13,16 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; - -const assert = require('assert'); -const utils = require('../../lib/utils'); -const types = require('../../lib/types'); -const helper = require('../test-helper'); -const DefaultExecutionOptions = require('../../lib/execution-options').DefaultExecutionOptions; -const ExecutionProfile = require('../../lib/execution-profile').ExecutionProfile; -const defaultOptions = require('../../lib/client-options').defaultOptions; +import assert from "assert"; +import utils from "../../lib/utils"; +import types from "../../lib/types/index"; +import helper from "../test-helper"; +import { DefaultExecutionOptions } from "../../lib/execution-options"; +import { ExecutionProfile } from "../../lib/execution-profile"; +import { defaultOptions } from "../../lib/client-options"; describe('DefaultExecutionOptions', () => { describe('create()', () => { diff --git a/test/unit/execution-profile-tests.ts b/test/unit/execution-profile-tests.ts index 7b393829..4026d4da 100644 --- a/test/unit/execution-profile-tests.ts +++ b/test/unit/execution-profile-tests.ts @@ -14,13 +14,11 @@ * limitations under the License. */ 'use strict'; - -const assert = require('assert'); - -const clientOptions = require('../../lib/client-options'); -const ExecutionProfile = require('../../lib/execution-profile').ExecutionProfile; -const ProfileManager = require('../../lib/execution-profile').ProfileManager; -const types = require('../../lib/types'); +import assert from "assert"; +import clientOptions from "../../lib/client-options"; +import types from "../../lib/types/index"; +import {ExecutionProfile} from "../../lib/execution-profile"; +import {ProfileManager} from "../../lib/execution-profile"; describe('ProfileManager', function () { describe('constructor', function () { diff --git a/test/unit/geometry/line-string-tests.ts b/test/unit/geometry/line-string-tests.ts index 6dfaaa18..fc1e2234 100644 --- a/test/unit/geometry/line-string-tests.ts +++ b/test/unit/geometry/line-string-tests.ts @@ -13,13 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import assert from "assert"; +import helper from "../../test-helper"; +import utils from "../../../lib/utils"; +import Point from "../../../lib/geometry/point"; +import { LineString } from "../../../lib/geometry"; 'use strict'; -const assert = require('assert'); -const helper = require('../../test-helper'); -const utils = require('../../../lib/utils'); -const Point = require('../../../lib/geometry/point'); -const moduleName = '../../../lib/geometry/line-string'; -const LineString = require(moduleName); describe('LineString', function () { describe('constructor', function () { diff --git a/test/unit/geometry/point-tests.ts b/test/unit/geometry/point-tests.ts index 2c509462..30d8b72d 100644 --- a/test/unit/geometry/point-tests.ts +++ b/test/unit/geometry/point-tests.ts @@ -14,11 +14,10 @@ * limitations under the License. */ 'use strict'; -const assert = require('assert'); -const helper = require('../../test-helper'); -const utils = require('../../../lib/utils'); -const moduleName = '../../../lib/geometry/point'; -const Point = require(moduleName); +import assert from "assert"; +import helper from "../../test-helper"; +import utils from "../../../lib/utils"; +import Point from "../../../lib/geometry/point"; describe('Point', function () { describe('constructor', function () { diff --git a/test/unit/geometry/polygon-tests.ts b/test/unit/geometry/polygon-tests.ts index 7e62956d..9de7c240 100644 --- a/test/unit/geometry/polygon-tests.ts +++ b/test/unit/geometry/polygon-tests.ts @@ -14,12 +14,11 @@ * limitations under the License. */ 'use strict'; -const assert = require('assert'); -const helper = require('../../test-helper'); -const utils = require('../../../lib/utils'); -const Point = require('../../../lib/geometry/point'); -const moduleName = '../../../lib/geometry/polygon'; -const Polygon = require(moduleName); +import assert from "assert"; +import helper from "../../test-helper"; +import utils from "../../../lib/utils"; +import Point from "../../../lib/geometry/point"; +import { Polygon } from "../../../lib/geometry"; describe('Polygon', function () { describe('constructor', function () { diff --git a/test/unit/graph/executor-tests.ts b/test/unit/graph/executor-tests.ts index 439c1344..ab9d4a3b 100644 --- a/test/unit/graph/executor-tests.ts +++ b/test/unit/graph/executor-tests.ts @@ -13,18 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; - -const assert = require('assert'); -const Client = require('../../../lib/client'); -const types = require('../../../lib/types'); -const utils = require('../../../lib/utils'); -const policies = require('../../../lib/policies'); -const ExecutionProfile = require('../../../lib/execution-profile').ExecutionProfile; -const GraphExecutor = require('../../../lib/datastax/graph/graph-executor'); -const { GraphExecutionOptions, graphProtocol } = require('../../../lib/datastax/graph/options'); -const helper = require('../../test-helper'); +import assert from "assert"; +import Client from "../../../lib/client"; +import types from "../../../lib/types/index"; +import utils from "../../../lib/utils"; +import policies from "../../../lib/policies/index"; +import GraphExecutor from "../../../lib/datastax/graph/graph-executor"; +import { GraphExecutionOptions, graphProtocol } from "../../../lib/datastax/graph/options"; +import helper from "../../test-helper"; +import { ExecutionProfile } from "../../../lib/execution-profile"; const proxyExecuteKey = 'ProxyExecute'; diff --git a/test/unit/graph/graph-result-tests.ts b/test/unit/graph/graph-result-tests.ts index 0ae6f53c..8316abbf 100644 --- a/test/unit/graph/graph-result-tests.ts +++ b/test/unit/graph/graph-result-tests.ts @@ -13,13 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; - -const assert = require('assert'); -const utils = require('../../../lib/utils'); -const ResultSet = require('../../../lib/types/result-set'); -const GraphResultSet = require('../../../lib/datastax/graph/result-set'); +import assert from "assert"; +import utils from "../../../lib/utils"; +import ResultSet from "../../../lib/types/result-set"; +import GraphResultSet from "../../../lib/datastax/graph/result-set"; +'use strict'; const resultVertex = getResultSet([ { "gremlin": JSON.stringify({ "result": { diff --git a/test/unit/graph/graphson-tests.ts b/test/unit/graph/graphson-tests.ts index a7485db8..de44de6f 100644 --- a/test/unit/graph/graphson-tests.ts +++ b/test/unit/graph/graphson-tests.ts @@ -13,16 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; +import { assert } from "chai"; +import helper from "../../test-helper"; +import { GraphSON2Reader, GraphSON3Reader, GraphSON3Writer } from "../../../lib/datastax/graph/graph-serializer"; +import getCustomTypeSerializers from "../../../lib/datastax/graph/custom-type-serializers"; +import graphModule from "../../../lib/datastax/graph/index"; +import types from "../../../lib/types/index"; +import utils from "../../../lib/utils"; +import geometry from "../../../lib/geometry/index"; -const { assert } = require('chai'); -const helper = require('../../test-helper'); -const { GraphSON2Reader, GraphSON3Reader, GraphSON3Writer } = require('../../../lib/datastax/graph/graph-serializer'); -const getCustomTypeSerializers = require('../../../lib/datastax/graph/custom-type-serializers'); -const graphModule = require('../../../lib/datastax/graph'); -const types = require('../../../lib/types'); -const utils = require('../../../lib/utils'); -const geometry = require('../../../lib/geometry'); +'use strict'; const { Tuple } = types; const { asInt, asDouble, asTimestamp } = graphModule; diff --git a/test/unit/host-tests.ts b/test/unit/host-tests.ts index 6a87ce05..1da9430d 100644 --- a/test/unit/host-tests.ts +++ b/test/unit/host-tests.ts @@ -13,25 +13,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; - -const { assert } = require('chai'); -const sinon = require('sinon'); -const util = require('util'); -const events = require('events'); +import { assert } from "chai"; +import sinon from "sinon"; +import util from "util"; +import events from "events"; +import hostModule from "../../lib/host"; +import HostConnectionPool from "../../lib/host-connection-pool"; +import Metadata from "../../lib/metadata/index"; +import types from "../../lib/types/index"; +import clientOptions from "../../lib/client-options"; +import utils from "../../lib/utils"; +import policies from "../../lib/policies/index"; +import helper from "../test-helper"; -const hostModule = require('../../lib/host'); +'use strict'; const Host = hostModule.Host; -const HostConnectionPool = require('../../lib/host-connection-pool'); -const Metadata = require('../../lib/metadata'); const HostMap = hostModule.HostMap; -const types = require('../../lib/types'); -const clientOptions = require('../../lib/client-options'); const defaultOptions = clientOptions.defaultOptions(); defaultOptions.pooling.coreConnectionsPerHost = clientOptions.coreConnectionsPerHostV3; -const utils = require('../../lib/utils'); -const policies = require('../../lib/policies'); -const helper = require('../test-helper'); const reconnection = policies.reconnection; describe('HostConnectionPool', function () { diff --git a/test/unit/inet-address-tests.ts b/test/unit/inet-address-tests.ts index 509f9923..27b13576 100644 --- a/test/unit/inet-address-tests.ts +++ b/test/unit/inet-address-tests.ts @@ -14,10 +14,10 @@ * limitations under the License. */ 'use strict'; -const assert = require('assert'); -const helper = require('../test-helper'); -const utils = require('../../lib/utils'); -const InetAddress = require('../../lib/types').InetAddress; +import assert from "assert"; +import helper from "../test-helper"; +import utils from "../../lib/utils"; +import { InetAddress } from "../../lib/types"; describe('InetAddress', function () { describe('constructor', function () { diff --git a/test/unit/insights-client-tests.ts b/test/unit/insights-client-tests.ts index 6ea176af..1e1d8be1 100644 --- a/test/unit/insights-client-tests.ts +++ b/test/unit/insights-client-tests.ts @@ -13,21 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; - -const assert = require('assert'); -const os = require('os'); -const Client = require('../../lib/client'); -const ClientState = require('../../lib/metadata/client-state'); -const InsightsClient = require('../../lib/insights-client'); -const ExecutionProfile = require('../../lib/execution-profile').ExecutionProfile; -const utils = require('../../lib/utils'); -const types = require('../../lib/types'); -const policies = require('../../lib/policies'); -const coreConnectionsPerHostV3 = require('../../lib/client-options').coreConnectionsPerHostV3; -const packageInfo = require('../../package.json'); -const helper = require('../test-helper'); +import assert from "assert"; +import os from "os"; +import Client from "../../lib/client"; +import ClientState from "../../lib/metadata/client-state"; +import InsightsClient from "../../lib/insights-client"; +import utils from "../../lib/utils"; +import types from "../../lib/types/index"; +import policies from "../../lib/policies/index"; +import packageInfo from "../../package.json"; +import helper from "../test-helper"; +import { ExecutionProfile } from "../../lib/execution-profile"; +import { coreConnectionsPerHostV3 } from "../../lib/client-options"; const kerberosModule = helper.requireOptional('kerberos'); const kerberosDescribe = kerberosModule ? describe : xdescribe; diff --git a/test/unit/license-tests.ts b/test/unit/license-tests.ts index 0a6c794b..fea052b6 100644 --- a/test/unit/license-tests.ts +++ b/test/unit/license-tests.ts @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const assert = require("assert"); -const path = require("path"); -const fs = require("fs"); +import assert from "assert"; +import path from "path"; +import fs from "fs"; +'use strict'; const licenseHeaderRegex = new RegExp( `/\\* \\* Copyright DataStax, Inc\\. diff --git a/test/unit/load-balancing-tests.ts b/test/unit/load-balancing-tests.ts index a91fb5c7..6f6c8c94 100644 --- a/test/unit/load-balancing-tests.ts +++ b/test/unit/load-balancing-tests.ts @@ -13,20 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const assert = require('assert'); - -const helper = require('../test-helper'); -const errors = require('../../lib/errors'); -const Client = require('../../lib/client'); -const clientOptions = require('../../lib/client-options'); -const { Host, HostMap } = require('../../lib/host'); -const types = require('../../lib/types'); -const utils = require('../../lib/utils'); -const { ExecutionOptions } = require('../../lib/execution-options'); -const { AllowListPolicy, LoadBalancingPolicy, TokenAwarePolicy, RoundRobinPolicy, DCAwareRoundRobinPolicy } = - require('../../lib/policies/load-balancing'); +import assert from "assert"; +import helper from "../test-helper"; +import errors from "../../lib/errors"; +import Client from "../../lib/client"; +import clientOptions from "../../lib/client-options"; +import { Host, HostMap } from "../../lib/host"; +import types from "../../lib/types/index"; +import utils from "../../lib/utils"; +import { ExecutionOptions } from "../../lib/execution-options"; +import { AllowListPolicy, LoadBalancingPolicy, TokenAwarePolicy, RoundRobinPolicy, DCAwareRoundRobinPolicy } from "../../lib/policies/load-balancing"; +'use strict'; describe('RoundRobinPolicy', function () { it('should yield an error when the hosts are not set', function(done) { const policy = new RoundRobinPolicy(); diff --git a/test/unit/mapping/cache-tests.ts b/test/unit/mapping/cache-tests.ts index 2d62b065..9e76cc6f 100644 --- a/test/unit/mapping/cache-tests.ts +++ b/test/unit/mapping/cache-tests.ts @@ -13,12 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; - -const assert = require('assert'); -const Cache = require('../../../lib/mapping/cache'); -const q = require('../../../lib/mapping/q').q; +import assert from "assert"; +import Cache from "../../../lib/mapping/cache"; +import {q} from "../../../lib/mapping/q"; describe('Cache', function() { this.timeout(5000); diff --git a/test/unit/mapping/mapper-tests.ts b/test/unit/mapping/mapper-tests.ts index 9bbf5035..d6f984cf 100644 --- a/test/unit/mapping/mapper-tests.ts +++ b/test/unit/mapping/mapper-tests.ts @@ -13,16 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { assert } from "chai"; +import sinon from "sinon"; +import Mapper from "../../../lib/mapping/mapper"; +import ModelMapper from "../../../lib/mapping/model-mapper"; +import helper from "../../test-helper"; +import mapperTestHelper from "./mapper-unit-test-helper"; 'use strict'; - -const { assert } = require('chai'); -const sinon = require('sinon'); -const Mapper = require('../../../lib/mapping/mapper'); -const ModelMapper = require('../../../lib/mapping/model-mapper'); -const helper = require('../../test-helper'); -const mapperTestHelper = require('./mapper-unit-test-helper'); - describe('Mapper', () => { describe('constructor', () => { it('should validate that client is provided', () => { diff --git a/test/unit/mapping/mapper-unit-test-helper.ts b/test/unit/mapping/mapper-unit-test-helper.ts index 9167d20e..398ef890 100644 --- a/test/unit/mapping/mapper-unit-test-helper.ts +++ b/test/unit/mapping/mapper-unit-test-helper.ts @@ -13,17 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; +import assert from "assert"; +import types from "../../../lib/types/index"; +import ModelMapper from "../../../lib/mapping/model-mapper"; +import Mapper from "../../../lib/mapping/mapper"; -const assert = require('assert'); -const types = require('../../../lib/types'); -const ModelMapper = require('../../../lib/mapping/model-mapper'); const ResultSet = types.ResultSet; const dataTypes = types.dataTypes; -const Mapper = require('../../../lib/mapping/mapper'); - -const mapperHelper = module.exports = { +const mapperHelper = { /** * Gets a fake client instance that returns metadata for a single table * @param {Array|Function} columns @@ -172,3 +170,4 @@ const mapperHelper = module.exports = { } }; +export default mapperHelper; \ No newline at end of file diff --git a/test/unit/mapping/mapping-handler-tests.ts b/test/unit/mapping/mapping-handler-tests.ts index 64b39850..89bcd4b1 100644 --- a/test/unit/mapping/mapping-handler-tests.ts +++ b/test/unit/mapping/mapping-handler-tests.ts @@ -13,15 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; - -const assert = require('assert'); -const mapperTestHelper = require('./mapper-unit-test-helper'); -const MappingHandler = require('../../../lib/mapping/mapping-handler'); -const ModelMappingInfo = require('../../../lib/mapping/model-mapping-info'); -const DefaultTableMappings = require('../../../lib/mapping/table-mappings').DefaultTableMappings; -const q = require('../../../lib/mapping/q').q; +import assert from "assert"; +import mapperTestHelper from "./mapper-unit-test-helper"; +import MappingHandler from "../../../lib/mapping/mapping-handler"; +import ModelMappingInfo from "../../../lib/mapping/model-mapping-info"; +import { DefaultTableMappings } from "../../../lib/mapping/table-mappings"; +import { q } from "../../../lib/mapping/q"; describe('MappingHandler', () => { describe('#getSelectExecutor()', () => { diff --git a/test/unit/mapping/model-mapper-mutation-tests.ts b/test/unit/mapping/model-mapper-mutation-tests.ts index d28846c5..850fba00 100644 --- a/test/unit/mapping/model-mapper-mutation-tests.ts +++ b/test/unit/mapping/model-mapper-mutation-tests.ts @@ -13,14 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; +import assert from "assert"; +import types from "../../../lib/types/index"; +import helper from "../../test-helper"; +import mapperTestHelper from "./mapper-unit-test-helper"; +import { q } from "../../../lib/mapping/q"; -const assert = require('assert'); -const q = require('../../../lib/mapping/q').q; -const types = require('../../../lib/types'); -const helper = require('../../test-helper'); -const mapperTestHelper = require('./mapper-unit-test-helper'); const dataTypes = types.dataTypes; describe('ModelMapper', () => { diff --git a/test/unit/mapping/model-mapper-select-tests.ts b/test/unit/mapping/model-mapper-select-tests.ts index a40f23e8..c4985f4d 100644 --- a/test/unit/mapping/model-mapper-select-tests.ts +++ b/test/unit/mapping/model-mapper-select-tests.ts @@ -13,14 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; - -const assert = require('assert'); -const q = require('../../../lib/mapping/q').q; -const dataTypes = require('../../../lib/types').dataTypes; -const helper = require('../../test-helper'); -const mapperTestHelper = require('./mapper-unit-test-helper'); +import assert from "assert"; +import helper from "../../test-helper"; +import mapperTestHelper from "./mapper-unit-test-helper"; +import { q } from "../../../lib/mapping/q"; +import { dataTypes } from "../../../lib/types"; const emptyResponse = { meta: { columns: [] }, rows: [] }; diff --git a/test/unit/mapping/model-mapping-info-tests.ts b/test/unit/mapping/model-mapping-info-tests.ts index bffbc9a8..819c2d1d 100644 --- a/test/unit/mapping/model-mapping-info-tests.ts +++ b/test/unit/mapping/model-mapping-info-tests.ts @@ -13,13 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { assert } from "chai"; +import ModelMappingInfo from "../../../lib/mapping/model-mapping-info"; 'use strict'; - -const { assert } = require('chai'); - -const ModelMappingInfo = require('../../../lib/mapping/model-mapping-info'); - describe('ModelMappingInfo', function () { describe('parse()', function () { it('should throw when the model keyspace is not set', () => { diff --git a/test/unit/mapping/result-mapper-tests.ts b/test/unit/mapping/result-mapper-tests.ts index b0675860..2f826899 100644 --- a/test/unit/mapping/result-mapper-tests.ts +++ b/test/unit/mapping/result-mapper-tests.ts @@ -13,14 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { assert } from "chai"; +import sinon from "sinon"; +import ResultMapper from "../../../lib/mapping/result-mapper"; 'use strict'; - -const { assert } = require('chai'); -const sinon = require('sinon'); - -const ResultMapper = require('../../../lib/mapping/result-mapper'); - describe('ResultMapper', function () { describe('getSelectAdapter()', function () { it('should return a function that maps row values into object values', () => { diff --git a/test/unit/mapping/result-tests.ts b/test/unit/mapping/result-tests.ts index 70d47906..01d13c2c 100644 --- a/test/unit/mapping/result-tests.ts +++ b/test/unit/mapping/result-tests.ts @@ -13,13 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import assert from "assert"; +import Result from "../../../lib/mapping/result"; +import util from "util"; 'use strict'; - -const assert = require('assert'); -const Result = require('../../../lib/mapping/result'); -const util = require('util'); - const expected = [ { id: 1, name: 'name1', adapted: true }, { id: 2, name: 'name2', adapted: true }]; describe('Result', () => { diff --git a/test/unit/mapping/table-mappings-tests.ts b/test/unit/mapping/table-mappings-tests.ts index 36937400..2f8f54d2 100644 --- a/test/unit/mapping/table-mappings-tests.ts +++ b/test/unit/mapping/table-mappings-tests.ts @@ -13,11 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import assert from "assert"; +import tableMappingsModule from "../../../lib/mapping/table-mappings"; 'use strict'; - -const assert = require('assert'); -const tableMappingsModule = require('../../../lib/mapping/table-mappings'); const UnderscoreCqlToCamelCaseMappings = tableMappingsModule.UnderscoreCqlToCamelCaseMappings; describe('UnderscoreCqlToCamelCaseMappings', () => { diff --git a/test/unit/mapping/tree-tests.ts b/test/unit/mapping/tree-tests.ts index 2eb1282c..19af59ce 100644 --- a/test/unit/mapping/tree-tests.ts +++ b/test/unit/mapping/tree-tests.ts @@ -13,12 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import assert from "assert"; +import Tree from "../../../lib/mapping/tree"; 'use strict'; - -const assert = require('assert'); -const Tree = require('../../../lib/mapping/tree'); - describe('Tree', function () { this.timeout(20000); diff --git a/test/unit/metadata-tests.ts b/test/unit/metadata-tests.ts index 3c62f7c7..84768679 100644 --- a/test/unit/metadata-tests.ts +++ b/test/unit/metadata-tests.ts @@ -13,29 +13,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { assert } from "chai"; +import sinon from "sinon"; +import events from "events"; +import helper from "../test-helper"; +import clientOptions from "../../lib/client-options"; +import Metadata from "../../lib/metadata/index"; +import TableMetadata from "../../lib/metadata/table-metadata"; +import tokenizer from "../../lib/tokenizer"; +import types from "../../lib/types/index"; +import MutableLong from "../../lib/types/mutable-long"; +import utils from "../../lib/utils"; +import errors from "../../lib/errors"; +import Encoder from "../../lib/encoder"; 'use strict'; - -const { assert } = require('chai'); -const sinon = require('sinon'); -const events = require('events'); - -const helper = require('../test-helper'); -const clientOptions = require('../../lib/client-options'); -const Host = require('../../lib/host').Host; -const HostMap = require('../../lib/host').HostMap; -const Metadata = require('../../lib/metadata'); -const TableMetadata = require('../../lib/metadata/table-metadata'); -const Murmur3Token = require('../../lib/token').Murmur3Token; -const TokenRange = require('../../lib/token').TokenRange; -const tokenizer = require('../../lib/tokenizer'); -const types = require('../../lib/types'); -const MutableLong = require('../../lib/types/mutable-long'); +import { Host, HostMap } from "../../lib/host"; +import { Murmur3Token, TokenRange } from "../../lib/token"; +import SchemaParser from "../../lib/metadata/schema-parser"; const dataTypes = types.dataTypes; -const utils = require('../../lib/utils'); -const errors = require('../../lib/errors'); -const Encoder = require('../../lib/encoder'); -const isDoneForToken = require('../../lib/metadata/schema-parser').isDoneForToken; +const isDoneForToken = SchemaParser.isDoneForToken; describe('Metadata', function () { this.timeout(5000); diff --git a/test/unit/mutable-long-tests.ts b/test/unit/mutable-long-tests.ts index 8bbb32fc..3088c611 100644 --- a/test/unit/mutable-long-tests.ts +++ b/test/unit/mutable-long-tests.ts @@ -14,11 +14,10 @@ * limitations under the License. */ "use strict"; - -const assert = require('assert'); -const format = require('util').format; -const Long = require('long'); -const MutableLong = require('../../lib/types/mutable-long'); +import assert from "assert"; +import Long from "long"; +import MutableLong from "../../lib/types/mutable-long"; +import { format } from "util"; describe('MutableLong', function () { describe('fromNumber() and #toNumber()', function () { diff --git a/test/unit/parser-tests.ts b/test/unit/parser-tests.ts index b0d21dd8..34a10ed9 100644 --- a/test/unit/parser-tests.ts +++ b/test/unit/parser-tests.ts @@ -13,17 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const assert = require('assert'); -const events = require('events'); - -const Encoder = require('../../lib/encoder'); -const streams = require('../../lib/streams'); -const errors = require('../../lib/errors'); -const types = require('../../lib/types'); -const utils = require('../../lib/utils'); -const helper = require('../test-helper'); +import assert from "assert"; +import events from "events"; +import Encoder from "../../lib/encoder"; +import streams from "../../lib/streams"; +import errors from "../../lib/errors"; +import types from "../../lib/types/index"; +import utils from "../../lib/utils"; +import helper from "../test-helper"; +'use strict'; /** * Tests for the transform streams that are involved in the reading of a response */ diff --git a/test/unit/prepare-handler-tests.ts b/test/unit/prepare-handler-tests.ts index 1a2afb1a..b855e013 100644 --- a/test/unit/prepare-handler-tests.ts +++ b/test/unit/prepare-handler-tests.ts @@ -14,14 +14,13 @@ * limitations under the License. */ 'use strict'; - -const { assert } = require('chai'); -const events = require('events'); -const helper = require('../test-helper'); -const PrepareHandler = require('../../lib/prepare-handler'); -const defaultOptions = require('../../lib/client-options').defaultOptions; -const types = require('../../lib/types'); -const utils = require('../../lib/utils'); +import { assert } from "chai"; +import events from "events"; +import helper from "../test-helper"; +import PrepareHandler from "../../lib/prepare-handler"; +import types from "../../lib/types/index"; +import utils from "../../lib/utils"; +import { defaultOptions } from "../../lib/client-options"; describe('PrepareHandler', function () { diff --git a/test/unit/protocol-stream-tests.ts b/test/unit/protocol-stream-tests.ts index 254a25ed..3477a973 100644 --- a/test/unit/protocol-stream-tests.ts +++ b/test/unit/protocol-stream-tests.ts @@ -14,11 +14,10 @@ * limitations under the License. */ 'use strict'; -const assert = require('assert'); - -const Protocol = require('../../lib/streams').Protocol; -const types = require('../../lib/types'); -const utils = require('../../lib/utils'); +import assert from "assert"; +import types from "../../lib/types/index"; +import utils from "../../lib/utils"; +import {Protocol} from "../../lib/streams"; describe('Protocol', function () { it('should emit a single frame with 0-length body', function (done) { diff --git a/test/unit/protocol-version-tests.ts b/test/unit/protocol-version-tests.ts index 780cd99a..24b38188 100644 --- a/test/unit/protocol-version-tests.ts +++ b/test/unit/protocol-version-tests.ts @@ -14,11 +14,12 @@ * limitations under the License. */ 'use strict'; +import assert from "assert"; +import {protocolVersion} from "../../lib/types"; +import {Host} from "../../lib/host"; +import clientOptions from "../../lib/client-options"; -const assert = require('assert'); -const protocolVersion = require('../../lib/types/').protocolVersion; -const Host = require('../../lib/host').Host; -const options = require('../../lib/client-options').defaultOptions(); +const options = clientOptions.defaultOptions(); describe('protocolVersion', function () { describe('#getHighestCommon()', function () { diff --git a/test/unit/reconnection-test.ts b/test/unit/reconnection-test.ts index 4eeadd9d..b2748159 100644 --- a/test/unit/reconnection-test.ts +++ b/test/unit/reconnection-test.ts @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import assert from "assert"; +import utils from "../../lib/utils"; +import helper from "../test-helper"; +import reconnection from "../../lib/policies/reconnection"; + 'use strict'; -const assert = require('assert'); //project modules -const utils = require('../../lib/utils'); -const helper = require('../test-helper'); -const reconnection = require('../../lib/policies/reconnection'); - describe('ConstantReconnectionPolicy', function () { it('should yield the same wait time', function (done) { const delay = 2000; diff --git a/test/unit/request-handler-tests.ts b/test/unit/request-handler-tests.ts index 62875e65..b05f7792 100644 --- a/test/unit/request-handler-tests.ts +++ b/test/unit/request-handler-tests.ts @@ -14,27 +14,26 @@ * limitations under the License. */ 'use strict'; -const assert = require('assert'); -const util = require('util'); - -const RequestHandler = require('../../lib/request-handler'); -const requests = require('../../lib/requests'); -const helper = require('../test-helper'); -const errors = require('../../lib/errors'); -const types = require('../../lib/types'); -const utils = require('../../lib/utils'); -const retry = require('../../lib/policies/retry'); -const speculativeExecution = require('../../lib/policies/speculative-execution'); -const execProfileModule = require('../../lib/execution-profile'); +import assert from "assert"; +import util from "util"; +import RequestHandler from "../../lib/request-handler"; +import requests from "../../lib/requests"; +import helper from "../test-helper"; +import errors from "../../lib/errors"; +import types from "../../lib/types/index"; +import utils from "../../lib/utils"; +import retry from "../../lib/policies/retry"; +import speculativeExecution from "../../lib/policies/speculative-execution"; +import execProfileModule from "../../lib/execution-profile"; +import OperationState from "../../lib/operation-state"; +import * as execOptionsModule from "../../lib/execution-options"; +import ClientMetrics from "../../lib/metrics/client-metrics"; +import { defaultOptions } from "../../lib/client-options"; + const ProfileManager = execProfileModule.ProfileManager; const ExecutionProfile = execProfileModule.ExecutionProfile; -const OperationState = require('../../lib/operation-state'); -const defaultOptions = require('../../lib/client-options').defaultOptions; -const execOptionsModule = require('../../lib/execution-options'); const DefaultExecutionOptions = execOptionsModule.DefaultExecutionOptions; const ExecutionOptions = execOptionsModule.ExecutionOptions; -const ClientMetrics = require('../../lib/metrics/client-metrics'); - describe('RequestHandler', function () { const queryRequest = new requests.QueryRequest('QUERY1'); describe('#send()', function () { diff --git a/test/unit/requests-test.ts b/test/unit/requests-test.ts index c8facec6..6ef326a5 100644 --- a/test/unit/requests-test.ts +++ b/test/unit/requests-test.ts @@ -14,14 +14,14 @@ * limitations under the License. */ 'use strict'; +import assert from "assert"; +import requests from "../../lib/requests"; +import Encoder from "../../lib/encoder"; +import types from "../../lib/types/index"; +import utils from "../../lib/utils"; +import packageInfo from "../../package.json"; +import { ExecutionOptions } from "../../lib/execution-options"; -const assert = require('assert'); -const requests = require('../../lib/requests'); -const Encoder = require('../../lib/encoder'); -const types = require('../../lib/types'); -const utils = require('../../lib/utils'); -const ExecutionOptions = require('../../lib/execution-options').ExecutionOptions; -const packageInfo = require('../../package.json'); const QueryRequest = requests.QueryRequest; const ExecuteRequest = requests.ExecuteRequest; const BatchRequest = requests.BatchRequest; diff --git a/test/unit/result-set-tests.ts b/test/unit/result-set-tests.ts index 26bb8a78..8415b337 100644 --- a/test/unit/result-set-tests.ts +++ b/test/unit/result-set-tests.ts @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; +import { assert } from "chai"; +import sinon from "sinon"; +import utils from "../../lib/utils"; +import types from "../../lib/types/index"; +import helper from "../test-helper"; -const { assert } = require('chai'); -const sinon = require('sinon'); -const utils = require('../../lib/utils'); -const types = require('../../lib/types'); -const helper = require('../test-helper'); +'use strict'; const { ResultSet } = types; describe('ResultSet', function () { diff --git a/test/unit/retry-policy-tests.ts b/test/unit/retry-policy-tests.ts index 19296cf6..7324a60f 100644 --- a/test/unit/retry-policy-tests.ts +++ b/test/unit/retry-policy-tests.ts @@ -14,11 +14,12 @@ * limitations under the License. */ 'use strict'; -const assert = require('assert'); -const types = require('../../lib/types'); -const policies = require('../../lib/policies'); -const helper = require('../test-helper'); -const ExecutionOptions = require('../../lib/execution-options').ExecutionOptions; +import assert from "assert"; +import types from "../../lib/types/index"; +import policies from "../../lib/policies/index"; +import helper from "../test-helper"; +import {ExecutionOptions} from "../../lib/execution-options"; + const RetryPolicy = policies.retry.RetryPolicy; const IdempotenceAwareRetryPolicy = policies.retry.IdempotenceAwareRetryPolicy; const FallthroughRetryPolicy = policies.retry.FallthroughRetryPolicy; diff --git a/test/unit/search/date-range-tests.ts b/test/unit/search/date-range-tests.ts index 2fc87567..c2aa1a95 100644 --- a/test/unit/search/date-range-tests.ts +++ b/test/unit/search/date-range-tests.ts @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; +import assert from "assert"; +import util from "util"; +import helper from "../../test-helper"; +import * as dateRangeModule from "../../../lib/datastax/search/date-range"; -const assert = require('assert'); -const util = require('util'); -const helper = require('../../test-helper'); -const dateRangeModule = require('../../../lib/datastax/search/date-range'); +'use strict'; const DateRange = dateRangeModule.DateRange; const DateRangeBound = dateRangeModule.DateRangeBound; const unbounded = dateRangeModule.unbounded; diff --git a/test/unit/speculative-execution-tests.ts b/test/unit/speculative-execution-tests.ts index 6fe4871d..a34317e5 100644 --- a/test/unit/speculative-execution-tests.ts +++ b/test/unit/speculative-execution-tests.ts @@ -13,12 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import helper from "../test-helper"; +import specExecModule from "../../lib/policies/speculative-execution"; 'use strict'; - -const helper = require('../test-helper'); -const specExecModule = require('../../lib/policies/speculative-execution'); - describe('NoSpeculativeExecutionPolicy', () => { describe('#getOptions()', () => { it('should return an empty Map', () => { diff --git a/test/unit/stream-id-stack-tests.ts b/test/unit/stream-id-stack-tests.ts index c70436a6..c67c918f 100644 --- a/test/unit/stream-id-stack-tests.ts +++ b/test/unit/stream-id-stack-tests.ts @@ -13,13 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import sinon from "sinon"; +import assert from "assert"; +import StreamIdStack from "../../lib/stream-id-stack"; "use strict"; -const sinon = require('sinon'); -const assert = require('assert'); - -const StreamIdStack = require('../../lib/stream-id-stack'); - describe('StreamIdStack', function () { let clock; diff --git a/test/unit/timestamp-tests.ts b/test/unit/timestamp-tests.ts index a1f89224..432d5126 100644 --- a/test/unit/timestamp-tests.ts +++ b/test/unit/timestamp-tests.ts @@ -14,11 +14,10 @@ * limitations under the License. */ 'use strict'; - -const assert = require('assert'); -const MonotonicTimestampGenerator = require('../../lib/policies/timestamp-generation').MonotonicTimestampGenerator; -const Long = require('../../lib/types').Long; -const helper = require('../test-helper'); +import assert from "assert"; +import helper from "../test-helper"; +import { MonotonicTimestampGenerator } from "../../lib/policies/timestamp-generation"; +import {Long} from "../../lib/types"; describe('MonotonicTimestampGenerator', function () { describe('#next()', function () { diff --git a/test/unit/token-tests.ts b/test/unit/token-tests.ts index 06297ab3..abe08385 100644 --- a/test/unit/token-tests.ts +++ b/test/unit/token-tests.ts @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; +import tokenizer from "../../lib/tokenizer"; +import token from "../../lib/token"; +import assert from "assert"; -const tokenizer = require('../../lib/tokenizer'); -const token = require('../../lib/token'); -const assert = require('assert'); +'use strict'; class TokenTester { constructor(tokenizer) { diff --git a/test/unit/tokenizer-tests.ts b/test/unit/tokenizer-tests.ts index c710d876..d31d69c7 100644 --- a/test/unit/tokenizer-tests.ts +++ b/test/unit/tokenizer-tests.ts @@ -13,19 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; -const assert = require('assert'); +import assert from "assert"; +import tokenizer from "../../lib/tokenizer"; +import token from "../../lib/token"; +import types from "../../lib/types/index"; +import utils from "../../lib/utils"; +import MutableLong from "../../lib/types/mutable-long"; +import helper from "../test-helper"; -const tokenizer = require('../../lib/tokenizer'); -const token = require('../../lib/token'); +'use strict'; const Murmur3Tokenizer = tokenizer.Murmur3Tokenizer; const RandomTokenizer = tokenizer.RandomTokenizer; const ByteOrderedTokenizer = tokenizer.ByteOrderedTokenizer; -const types = require('../../lib/types'); -const utils = require('../../lib/utils'); -const MutableLong = require('../../lib/types/mutable-long'); -const helper = require('../test-helper'); - describe('Murmur3Tokenizer', function () { describe('#rotl64()', function () { it('should return expected results', function () { diff --git a/test/unit/tracker-tests.ts b/test/unit/tracker-tests.ts index 11d35a15..ba9a7351 100644 --- a/test/unit/tracker-tests.ts +++ b/test/unit/tracker-tests.ts @@ -13,14 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - 'use strict'; - -const assert = require('assert'); -const helper = require('../test-helper'); -const types = require('../../lib/types'); -const RequestLogger = require('../../lib/tracker').RequestLogger; -const ExecutionOptions = require('../../lib/execution-options').ExecutionOptions; +import assert from "assert"; +import helper from "../test-helper"; +import types from "../../lib/types/index"; +import { RequestLogger } from "../../lib/tracker"; +import { ExecutionOptions } from "../../lib/execution-options"; describe('RequestLogger', () => { describe('#onSuccess()', () => { diff --git a/test/unit/utils-tests.ts b/test/unit/utils-tests.ts index ba274160..f4c14e20 100644 --- a/test/unit/utils-tests.ts +++ b/test/unit/utils-tests.ts @@ -13,11 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { assert } from "chai"; +import sinon from "sinon"; +import utils from "../../lib/utils"; +import helper from "../test-helper"; + 'use strict'; -const { assert } = require('chai'); -const sinon = require('sinon'); -const utils = require('../../lib/utils'); -const helper = require('../test-helper'); const AddressResolver = utils.AddressResolver; describe('utils', function () { diff --git a/test/unit/uuid-tests.ts b/test/unit/uuid-tests.ts index c53367fb..8c34d49a 100644 --- a/test/unit/uuid-tests.ts +++ b/test/unit/uuid-tests.ts @@ -14,12 +14,10 @@ * limitations under the License. */ 'use strict'; - -const assert = require('assert'); -const helper = require('../test-helper'); -const utils = require('../../lib/utils'); -const Uuid = require('../../lib/types').Uuid; -const TimeUuid = require('../../lib/types').TimeUuid; +import assert from "assert"; +import helper from "../test-helper"; +import utils from "../../lib/utils"; +import { Uuid, TimeUuid } from "../../lib/types"; describe('Uuid', function () { describe('constructor', function () { diff --git a/test/unit/version-number-tests.ts b/test/unit/version-number-tests.ts index e93d7d50..f7f02008 100644 --- a/test/unit/version-number-tests.ts +++ b/test/unit/version-number-tests.ts @@ -13,11 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; - -const assert = require('assert'); -const VersionNumber = require('../../lib/types/version-number'); +import assert from "assert"; +import VersionNumber from "../../lib/types/version-number"; +'use strict'; describe('VersionNumber', () => { describe('#parse()', () => { it('should parse release version', validateVersion('3.0.13', 3, 0, 13)); diff --git a/tsconfig.json b/tsconfig.json index d494168f..fe67c029 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,10 +14,12 @@ "forceConsistentCasingInFileNames": true, "declarationMap": true, "moduleDetection": "force", - "resolveJsonModule": true + "resolveJsonModule": true, + "moduleResolution": "nodenext" }, "include": [ "lib/**/*.ts", + "test/**/*.ts", "index.ts" ], "exclude": [ From 3c1051f119a15261e11e50d77ad3e37902efb108 Mon Sep 17 00:00:00 2001 From: janehe Date: Wed, 12 Mar 2025 23:40:36 -0700 Subject: [PATCH 14/19] add typescript eslint --- .eslintignore | 6 +- .eslintrc.js | 7 +- package-lock.json | 1245 +++++++++++++++++++++++++++++++++++++++++++-- package.json | 3 + 4 files changed, 1209 insertions(+), 52 deletions(-) diff --git a/.eslintignore b/.eslintignore index d1d20712..be628dea 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,8 +1,10 @@ # TypeScript: js files are generated using tsc transpiler -/test/unit/typescript/*.js +/test/unit/typescript/* # Integer is part of the Closure Library /lib/types/integer.js # TinkerPop-based files -/lib/datastax/graph/type-serializers.js \ No newline at end of file +/lib/datastax/graph/type-serializers.js + +/out/**/*.js \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js index ffce4d35..1dfeced6 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,4 +1,9 @@ module.exports = { + plugins: [ + "@stylistic", + '@typescript-eslint' + ], + parser: '@typescript-eslint/parser', "env": { "commonjs": true, "es6": true @@ -6,7 +11,7 @@ module.exports = { "parserOptions": { "ecmaVersion": 2017 }, - "extends": "eslint:recommended", + "extends": ["eslint:recommended", 'plugin:@typescript-eslint/recommended'], "rules": { "indent": [ "error", diff --git a/package-lock.json b/package-lock.json index 8b4f0278..57e54b8b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,8 +14,12 @@ "long": "~5.2.3" }, "devDependencies": { + "@stylistic/eslint-plugin": "^3.1.0", "@types/mocha": "^10.0.10", + "@typescript-eslint/eslint-plugin": "^8.26.1", + "@typescript-eslint/parser": "^8.26.1", "chai": "~4.3.8", + "eslint": "^8.57.1", "kerberos": "~2.0.3", "mocha": "~10.2.0", "mocha-jenkins-reporter": "~0.4.8", @@ -27,6 +31,200 @@ "node": ">=18" } }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.5.0.tgz", + "integrity": "sha512-RoV8Xs9eNwiDvhv7M+xcL4PWyRyIXRY/FLp3buU4h1EYfdF7unWUy3dOjPqb3C7rMUewIcqwW850PgS8h1o1yg==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", + "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dev": true, + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@eslint/js": { + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz", + "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", + "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", + "deprecated": "Use @eslint/config-array instead", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^2.0.3", + "debug": "^4.3.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", + "deprecated": "Use @eslint/object-schema instead", + "dev": true + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@sinonjs/commons": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz", @@ -71,6 +269,37 @@ "integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==", "dev": true }, + "node_modules/@stylistic/eslint-plugin": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin/-/eslint-plugin-3.1.0.tgz", + "integrity": "sha512-pA6VOrOqk0+S8toJYhQGv2MWpQQR0QpeUo9AhNkC49Y26nxBQ/nH1rta9bUU1rPw2fJ1zZEMV5oCX5AazT7J2g==", + "dev": true, + "dependencies": { + "@typescript-eslint/utils": "^8.13.0", + "eslint-visitor-keys": "^4.2.0", + "espree": "^10.3.0", + "estraverse": "^5.3.0", + "picomatch": "^4.0.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "peerDependencies": { + "eslint": ">=8.40.0" + } + }, + "node_modules/@stylistic/eslint-plugin/node_modules/picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/@types/mocha": { "version": "10.0.10", "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.10.tgz", @@ -85,6 +314,229 @@ "undici-types": "~5.26.4" } }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.26.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.26.1.tgz", + "integrity": "sha512-2X3mwqsj9Bd3Ciz508ZUtoQQYpOhU/kWoUqIf49H8Z0+Vbh6UF/y0OEYp0Q0axOGzaBGs7QxRwq0knSQ8khQNA==", + "dev": true, + "dependencies": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "8.26.1", + "@typescript-eslint/type-utils": "8.26.1", + "@typescript-eslint/utils": "8.26.1", + "@typescript-eslint/visitor-keys": "8.26.1", + "graphemer": "^1.4.0", + "ignore": "^5.3.1", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.0.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.0.0 || ^8.0.0-alpha.0", + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.26.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.26.1.tgz", + "integrity": "sha512-w6HZUV4NWxqd8BdeFf81t07d7/YV9s7TCWrQQbG5uhuvGUAW+fq1usZ1Hmz9UPNLniFnD8GLSsDpjP0hm1S4lQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "8.26.1", + "@typescript-eslint/types": "8.26.1", + "@typescript-eslint/typescript-estree": "8.26.1", + "@typescript-eslint/visitor-keys": "8.26.1", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.26.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.26.1.tgz", + "integrity": "sha512-6EIvbE5cNER8sqBu6V7+KeMZIC1664d2Yjt+B9EWUXrsyWpxx4lEZrmvxgSKRC6gX+efDL/UY9OpPZ267io3mg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "8.26.1", + "@typescript-eslint/visitor-keys": "8.26.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.26.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.26.1.tgz", + "integrity": "sha512-Kcj/TagJLwoY/5w9JGEFV0dclQdyqw9+VMndxOJKtoFSjfZhLXhYjzsQEeyza03rwHx2vFEGvrJWJBXKleRvZg==", + "dev": true, + "dependencies": { + "@typescript-eslint/typescript-estree": "8.26.1", + "@typescript-eslint/utils": "8.26.1", + "debug": "^4.3.4", + "ts-api-utils": "^2.0.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.26.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.26.1.tgz", + "integrity": "sha512-n4THUQW27VmQMx+3P+B0Yptl7ydfceUj4ON/AQILAASwgYdZ/2dhfymRMh5egRUrvK5lSmaOm77Ry+lmXPOgBQ==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.26.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.26.1.tgz", + "integrity": "sha512-yUwPpUHDgdrv1QJ7YQal3cMVBGWfnuCdKbXw1yyjArax3353rEJP1ZA+4F8nOlQ3RfS2hUN/wze3nlY+ZOhvoA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "8.26.1", + "@typescript-eslint/visitor-keys": "8.26.1", + "debug": "^4.3.4", + "fast-glob": "^3.3.2", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^2.0.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.26.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.26.1.tgz", + "integrity": "sha512-V4Urxa/XtSUroUrnI7q6yUTD3hDtfJ2jzVfeT3VK0ciizfK2q/zGC0iDh1lFMUZR8cImRrep6/q0xd/1ZGPQpg==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@typescript-eslint/scope-manager": "8.26.1", + "@typescript-eslint/types": "8.26.1", + "@typescript-eslint/typescript-estree": "8.26.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.9.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.26.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.26.1.tgz", + "integrity": "sha512-AjOC3zfnxd6S4Eiy3jwktJPclqhFHNyd8L6Gycf9WUPoKZpgM5PjkxY1X7uSy61xVpiJDhhk7XT2NVsN3ALTWg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "8.26.1", + "eslint-visitor-keys": "^4.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@ungap/structured-clone": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", + "dev": true + }, + "node_modules/acorn": { + "version": "8.14.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", + "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, "node_modules/adm-zip": { "version": "0.5.10", "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.10.tgz", @@ -93,6 +545,22 @@ "node": ">=6.0" } }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, "node_modules/ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", @@ -234,12 +702,12 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -275,6 +743,15 @@ "ieee754": "^1.1.13" } }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/camelcase": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", @@ -410,6 +887,20 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -481,6 +972,12 @@ "node": ">=4.0.0" } }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, "node_modules/detect-libc": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz", @@ -499,6 +996,18 @@ "node": ">=0.3.1" } }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", @@ -535,6 +1044,202 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/eslint": { + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz", + "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", + "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.1", + "@humanwhocodes/config-array": "^0.13.0", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dev": true, + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/eslint/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/espree": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz", + "integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==", + "dev": true, + "dependencies": { + "acorn": "^8.14.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/expand-template": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", @@ -544,6 +1249,61 @@ "node": ">=6" } }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "node_modules/fastq": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", + "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, "node_modules/file-uri-to-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", @@ -564,9 +1324,9 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, "dependencies": { "to-regex-range": "^5.0.1" @@ -588,17 +1348,53 @@ "node": ">=10" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true, + "bin": { + "flat": "cli.js" + } + }, + "node_modules/flat-cache": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", + "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", + "dev": true, + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.3", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flat-cache/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/flat": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", - "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", - "dev": true, - "bin": { - "flat": "cli.js" - } + "node_modules/flatted": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", + "dev": true }, "node_modules/fs-constants": { "version": "1.0.0", @@ -686,6 +1482,27 @@ "node": "*" } }, + "node_modules/globals": { + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -736,6 +1553,40 @@ } ] }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -830,6 +1681,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-plain-obj": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", @@ -857,6 +1717,12 @@ "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", "dev": true }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, "node_modules/js-yaml": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", @@ -869,6 +1735,24 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, "node_modules/just-extend": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz", @@ -890,6 +1774,28 @@ "node": ">=12.9.0" } }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -911,6 +1817,12 @@ "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", "dev": true }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, "node_modules/log-symbols": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", @@ -947,6 +1859,28 @@ "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==", "dev": true }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, "node_modules/mimic-response": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", @@ -1112,6 +2046,12 @@ "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==", "dev": true }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, "node_modules/nise": { "version": "5.1.4", "resolved": "https://registry.npmjs.org/nise/-/nise-5.1.4.tgz", @@ -1146,39 +2086,6 @@ "node": ">=10" } }, - "node_modules/node-abi/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/node-abi/node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/node-abi/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, "node_modules/node-addon-api": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-6.1.0.tgz", @@ -1203,6 +2110,23 @@ "wrappy": "1" } }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -1233,6 +2157,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -1251,6 +2187,15 @@ "node": ">=0.10.0" } }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/path-parse": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", @@ -1313,6 +2258,15 @@ "node": ">=10" } }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/proxyquire": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/proxyquire/-/proxyquire-2.1.3.tgz", @@ -1334,6 +2288,35 @@ "once": "^1.3.1" } }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -1405,6 +2388,25 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, "node_modules/rimraf": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", @@ -1417,6 +2419,29 @@ "rimraf": "bin.js" } }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -1437,6 +2462,18 @@ } ] }, + "node_modules/semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/serialize-javascript": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", @@ -1446,6 +2483,27 @@ "randombytes": "^2.1.0" } }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/simple-concat": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", @@ -1665,6 +2723,12 @@ "node": ">=6.0.0" } }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -1677,6 +2741,18 @@ "node": ">=8.0" } }, + "node_modules/ts-api-utils": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.0.1.tgz", + "integrity": "sha512-dnlgjFSVetynI8nzgJ+qF62efpglpWRk8isUEWZGWlJYySCTD6aKvbUDu+zbPeDakk3bg5H4XpitHukgfL1m9w==", + "dev": true, + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, "node_modules/tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -1689,6 +2765,18 @@ "node": "*" } }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -1698,17 +2786,76 @@ "node": ">=4" } }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typescript": { + "version": "5.8.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.2.tgz", + "integrity": "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ==", + "dev": true, + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dev": true }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/workerpool": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", diff --git a/package.json b/package.json index e489e476..d1f8b78a 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,10 @@ }, "devDependencies": { "@types/mocha": "^10.0.10", + "@typescript-eslint/eslint-plugin": "^8.26.1", + "@typescript-eslint/parser": "^8.26.1", "chai": "~4.3.8", + "eslint": "^8.57.1", "kerberos": "~2.0.3", "mocha": "~10.2.0", "mocha-jenkins-reporter": "~0.4.8", From 9567a3340e97302c852832d84f88589418384fa2 Mon Sep 17 00:00:00 2001 From: janehe Date: Wed, 12 Mar 2025 23:42:51 -0700 Subject: [PATCH 15/19] delete "use strict"; --- lib/auth/base-dse-authenticator.ts | 2 +- lib/auth/dse-gssapi-auth-provider.ts | 2 +- lib/auth/dse-plain-text-auth-provider.ts | 2 +- lib/auth/gssapi-client.ts | 2 +- lib/auth/index.ts | 2 +- lib/auth/no-auth-provider.ts | 2 +- lib/auth/plain-text-auth-provider.ts | 2 +- lib/auth/provider.ts | 2 +- lib/client-options.ts | 2 +- lib/client.ts | 2 +- lib/concurrent/index.ts | 2 +- lib/connection.ts | 2 +- lib/control-connection.ts | 2 +- lib/datastax/cloud/index.ts | 2 +- lib/datastax/graph/complex-type-helper.ts | 2 +- lib/datastax/graph/custom-type-serializers.ts | 2 +- lib/datastax/graph/graph-executor.ts | 2 +- lib/datastax/graph/graph-serializer.ts | 2 +- lib/datastax/graph/index.ts | 2 +- lib/datastax/graph/options.ts | 2 +- lib/datastax/graph/result-set.ts | 2 +- lib/datastax/graph/structure.ts | 2 +- lib/datastax/graph/type-serializers.ts | 2 +- lib/datastax/graph/wrappers.ts | 2 +- lib/datastax/index.ts | 2 +- lib/datastax/search/date-range.ts | 2 +- lib/datastax/search/index.ts | 2 +- lib/encoder.ts | 2 +- lib/errors.ts | 2 +- lib/execution-options.ts | 2 +- lib/execution-profile.ts | 2 +- lib/geometry/geometry.ts | 2 +- lib/geometry/index.ts | 2 +- lib/geometry/line-string.ts | 2 +- lib/geometry/point.ts | 2 +- lib/geometry/polygon.ts | 2 +- lib/host-connection-pool.ts | 2 +- lib/host.ts | 2 +- lib/insights-client.ts | 2 +- lib/mapping/cache.ts | 2 +- lib/mapping/doc-info-adapter.ts | 2 +- lib/mapping/index.ts | 2 +- lib/mapping/mapper.ts | 2 +- lib/mapping/mapping-handler.ts | 2 +- lib/mapping/model-batch-item.ts | 2 +- lib/mapping/model-batch-mapper.ts | 2 +- lib/mapping/model-mapper.ts | 2 +- lib/mapping/model-mapping-info.ts | 2 +- lib/mapping/object-selector.ts | 2 +- lib/mapping/q.ts | 2 +- lib/mapping/query-generator.ts | 2 +- lib/mapping/result-mapper.ts | 2 +- lib/mapping/result.ts | 2 +- lib/mapping/table-mappings.ts | 2 +- lib/mapping/tree.ts | 2 +- lib/metadata/aggregate.ts | 2 +- lib/metadata/client-state.ts | 2 +- lib/metadata/data-collection.ts | 2 +- lib/metadata/event-debouncer.ts | 2 +- lib/metadata/index.ts | 2 +- lib/metadata/materialized-view.ts | 2 +- lib/metadata/schema-function.ts | 2 +- lib/metadata/schema-index.ts | 2 +- lib/metadata/schema-parser.ts | 2 +- lib/metadata/table-metadata.ts | 2 +- lib/metrics/client-metrics.ts | 2 +- lib/metrics/default-metrics.ts | 2 +- lib/metrics/index.ts | 2 +- lib/operation-state.ts | 2 +- lib/policies/address-resolution.ts | 2 +- lib/policies/index.ts | 2 +- lib/policies/load-balancing.ts | 2 +- lib/policies/reconnection.ts | 2 +- lib/policies/retry.ts | 2 +- lib/policies/speculative-execution.ts | 2 +- lib/policies/timestamp-generation.ts | 2 +- lib/prepare-handler.ts | 2 +- lib/promise-utils.ts | 2 +- lib/readers.ts | 2 +- lib/request-execution.ts | 2 +- lib/request-handler.ts | 2 +- lib/requests.ts | 2 +- lib/stream-id-stack.ts | 2 +- lib/streams.ts | 2 +- lib/token.ts | 2 +- lib/tokenizer.ts | 2 +- lib/tracker/index.ts | 2 +- lib/tracker/request-logger.ts | 2 +- lib/tracker/request-tracker.ts | 2 +- lib/types/big-decimal.ts | 2 +- lib/types/duration.ts | 2 +- lib/types/index.ts | 2 +- lib/types/inet-address.ts | 2 +- lib/types/local-date.ts | 2 +- lib/types/local-time.ts | 2 +- lib/types/mutable-long.ts | 2 +- lib/types/protocol-version.ts | 2 +- lib/types/result-set.ts | 2 +- lib/types/result-stream.ts | 2 +- lib/types/row.ts | 2 +- lib/types/time-uuid.ts | 2 +- lib/types/tuple.ts | 2 +- lib/types/uuid.ts | 2 +- lib/types/vector.ts | 2 +- lib/types/version-number.ts | 2 +- lib/utils.ts | 2 +- lib/writers.ts | 2 +- test/integration/long/client-metadata-tests.ts | 2 +- test/integration/long/event-tests.ts | 2 +- test/integration/long/load-balancing-tests.ts | 2 +- test/integration/short/auth/dse-gssapi-auth-provider-tests.ts | 2 +- .../short/auth/dse-plain-text-auth-provider-tests.ts | 2 +- test/integration/short/auth/proxy-authentication-test.ts | 2 +- test/integration/short/client-batch-tests.ts | 2 +- test/integration/short/client-each-row-tests.ts | 2 +- test/integration/short/client-execute-prepared-tests.ts | 2 +- test/integration/short/client-execute-simulator-tests.ts | 2 +- test/integration/short/client-execute-tests.ts | 2 +- test/integration/short/client-pool-tests.ts | 2 +- test/integration/short/client-stream-tests.ts | 2 +- test/integration/short/cloud/cloud-helper.ts | 2 +- test/integration/short/cloud/cloud-tests.ts | 2 +- test/integration/short/concurrent/execute-concurrent-tests.ts | 2 +- test/integration/short/connection-tests.ts | 2 +- test/integration/short/control-connection-simulator-tests.ts | 2 +- test/integration/short/control-connection-tests.ts | 2 +- test/integration/short/custom-payload-tests.ts | 2 +- test/integration/short/duration-type-tests.ts | 2 +- test/integration/short/error-simulator-tests.ts | 2 +- test/integration/short/error-tests.ts | 2 +- test/integration/short/execution-profile-tests.ts | 2 +- test/integration/short/geometry/line-string-tests.ts | 2 +- test/integration/short/geometry/point-tests.ts | 2 +- test/integration/short/geometry/polygon-tests.ts | 2 +- test/integration/short/graph/graph-olap-tests.ts | 2 +- test/integration/short/graph/graph-test-helper.ts | 2 +- test/integration/short/graph/graph-tests.ts | 2 +- test/integration/short/graph/graph-timeout-tests.ts | 2 +- test/integration/short/graph/graph-with-down-node-tests.ts | 2 +- test/integration/short/insights-simulator-tests.ts | 2 +- test/integration/short/load-balancing-simulator-tests.ts | 2 +- test/integration/short/load-balancing-tests.ts | 2 +- test/integration/short/mapping/custom-queries-tests.ts | 2 +- .../short/mapping/from-and-to-model-function-tests.ts | 2 +- test/integration/short/mapping/mapper-test-helper.ts | 2 +- test/integration/short/mapping/mapper-tests.ts | 2 +- test/integration/short/mapping/model-mapper-tests.ts | 2 +- test/integration/short/metadata-simulator-tests.ts | 2 +- test/integration/short/metadata-tests.ts | 2 +- test/integration/short/numeric-tests.ts | 2 +- test/integration/short/paging-tests.ts | 2 +- test/integration/short/pool-simulator-tests.ts | 2 +- test/integration/short/prepare-simulator-tests.ts | 2 +- test/integration/short/retry-simulator-tests.ts | 2 +- test/integration/short/search/date-range-tests.ts | 2 +- test/integration/short/speculative-execution-simulator-tests.ts | 2 +- test/integration/short/ssl-tests.ts | 2 +- test/integration/short/timeout-simulator-tests.ts | 2 +- test/integration/short/tracker-simulator-tests.ts | 2 +- test/integration/short/udf-tests.ts | 2 +- test/integration/short/vector-tests.ts | 2 +- test/integration/simulacron.ts | 2 +- test/other/memory/basic-profile.ts | 2 +- test/other/memory/profile-keeping-ref.ts | 2 +- test/test-helper.ts | 2 +- test/unit/address-resolution-tests.ts | 2 +- test/unit/api-tests.ts | 2 +- test/unit/basic-tests.ts | 2 +- test/unit/big-decimal-tests.ts | 2 +- test/unit/client-tests.ts | 2 +- test/unit/cloud/certificate-validation-tests.ts | 2 +- test/unit/concurrent/execute-concurrent-tests.ts | 2 +- test/unit/connection-tests.ts | 2 +- test/unit/control-connection-tests.ts | 2 +- test/unit/default-load-balancing-policy-tests.ts | 2 +- test/unit/dse-gssapi-auth-provider-tests.ts | 2 +- test/unit/dse-plain-text-auth-provider-tests.ts | 2 +- test/unit/duration-type-tests.ts | 2 +- test/unit/encoder-tests.ts | 2 +- test/unit/encoder-vector-tests.ts | 2 +- test/unit/error-tests.ts | 2 +- test/unit/event-debouncer-tests.ts | 2 +- test/unit/execution-options-tests.ts | 2 +- test/unit/execution-profile-tests.ts | 2 +- test/unit/geometry/line-string-tests.ts | 2 +- test/unit/geometry/point-tests.ts | 2 +- test/unit/geometry/polygon-tests.ts | 2 +- test/unit/graph/executor-tests.ts | 2 +- test/unit/graph/graph-result-tests.ts | 2 +- test/unit/graph/graphson-tests.ts | 2 +- test/unit/host-tests.ts | 2 +- test/unit/inet-address-tests.ts | 2 +- test/unit/insights-client-tests.ts | 2 +- test/unit/license-tests.ts | 2 +- test/unit/load-balancing-tests.ts | 2 +- test/unit/mapping/cache-tests.ts | 2 +- test/unit/mapping/mapper-tests.ts | 2 +- test/unit/mapping/mapper-unit-test-helper.ts | 2 +- test/unit/mapping/mapping-handler-tests.ts | 2 +- test/unit/mapping/model-mapper-mutation-tests.ts | 2 +- test/unit/mapping/model-mapper-select-tests.ts | 2 +- test/unit/mapping/model-mapping-info-tests.ts | 2 +- test/unit/mapping/result-mapper-tests.ts | 2 +- test/unit/mapping/result-tests.ts | 2 +- test/unit/mapping/table-mappings-tests.ts | 2 +- test/unit/mapping/tree-tests.ts | 2 +- test/unit/metadata-tests.ts | 2 +- test/unit/mutable-long-tests.ts | 2 +- test/unit/parser-tests.ts | 2 +- test/unit/prepare-handler-tests.ts | 2 +- test/unit/protocol-stream-tests.ts | 2 +- test/unit/protocol-version-tests.ts | 2 +- test/unit/reconnection-test.ts | 2 +- test/unit/request-handler-tests.ts | 2 +- test/unit/requests-test.ts | 2 +- test/unit/result-set-tests.ts | 2 +- test/unit/retry-policy-tests.ts | 2 +- test/unit/search/date-range-tests.ts | 2 +- test/unit/speculative-execution-tests.ts | 2 +- test/unit/stream-id-stack-tests.ts | 2 +- test/unit/timestamp-tests.ts | 2 +- test/unit/token-tests.ts | 2 +- test/unit/tokenizer-tests.ts | 2 +- test/unit/tracker-tests.ts | 2 +- test/unit/typescript/api-generation-test.ts | 2 +- test/unit/utils-tests.ts | 2 +- test/unit/uuid-tests.ts | 2 +- test/unit/version-number-tests.ts | 2 +- 228 files changed, 228 insertions(+), 228 deletions(-) diff --git a/lib/auth/base-dse-authenticator.ts b/lib/auth/base-dse-authenticator.ts index 5002800d..cd916ce8 100644 --- a/lib/auth/base-dse-authenticator.ts +++ b/lib/auth/base-dse-authenticator.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import { Authenticator } from './provider'; import util from "util"; diff --git a/lib/auth/dse-gssapi-auth-provider.ts b/lib/auth/dse-gssapi-auth-provider.ts index 09ec4021..4d313a14 100644 --- a/lib/auth/dse-gssapi-auth-provider.ts +++ b/lib/auth/dse-gssapi-auth-provider.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import BaseDseAuthenticator from './base-dse-authenticator'; import GssapiClient from './gssapi-client'; import util from "util"; diff --git a/lib/auth/dse-plain-text-auth-provider.ts b/lib/auth/dse-plain-text-auth-provider.ts index 3f9879be..a5367476 100644 --- a/lib/auth/dse-plain-text-auth-provider.ts +++ b/lib/auth/dse-plain-text-auth-provider.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import { AuthProvider } from './provider'; import BaseDseAuthenticator from './base-dse-authenticator'; import util from "util"; diff --git a/lib/auth/gssapi-client.ts b/lib/auth/gssapi-client.ts index 6ced68d9..7e128d19 100644 --- a/lib/auth/gssapi-client.ts +++ b/lib/auth/gssapi-client.ts @@ -16,7 +16,7 @@ import util from "util"; import utils from "../utils"; -'use strict'; + /** * GSSAPI Client interface. diff --git a/lib/auth/index.ts b/lib/auth/index.ts index c377e814..75f9d281 100644 --- a/lib/auth/index.ts +++ b/lib/auth/index.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + /** * DSE Authentication module. diff --git a/lib/auth/no-auth-provider.ts b/lib/auth/no-auth-provider.ts index 7532c26b..583afd39 100644 --- a/lib/auth/no-auth-provider.ts +++ b/lib/auth/no-auth-provider.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -'use strict'; + import { AuthProvider, Authenticator } from './provider'; import { PlainTextAuthenticator } from './plain-text-auth-provider'; diff --git a/lib/auth/plain-text-auth-provider.ts b/lib/auth/plain-text-auth-provider.ts index 7e8b3497..6c74ca2c 100644 --- a/lib/auth/plain-text-auth-provider.ts +++ b/lib/auth/plain-text-auth-provider.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import * as provider from './provider'; import util from "util"; import utils from "../utils"; diff --git a/lib/auth/provider.ts b/lib/auth/provider.ts index 50efa992..a410b9ed 100644 --- a/lib/auth/provider.ts +++ b/lib/auth/provider.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + /** * @classdesc Provides [Authenticator]{@link module:auth~Authenticator} instances to be used when connecting to a host. * @constructor diff --git a/lib/client-options.ts b/lib/client-options.ts index fbe599eb..2dfe5b48 100644 --- a/lib/client-options.ts +++ b/lib/client-options.ts @@ -21,7 +21,7 @@ import tracker from "./tracker/index"; import metrics from "./metrics/index"; import auth from "./auth/index"; -'use strict'; + /** Core connections per host for protocol versions 1 and 2 */ const coreConnectionsPerHostV2 = { [types.distance.local]: 2, diff --git a/lib/client.ts b/lib/client.ts index 8165e38c..c5ed328f 100644 --- a/lib/client.ts +++ b/lib/client.ts @@ -32,7 +32,7 @@ import GraphExecutor from "./datastax/graph/graph-executor"; import promiseUtils from "./promise-utils"; import packageInfo from '../package.json' assert {type: 'json'}; -'use strict'; + const version = packageInfo.version; diff --git a/lib/concurrent/index.ts b/lib/concurrent/index.ts index c5623000..bb2af667 100644 --- a/lib/concurrent/index.ts +++ b/lib/concurrent/index.ts @@ -16,7 +16,7 @@ import { Stream } from "stream"; import utils from "../utils"; -'use strict'; + /** * Utilities for concurrent query execution with the DataStax Node.js Driver. diff --git a/lib/connection.ts b/lib/connection.ts index 40779647..f20d2a8a 100644 --- a/lib/connection.ts +++ b/lib/connection.ts @@ -29,7 +29,7 @@ import OperationState from "./operation-state"; import promiseUtils from "./promise-utils"; import { ExecutionOptions } from "./execution-options"; -'use strict'; + /** * Represents a connection to a Cassandra node diff --git a/lib/control-connection.ts b/lib/control-connection.ts index b53345c8..76bd35d1 100644 --- a/lib/control-connection.ts +++ b/lib/control-connection.ts @@ -27,7 +27,7 @@ import utils from "./utils"; import types from "./types/index"; import promiseUtils from "./promise-utils"; -'use strict'; + const f = util.format; const selectPeers = "SELECT * FROM system.peers"; diff --git a/lib/datastax/cloud/index.ts b/lib/datastax/cloud/index.ts index 4487b57d..643b1efe 100644 --- a/lib/datastax/cloud/index.ts +++ b/lib/datastax/cloud/index.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -'use strict'; + import { DsePlainTextAuthProvider, NoAuthProvider } from '../../auth/index'; import https from "https"; import fs from "fs"; diff --git a/lib/datastax/graph/complex-type-helper.ts b/lib/datastax/graph/complex-type-helper.ts index 7a435a79..75fdb487 100644 --- a/lib/datastax/graph/complex-type-helper.ts +++ b/lib/datastax/graph/complex-type-helper.ts @@ -17,7 +17,7 @@ import { GraphTypeWrapper, UdtGraphWrapper } from "./wrappers"; import types from "../../types/index"; import Encoder from "../../encoder"; -'use strict'; + const { dataTypes } = types; function getTypeDefinitionByValue(value) { diff --git a/lib/datastax/graph/custom-type-serializers.ts b/lib/datastax/graph/custom-type-serializers.ts index aac012c5..1f7d117f 100644 --- a/lib/datastax/graph/custom-type-serializers.ts +++ b/lib/datastax/graph/custom-type-serializers.ts @@ -20,7 +20,7 @@ import { Point, Polygon, LineString } from "../../geometry/index"; import { Edge } from "./structure"; import { GraphTypeWrapper, UdtGraphWrapper } from "./wrappers"; -'use strict'; + const { Tuple, dataTypes } = types; const typeKey = '@type'; diff --git a/lib/datastax/graph/graph-executor.ts b/lib/datastax/graph/graph-executor.ts index 2f482e12..15cc092d 100644 --- a/lib/datastax/graph/graph-executor.ts +++ b/lib/datastax/graph/graph-executor.ts @@ -20,7 +20,7 @@ import { GraphSON2Reader, GraphSON2Writer, GraphSON3Reader, GraphSON3Writer } fr import getCustomTypeSerializers from "./custom-type-serializers"; import { GraphExecutionOptions, graphProtocol } from "./options"; -'use strict'; + const graphLanguageGroovyString = 'gremlin-groovy'; const graphEngineCore = 'Core'; diff --git a/lib/datastax/graph/graph-serializer.ts b/lib/datastax/graph/graph-serializer.ts index 5af153fc..1a7050b3 100644 --- a/lib/datastax/graph/graph-serializer.ts +++ b/lib/datastax/graph/graph-serializer.ts @@ -27,7 +27,7 @@ import typeSerializers from "./type-serializers"; /** * @author Jorge Bay Gondra */ -'use strict'; + /** * GraphSON2 writer. diff --git a/lib/datastax/graph/index.ts b/lib/datastax/graph/index.ts index 4a716fac..f9250293 100644 --- a/lib/datastax/graph/index.ts +++ b/lib/datastax/graph/index.ts @@ -18,7 +18,7 @@ import getCustomTypeSerializers from "./custom-type-serializers"; import { asInt, asDouble, asFloat, asTimestamp, asUdt, UdtGraphWrapper, GraphTypeWrapper} from "./wrappers"; import { Edge, Element, Path, Property, Vertex, VertexProperty } from "./structure"; -'use strict'; + class EnumValue { constructor(typeName, elementName) { diff --git a/lib/datastax/graph/options.ts b/lib/datastax/graph/options.ts index 407354d8..5e7091a2 100644 --- a/lib/datastax/graph/options.ts +++ b/lib/datastax/graph/options.ts @@ -18,7 +18,7 @@ import types from "../../types/index"; import utils from "../../utils"; import { DefaultExecutionOptions, proxyExecuteKey } from "../../execution-options"; -'use strict'; + const Long = types.Long; let consistencyNames; diff --git a/lib/datastax/graph/result-set.ts b/lib/datastax/graph/result-set.ts index 286e1ea5..f3712cd5 100644 --- a/lib/datastax/graph/result-set.ts +++ b/lib/datastax/graph/result-set.ts @@ -15,7 +15,7 @@ */ import utils from "../../utils"; -'use strict'; + /** * Creates a new instance of GraphResultSet. diff --git a/lib/datastax/graph/structure.ts b/lib/datastax/graph/structure.ts index a239062b..9732e5f6 100644 --- a/lib/datastax/graph/structure.ts +++ b/lib/datastax/graph/structure.ts @@ -15,7 +15,7 @@ */ import util from "util"; -'use strict'; + /** * @classdesc diff --git a/lib/datastax/graph/type-serializers.ts b/lib/datastax/graph/type-serializers.ts index f809a0c0..c0cdc8ed 100644 --- a/lib/datastax/graph/type-serializers.ts +++ b/lib/datastax/graph/type-serializers.ts @@ -26,7 +26,7 @@ import g from "./index"; /** * @author Jorge Bay Gondra */ -'use strict'; + // Replace dependencies to minimize code changes from Apache TinkerPop const t = { diff --git a/lib/datastax/graph/wrappers.ts b/lib/datastax/graph/wrappers.ts index 3e4c2c3e..ccf6e643 100644 --- a/lib/datastax/graph/wrappers.ts +++ b/lib/datastax/graph/wrappers.ts @@ -15,7 +15,7 @@ */ import types from "../../types/index"; -'use strict'; + const { dataTypes } = types; /** diff --git a/lib/datastax/index.ts b/lib/datastax/index.ts index 39a1e14a..7b413572 100644 --- a/lib/datastax/index.ts +++ b/lib/datastax/index.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -'use strict'; + /** * DataStax module. diff --git a/lib/datastax/search/date-range.ts b/lib/datastax/search/date-range.ts index 70db343d..1951af12 100644 --- a/lib/datastax/search/date-range.ts +++ b/lib/datastax/search/date-range.ts @@ -16,7 +16,7 @@ import utils from "../../utils"; import Long from "long"; -'use strict'; + /** * Regex to parse dates in the following format YYYY-MM-DDThh:mm:ss.mssZ * Looks cumbersome but it's straightforward: diff --git a/lib/datastax/search/index.ts b/lib/datastax/search/index.ts index 515aed04..5e0bc2ef 100644 --- a/lib/datastax/search/index.ts +++ b/lib/datastax/search/index.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + /** * Search module. diff --git a/lib/encoder.ts b/lib/encoder.ts index f08bc27f..5ca9e00b 100644 --- a/lib/encoder.ts +++ b/lib/encoder.ts @@ -22,7 +22,7 @@ import { DateRange } from "./datastax/search/index"; import geo from "./geometry/index"; import Vector from "./types/vector"; -'use strict'; + const dataTypes = types.dataTypes; const Long = types.Long; const Integer = types.Integer; diff --git a/lib/errors.ts b/lib/errors.ts index a667bd3d..ff62203b 100644 --- a/lib/errors.ts +++ b/lib/errors.ts @@ -15,7 +15,7 @@ */ import util from "util"; -'use strict'; + /** * Contains the error classes exposed by the driver. diff --git a/lib/execution-options.ts b/lib/execution-options.ts index df6b842d..987ba540 100644 --- a/lib/execution-options.ts +++ b/lib/execution-options.ts @@ -17,7 +17,7 @@ import utils from "./utils"; import types from "./types/index"; import errors from "./errors"; -'use strict'; + const proxyExecuteKey = 'ProxyExecute'; /** diff --git a/lib/execution-profile.ts b/lib/execution-profile.ts index 694fba09..3350d225 100644 --- a/lib/execution-profile.ts +++ b/lib/execution-profile.ts @@ -17,7 +17,7 @@ import utils from "./utils"; import types from "./types/index"; import promiseUtils from "./promise-utils"; -'use strict'; + /** * Creates a new instance of {@link ExecutionProfile}. diff --git a/lib/geometry/geometry.ts b/lib/geometry/geometry.ts index 9eb6d06b..48b97466 100644 --- a/lib/geometry/geometry.ts +++ b/lib/geometry/geometry.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + const endianness = { '0': 'BE', diff --git a/lib/geometry/index.ts b/lib/geometry/index.ts index 171552c0..90c62f48 100644 --- a/lib/geometry/index.ts +++ b/lib/geometry/index.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + /** * Geometry module. diff --git a/lib/geometry/line-string.ts b/lib/geometry/line-string.ts index 308a95c2..47fd47de 100644 --- a/lib/geometry/line-string.ts +++ b/lib/geometry/line-string.ts @@ -18,7 +18,7 @@ import utils from "../utils"; import Geometry from "./geometry"; import Point from "./point"; -'use strict'; + /** * Creates a new {@link LineString} instance. diff --git a/lib/geometry/point.ts b/lib/geometry/point.ts index ace2d38c..4ec4e798 100644 --- a/lib/geometry/point.ts +++ b/lib/geometry/point.ts @@ -17,7 +17,7 @@ import util from "util"; import utils from "../utils"; import Geometry from "./geometry"; -'use strict'; + /** * Creates a new {@link Point} instance. diff --git a/lib/geometry/polygon.ts b/lib/geometry/polygon.ts index 81fff43f..27d8459b 100644 --- a/lib/geometry/polygon.ts +++ b/lib/geometry/polygon.ts @@ -19,7 +19,7 @@ import Geometry from "./geometry"; import Point from "./point"; import LineString from "./line-string"; -'use strict'; + /** * Creates a new {@link Polygon} instance. diff --git a/lib/host-connection-pool.ts b/lib/host-connection-pool.ts index 058127fb..17a94a1d 100644 --- a/lib/host-connection-pool.ts +++ b/lib/host-connection-pool.ts @@ -21,7 +21,7 @@ import promiseUtils from "./promise-utils"; import errors from "./errors"; import clientOptions from "./client-options"; -'use strict'; + // Used to get the index of the connection with less in-flight requests let connectionIndex = 0; const connectionIndexOverflow = Math.pow(2, 15); diff --git a/lib/host.ts b/lib/host.ts index 14d6ac64..c011c034 100644 --- a/lib/host.ts +++ b/lib/host.ts @@ -20,7 +20,7 @@ import HostConnectionPool from "./host-connection-pool"; import PrepareHandler from "./prepare-handler"; import promiseUtils from "./promise-utils"; -'use strict'; + const healthResponseCountInterval = 200; /** diff --git a/lib/insights-client.ts b/lib/insights-client.ts index fa110e5b..8aa5779a 100644 --- a/lib/insights-client.ts +++ b/lib/insights-client.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -'use strict'; + import { NoAuthProvider } from './auth/index'; import os from "os"; import path from "path"; diff --git a/lib/mapping/cache.ts b/lib/mapping/cache.ts index a3e21cf3..a8e2e454 100644 --- a/lib/mapping/cache.ts +++ b/lib/mapping/cache.ts @@ -15,7 +15,7 @@ */ import qModule from "./q"; -'use strict'; + const QueryOperator = qModule.QueryOperator; const QueryAssignment = qModule.QueryAssignment; diff --git a/lib/mapping/doc-info-adapter.ts b/lib/mapping/doc-info-adapter.ts index 38f474cf..74175545 100644 --- a/lib/mapping/doc-info-adapter.ts +++ b/lib/mapping/doc-info-adapter.ts @@ -16,7 +16,7 @@ import errors from "../errors"; import utils from "../utils"; -'use strict'; + /** * Provides utility methods to adapt and map user provided docInfo and executionOptions to a predictable object format. diff --git a/lib/mapping/index.ts b/lib/mapping/index.ts index 8a2f44af..cf2ff094 100644 --- a/lib/mapping/index.ts +++ b/lib/mapping/index.ts @@ -21,7 +21,7 @@ import Result from "./result"; import { q } from "./q"; import {TableMappings, DefaultTableMappings, UnderscoreCqlToCamelCaseMappings} from "./table-mappings"; -'use strict'; + /** * Module containing classes and fields related to the Mapper. diff --git a/lib/mapping/mapper.ts b/lib/mapping/mapper.ts index dec16e99..79dee333 100644 --- a/lib/mapping/mapper.ts +++ b/lib/mapping/mapper.ts @@ -22,7 +22,7 @@ import ResultMapper from "./result-mapper"; import ModelMappingInfo from "./model-mapping-info"; import { ModelBatchItem } from "./model-batch-item"; -'use strict'; + /** * Represents an object mapper for Apache Cassandra and DataStax Enterprise. diff --git a/lib/mapping/mapping-handler.ts b/lib/mapping/mapping-handler.ts index 2ac80d47..64109977 100644 --- a/lib/mapping/mapping-handler.ts +++ b/lib/mapping/mapping-handler.ts @@ -22,7 +22,7 @@ import Tree from "./tree"; import ObjectSelector from "./object-selector"; import DocInfoAdapter from "./doc-info-adapter"; -'use strict'; + const cacheHighWaterMark = 100; /** diff --git a/lib/mapping/model-batch-item.ts b/lib/mapping/model-batch-item.ts index b3180bc3..24eee2b3 100644 --- a/lib/mapping/model-batch-item.ts +++ b/lib/mapping/model-batch-item.ts @@ -15,7 +15,7 @@ */ import Cache from "./cache"; -'use strict'; + /** * Represents a query or a set of queries used to perform a mutation in a batch. diff --git a/lib/mapping/model-batch-mapper.ts b/lib/mapping/model-batch-mapper.ts index 03d1935e..c78ac9ad 100644 --- a/lib/mapping/model-batch-mapper.ts +++ b/lib/mapping/model-batch-mapper.ts @@ -16,7 +16,7 @@ import Tree from "./tree"; import * as moduleBatchItemModule from "./model-batch-item"; -'use strict'; + const InsertModelBatchItem = moduleBatchItemModule.InsertModelBatchItem; const UpdateModelBatchItem = moduleBatchItemModule.UpdateModelBatchItem; const RemoveModelBatchItem = moduleBatchItemModule.RemoveModelBatchItem; diff --git a/lib/mapping/model-mapper.ts b/lib/mapping/model-mapper.ts index 2035ce17..196dcaec 100644 --- a/lib/mapping/model-mapper.ts +++ b/lib/mapping/model-mapper.ts @@ -15,7 +15,7 @@ */ import ModelBatchMapper from "./model-batch-mapper"; -'use strict'; + /** * Represents an object mapper for a specific model. diff --git a/lib/mapping/model-mapping-info.ts b/lib/mapping/model-mapping-info.ts index d3e98274..d42ad44b 100644 --- a/lib/mapping/model-mapping-info.ts +++ b/lib/mapping/model-mapping-info.ts @@ -15,7 +15,7 @@ */ import tableMappingsModule from "./table-mappings"; -'use strict'; + const TableMappings = tableMappingsModule.TableMappings; const DefaultTableMappings = tableMappingsModule.DefaultTableMappings; diff --git a/lib/mapping/object-selector.ts b/lib/mapping/object-selector.ts index 9748cdd6..cc48f0dc 100644 --- a/lib/mapping/object-selector.ts +++ b/lib/mapping/object-selector.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -'use strict'; + const keyMatches = { all: 1, diff --git a/lib/mapping/q.ts b/lib/mapping/q.ts index a34d3fee..d63c5149 100644 --- a/lib/mapping/q.ts +++ b/lib/mapping/q.ts @@ -15,7 +15,7 @@ */ import errors from "../errors"; -'use strict'; + /** * Represents a CQL query operator, like >=, IN, <, ... diff --git a/lib/mapping/query-generator.ts b/lib/mapping/query-generator.ts index d446df30..d7a83a78 100644 --- a/lib/mapping/query-generator.ts +++ b/lib/mapping/query-generator.ts @@ -17,7 +17,7 @@ import vm from "vm"; import qModule from "./q"; import types from "../types/index"; -'use strict'; + const QueryOperator = qModule.QueryOperator; const QueryAssignment = qModule.QueryAssignment; const dataTypes = types.dataTypes; diff --git a/lib/mapping/result-mapper.ts b/lib/mapping/result-mapper.ts index 8f7679eb..aa864b90 100644 --- a/lib/mapping/result-mapper.ts +++ b/lib/mapping/result-mapper.ts @@ -17,7 +17,7 @@ import vm from "vm"; import utils from "../utils"; import types from "../types/index"; -'use strict'; + /** * @ignore diff --git a/lib/mapping/result.ts b/lib/mapping/result.ts index c8a59f4f..cde1969d 100644 --- a/lib/mapping/result.ts +++ b/lib/mapping/result.ts @@ -16,7 +16,7 @@ import util from "util"; import utils from "../utils"; -'use strict'; + const inspectMethod = util.inspect.custom || 'inspect'; /** diff --git a/lib/mapping/table-mappings.ts b/lib/mapping/table-mappings.ts index 83a844d2..4966039e 100644 --- a/lib/mapping/table-mappings.ts +++ b/lib/mapping/table-mappings.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -'use strict'; + /** * Contains a set of methods to represent a row into a document and a document into a row. diff --git a/lib/mapping/tree.ts b/lib/mapping/tree.ts index b1595306..5ea5425f 100644 --- a/lib/mapping/tree.ts +++ b/lib/mapping/tree.ts @@ -15,7 +15,7 @@ */ import EventEmitter from "events"; -'use strict'; + /** * Represents a tree node where the key is composed by 1 or more strings. diff --git a/lib/metadata/aggregate.ts b/lib/metadata/aggregate.ts index 45e924a9..df43a4ff 100644 --- a/lib/metadata/aggregate.ts +++ b/lib/metadata/aggregate.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + /** * Creates a new Aggregate. diff --git a/lib/metadata/client-state.ts b/lib/metadata/client-state.ts index 94b4e22b..92f242f1 100644 --- a/lib/metadata/client-state.ts +++ b/lib/metadata/client-state.ts @@ -16,7 +16,7 @@ import util from "util"; import errors from "../errors"; -'use strict'; + /** * Represents the state of a {@link Client}. diff --git a/lib/metadata/data-collection.ts b/lib/metadata/data-collection.ts index 481e83ed..64756744 100644 --- a/lib/metadata/data-collection.ts +++ b/lib/metadata/data-collection.ts @@ -16,7 +16,7 @@ import util from "util"; import events from "events"; -'use strict'; + /** * Creates a new instance of DataCollection diff --git a/lib/metadata/event-debouncer.ts b/lib/metadata/event-debouncer.ts index 059a837a..5fcc3244 100644 --- a/lib/metadata/event-debouncer.ts +++ b/lib/metadata/event-debouncer.ts @@ -17,7 +17,7 @@ import util from "util"; import utils from "../utils"; import promiseUtils from "../promise-utils"; -'use strict'; + const _queueOverflowThreshold = 1000; /** diff --git a/lib/metadata/index.ts b/lib/metadata/index.ts index 8c2a0617..d178236d 100644 --- a/lib/metadata/index.ts +++ b/lib/metadata/index.ts @@ -25,7 +25,7 @@ import promiseUtils from "../promise-utils"; import { TokenRange } from "../token"; import { ExecutionOptions } from "../execution-options"; -'use strict'; + /** * @const * @private diff --git a/lib/metadata/materialized-view.ts b/lib/metadata/materialized-view.ts index 873699b6..6748c16b 100644 --- a/lib/metadata/materialized-view.ts +++ b/lib/metadata/materialized-view.ts @@ -16,7 +16,7 @@ import util from "util"; import DataCollection from "./data-collection"; -'use strict'; + /** * Creates a new MaterializedView. diff --git a/lib/metadata/schema-function.ts b/lib/metadata/schema-function.ts index 385263e0..77804f69 100644 --- a/lib/metadata/schema-function.ts +++ b/lib/metadata/schema-function.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + /** * Creates a new SchemaFunction. diff --git a/lib/metadata/schema-index.ts b/lib/metadata/schema-index.ts index 1f307e62..8fc516d5 100644 --- a/lib/metadata/schema-index.ts +++ b/lib/metadata/schema-index.ts @@ -17,7 +17,7 @@ import util from "util"; import utils from "../utils"; import types from "../types/index"; -'use strict'; + /** @private */ const kind = { custom: 0, diff --git a/lib/metadata/schema-parser.ts b/lib/metadata/schema-parser.ts index 120d8bd2..e9760b13 100644 --- a/lib/metadata/schema-parser.ts +++ b/lib/metadata/schema-parser.ts @@ -25,7 +25,7 @@ import SchemaFunction from "./schema-function"; import Index from "./schema-index"; import MaterializedView from "./materialized-view"; -'use strict'; + const { format } = util; /** diff --git a/lib/metadata/table-metadata.ts b/lib/metadata/table-metadata.ts index 9e93a041..cc77451f 100644 --- a/lib/metadata/table-metadata.ts +++ b/lib/metadata/table-metadata.ts @@ -16,7 +16,7 @@ import util from "util"; import DataCollection from "./data-collection"; -'use strict'; + /** * Creates a new instance of TableMetadata diff --git a/lib/metrics/client-metrics.ts b/lib/metrics/client-metrics.ts index e7b9a61c..27fc3a95 100644 --- a/lib/metrics/client-metrics.ts +++ b/lib/metrics/client-metrics.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -'use strict'; + /** * Represents a base class that is used to measure events from the server and the client as seen by the driver. diff --git a/lib/metrics/default-metrics.ts b/lib/metrics/default-metrics.ts index 66328390..5c051c8a 100644 --- a/lib/metrics/default-metrics.ts +++ b/lib/metrics/default-metrics.ts @@ -16,7 +16,7 @@ import ClientMetrics from "./client-metrics"; import EventEmitter from "events"; -'use strict'; + /** * A default implementation of [ClientMetrics]{@link module:metrics~ClientMetrics} that exposes the driver events as diff --git a/lib/metrics/index.ts b/lib/metrics/index.ts index 9e2e3286..aabcb0a1 100644 --- a/lib/metrics/index.ts +++ b/lib/metrics/index.ts @@ -16,7 +16,7 @@ import ClientMetrics from "./client-metrics"; import DefaultMetrics from "./default-metrics"; -'use strict'; + export { ClientMetrics, DefaultMetrics }; export default { ClientMetrics, DefaultMetrics }; \ No newline at end of file diff --git a/lib/operation-state.ts b/lib/operation-state.ts index d9d9f501..7331cc4d 100644 --- a/lib/operation-state.ts +++ b/lib/operation-state.ts @@ -18,7 +18,7 @@ import utils from "./utils"; import errors from "./errors"; import requests from "./requests"; -'use strict'; + const ExecuteRequest = requests.ExecuteRequest; const QueryRequest = requests.QueryRequest; diff --git a/lib/policies/address-resolution.ts b/lib/policies/address-resolution.ts index 77d7cff9..93f1b4fe 100644 --- a/lib/policies/address-resolution.ts +++ b/lib/policies/address-resolution.ts @@ -17,7 +17,7 @@ import dns from "dns"; import util from "util"; import utils from "../utils"; -'use strict'; + /** @module policies/addressResolution */ /** diff --git a/lib/policies/index.ts b/lib/policies/index.ts index a142eff8..158db734 100644 --- a/lib/policies/index.ts +++ b/lib/policies/index.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import * as addressResolution from './address-resolution'; import * as loadBalancing from './load-balancing'; diff --git a/lib/policies/load-balancing.ts b/lib/policies/load-balancing.ts index c3c9891f..94433725 100644 --- a/lib/policies/load-balancing.ts +++ b/lib/policies/load-balancing.ts @@ -18,7 +18,7 @@ import types from "../types/index"; import utils from "../utils"; import errors from "../errors"; -'use strict'; + const doneIteratorObject = Object.freeze({ done: true }); const newlyUpInterval = 60000; diff --git a/lib/policies/reconnection.ts b/lib/policies/reconnection.ts index 890df6c3..beb18c4e 100644 --- a/lib/policies/reconnection.ts +++ b/lib/policies/reconnection.ts @@ -15,7 +15,7 @@ */ import util from "util"; -'use strict'; + /** @module policies/reconnection */ /** diff --git a/lib/policies/retry.ts b/lib/policies/retry.ts index 4e2735c7..2a7fa042 100644 --- a/lib/policies/retry.ts +++ b/lib/policies/retry.ts @@ -15,7 +15,7 @@ */ import util from "util"; -'use strict'; + /** @module policies/retry */ /** diff --git a/lib/policies/speculative-execution.ts b/lib/policies/speculative-execution.ts index 93d7948e..56fc5b02 100644 --- a/lib/policies/speculative-execution.ts +++ b/lib/policies/speculative-execution.ts @@ -16,7 +16,7 @@ import util from "util"; import errors from "../errors"; -'use strict'; + /** @module policies/speculativeExecution */ diff --git a/lib/policies/timestamp-generation.ts b/lib/policies/timestamp-generation.ts index cb3b280c..b0869d52 100644 --- a/lib/policies/timestamp-generation.ts +++ b/lib/policies/timestamp-generation.ts @@ -17,7 +17,7 @@ import util from "util"; import { Long } from "../types/index"; import errors from "../errors"; -'use strict'; + /** @module policies/timestampGeneration */ /** diff --git a/lib/prepare-handler.ts b/lib/prepare-handler.ts index 15c38d8a..9fd6177f 100644 --- a/lib/prepare-handler.ts +++ b/lib/prepare-handler.ts @@ -18,7 +18,7 @@ import utils from "./utils"; import types from "./types/index"; import promiseUtils from "./promise-utils"; -'use strict'; + /** * Encapsulates the logic for dealing with the different prepare request and response flows, including failover when diff --git a/lib/promise-utils.ts b/lib/promise-utils.ts index c85b6016..7189b4bf 100644 --- a/lib/promise-utils.ts +++ b/lib/promise-utils.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -'use strict'; + /** * Creates a non-clearable timer that resolves the promise once elapses. diff --git a/lib/readers.ts b/lib/readers.ts index 5aa49116..274c85a3 100644 --- a/lib/readers.ts +++ b/lib/readers.ts @@ -18,7 +18,7 @@ import utils from "./utils"; import types from "./types/index"; import errors from "./errors"; -'use strict'; + /** * Information on the formatting of the returned rows */ diff --git a/lib/request-execution.ts b/lib/request-execution.ts index a7edf36f..b3bf409d 100644 --- a/lib/request-execution.ts +++ b/lib/request-execution.ts @@ -20,7 +20,7 @@ import types from "./types/index"; import utils from "./utils"; import promiseUtils from "./promise-utils"; -'use strict'; + const retryOnCurrentHost = Object.freeze({ decision: retry.RetryPolicy.retryDecision.retry, useCurrentHost: true, diff --git a/lib/request-handler.ts b/lib/request-handler.ts index f14ab685..be16897e 100644 --- a/lib/request-handler.ts +++ b/lib/request-handler.ts @@ -20,7 +20,7 @@ import utils from "./utils"; import RequestExecution from "./request-execution"; import promiseUtils from "./promise-utils"; -'use strict'; + /** * Handles a BATCH, QUERY and EXECUTE request to the server, dealing with host fail-over and retries on error diff --git a/lib/requests.ts b/lib/requests.ts index 92877e1b..50283162 100644 --- a/lib/requests.ts +++ b/lib/requests.ts @@ -20,7 +20,7 @@ import utils from "./utils"; import { ExecutionOptions } from "./execution-options"; import packageInfo from "../package.json" assert {type: 'json'}; -'use strict'; + /** * Options for the execution of the query / prepared statement * @private diff --git a/lib/stream-id-stack.ts b/lib/stream-id-stack.ts index 6eeda569..2bdb6887 100644 --- a/lib/stream-id-stack.ts +++ b/lib/stream-id-stack.ts @@ -15,7 +15,7 @@ */ import types from "./types/index"; -'use strict'; + /** * Group size * @type {number} diff --git a/lib/streams.ts b/lib/streams.ts index 00fc7001..e971929d 100644 --- a/lib/streams.ts +++ b/lib/streams.ts @@ -20,7 +20,7 @@ import utils from "./utils"; import errors from "./errors"; import { FrameReader } from "./readers"; -'use strict'; + const { FrameHeader } = types; /** diff --git a/lib/token.ts b/lib/token.ts index 2dd7830c..e2269127 100644 --- a/lib/token.ts +++ b/lib/token.ts @@ -16,7 +16,7 @@ import types from "./types/index"; import util from "util"; -'use strict'; + const _Murmur3TokenType = types.dataTypes.getByName('bigint'); const _RandomTokenType = types.dataTypes.getByName('varint'); const _OrderedTokenType = types.dataTypes.getByName('blob'); diff --git a/lib/tokenizer.ts b/lib/tokenizer.ts index 2340e2ed..0aaaaa3d 100644 --- a/lib/tokenizer.ts +++ b/lib/tokenizer.ts @@ -18,7 +18,7 @@ import token from "./token"; import utils from "./utils"; import MutableLong from "./types/mutable-long"; -'use strict'; + const { Integer } = types; // Murmur3 constants diff --git a/lib/tracker/index.ts b/lib/tracker/index.ts index 3e11bf53..f028d987 100644 --- a/lib/tracker/index.ts +++ b/lib/tracker/index.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -'use strict'; + /** * Tracker module. diff --git a/lib/tracker/request-logger.ts b/lib/tracker/request-logger.ts index ff42ddae..9e029254 100644 --- a/lib/tracker/request-logger.ts +++ b/lib/tracker/request-logger.ts @@ -18,7 +18,7 @@ import RequestTracker from "./request-tracker"; import errors from "../errors"; import { format } from "util"; -'use strict'; + const nanosToMillis = 1000000; const defaultMessageMaxQueryLength = 500; const defaultMaxParameterValueLength = 50; diff --git a/lib/tracker/request-tracker.ts b/lib/tracker/request-tracker.ts index 71e89119..82d20a71 100644 --- a/lib/tracker/request-tracker.ts +++ b/lib/tracker/request-tracker.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -'use strict'; + /** * Tracks request execution for a {@link Client}. diff --git a/lib/types/big-decimal.ts b/lib/types/big-decimal.ts index 9cc84010..846c1652 100644 --- a/lib/types/big-decimal.ts +++ b/lib/types/big-decimal.ts @@ -16,7 +16,7 @@ import Integer from "./integer"; import utils from "../utils"; -'use strict'; + /** @module types */ /** diff --git a/lib/types/duration.ts b/lib/types/duration.ts index 934e1f58..aa2f1a80 100644 --- a/lib/types/duration.ts +++ b/lib/types/duration.ts @@ -19,7 +19,7 @@ import utils from "../utils"; const VIntCoding = utils.VIntCoding; -'use strict'; + /** @module types */ // Reuse the same buffers that should perform slightly better than built-in buffer pool diff --git a/lib/types/index.ts b/lib/types/index.ts index 04e98430..94665928 100644 --- a/lib/types/index.ts +++ b/lib/types/index.ts @@ -33,7 +33,7 @@ import Tuple from './tuple'; import Vector from "./vector"; -'use strict'; + /** * Consistency levels * @type {Object} diff --git a/lib/types/inet-address.ts b/lib/types/inet-address.ts index 2f819987..9edfcdd6 100644 --- a/lib/types/inet-address.ts +++ b/lib/types/inet-address.ts @@ -15,7 +15,7 @@ */ import utils from "../utils"; -'use strict'; + /** @module types */ /** diff --git a/lib/types/local-date.ts b/lib/types/local-date.ts index 5d32847f..b75be4d4 100644 --- a/lib/types/local-date.ts +++ b/lib/types/local-date.ts @@ -16,7 +16,7 @@ import util from "util"; import utils from "../utils"; -'use strict'; + /** @module types */ /** diff --git a/lib/types/local-time.ts b/lib/types/local-time.ts index cb0b28ab..0c092530 100644 --- a/lib/types/local-time.ts +++ b/lib/types/local-time.ts @@ -17,7 +17,7 @@ import Long from "long"; import util from "util"; import utils from "../utils"; -'use strict'; + /** @module types */ /** diff --git a/lib/types/mutable-long.ts b/lib/types/mutable-long.ts index 8569d056..33546df7 100644 --- a/lib/types/mutable-long.ts +++ b/lib/types/mutable-long.ts @@ -15,7 +15,7 @@ */ import Long from "long"; -"use strict"; + const TWO_PWR_16_DBL = 1 << 16; const TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL; diff --git a/lib/types/protocol-version.ts b/lib/types/protocol-version.ts index 670c4ad1..be271a11 100644 --- a/lib/types/protocol-version.ts +++ b/lib/types/protocol-version.ts @@ -16,7 +16,7 @@ import utils from "../utils"; import VersionNumber from "./version-number"; -'use strict'; + const v200 = VersionNumber.parse('2.0.0'); const v210 = VersionNumber.parse('2.1.0'); const v220 = VersionNumber.parse('2.2.0'); diff --git a/lib/types/result-set.ts b/lib/types/result-set.ts index 453d3b65..2c162d9e 100644 --- a/lib/types/result-set.ts +++ b/lib/types/result-set.ts @@ -16,7 +16,7 @@ import utils from "../utils"; import errors from "../errors"; -'use strict'; + const asyncIteratorSymbol = Symbol.asyncIterator || '@@asyncIterator'; /** @module types */ diff --git a/lib/types/result-stream.ts b/lib/types/result-stream.ts index 736883bb..e121dc64 100644 --- a/lib/types/result-stream.ts +++ b/lib/types/result-stream.ts @@ -18,7 +18,7 @@ import utils from "../utils"; import errors from "../errors"; import clientOptions from "../client-options"; -'use strict'; + /** @module types */ /** diff --git a/lib/types/row.ts b/lib/types/row.ts index 61e957fc..8366fe7d 100644 --- a/lib/types/row.ts +++ b/lib/types/row.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + /** @module types */ /** * Represents a result row diff --git a/lib/types/time-uuid.ts b/lib/types/time-uuid.ts index 6ac83e4e..bb791f87 100644 --- a/lib/types/time-uuid.ts +++ b/lib/types/time-uuid.ts @@ -19,7 +19,7 @@ import Long from "long"; import Uuid from "./uuid"; import utils from "../utils"; -'use strict'; + /** @module types */ /** * Oct 15, 1582 in milliseconds since unix epoch diff --git a/lib/types/tuple.ts b/lib/types/tuple.ts index f3e415f0..da24b05b 100644 --- a/lib/types/tuple.ts +++ b/lib/types/tuple.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -"use strict"; + /** @module types */ diff --git a/lib/types/uuid.ts b/lib/types/uuid.ts index 3fae3346..4ecb9354 100644 --- a/lib/types/uuid.ts +++ b/lib/types/uuid.ts @@ -16,7 +16,7 @@ import crypto from "crypto"; import utils from "../utils"; -'use strict'; + /** @module types */ diff --git a/lib/types/vector.ts b/lib/types/vector.ts index 856a6f75..27351e1d 100644 --- a/lib/types/vector.ts +++ b/lib/types/vector.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -"use strict"; + /** @module types */ /** * Creates a new instance of Cql Vector, also compatible with Float32Array. diff --git a/lib/types/version-number.ts b/lib/types/version-number.ts index bbbe8189..b54e0a52 100644 --- a/lib/types/version-number.ts +++ b/lib/types/version-number.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + const _versionPattern = /(\d+)\.(\d+)(?:\.(\d+))?(?:\.(\d+)?)?(?:[-~]([\w+]*(?:-\w[.\w]*)*))?(?:\+([.\w]+))?/; diff --git a/lib/utils.ts b/lib/utils.ts index e4c8886a..2d74a8ba 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -20,7 +20,7 @@ import { EventEmitter } from "events"; import errors from "./errors"; import promiseUtils from "./promise-utils"; -'use strict'; + /** * Max int that can be accurately represented with 64-bit Number (2^53) * @type {number} diff --git a/lib/writers.ts b/lib/writers.ts index 031ee3fd..d3d6db87 100644 --- a/lib/writers.ts +++ b/lib/writers.ts @@ -17,7 +17,7 @@ import events from "events"; import types from "./types/index"; import utils from "./utils"; -'use strict'; + const FrameHeader = types.FrameHeader; /** diff --git a/test/integration/long/client-metadata-tests.ts b/test/integration/long/client-metadata-tests.ts index 48a7ca83..af2cadf7 100644 --- a/test/integration/long/client-metadata-tests.ts +++ b/test/integration/long/client-metadata-tests.ts @@ -21,7 +21,7 @@ import Client from "../../../lib/client"; import utils from "../../../lib/utils"; import tokenizer from "../../../lib/tokenizer"; -'use strict'; + describe('Client', function () { this.timeout(240000); describe('#getReplicas() with MurmurPartitioner', function () { diff --git a/test/integration/long/event-tests.ts b/test/integration/long/event-tests.ts index 693b9803..61b4a67e 100644 --- a/test/integration/long/event-tests.ts +++ b/test/integration/long/event-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import helper from "../../test-helper"; diff --git a/test/integration/long/load-balancing-tests.ts b/test/integration/long/load-balancing-tests.ts index 72dd989a..12c9c9d1 100644 --- a/test/integration/long/load-balancing-tests.ts +++ b/test/integration/long/load-balancing-tests.ts @@ -20,7 +20,7 @@ import Client from "../../../lib/client"; import utils from "../../../lib/utils"; import loadBalancing from "../../../lib/policies/load-balancing"; -'use strict'; + const DCAwareRoundRobinPolicy = loadBalancing.DCAwareRoundRobinPolicy; const TokenAwarePolicy = loadBalancing.TokenAwarePolicy; diff --git a/test/integration/short/auth/dse-gssapi-auth-provider-tests.ts b/test/integration/short/auth/dse-gssapi-auth-provider-tests.ts index b47934c6..42610859 100644 --- a/test/integration/short/auth/dse-gssapi-auth-provider-tests.ts +++ b/test/integration/short/auth/dse-gssapi-auth-provider-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import DseGssapiAuthProvider from '../../../../lib/auth/dse-gssapi-auth-provider'; import assert from "assert"; import helper from "../../../test-helper"; diff --git a/test/integration/short/auth/dse-plain-text-auth-provider-tests.ts b/test/integration/short/auth/dse-plain-text-auth-provider-tests.ts index ad464314..95f18787 100644 --- a/test/integration/short/auth/dse-plain-text-auth-provider-tests.ts +++ b/test/integration/short/auth/dse-plain-text-auth-provider-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import DsePlainTextAuthProvider from '../../../../lib/auth/dse-plain-text-auth-provider'; import { assert } from "chai"; import helper from "../../../test-helper"; diff --git a/test/integration/short/auth/proxy-authentication-test.ts b/test/integration/short/auth/proxy-authentication-test.ts index ceb0881d..f5b31d87 100644 --- a/test/integration/short/auth/proxy-authentication-test.ts +++ b/test/integration/short/auth/proxy-authentication-test.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import DsePlainTextAuthProvider from '../../../../lib/auth/dse-plain-text-auth-provider'; import DseGssapiAuthProvider from '../../../../lib/auth/dse-gssapi-auth-provider'; import assert from "assert"; diff --git a/test/integration/short/client-batch-tests.ts b/test/integration/short/client-batch-tests.ts index 7c796e6d..6e5c2589 100644 --- a/test/integration/short/client-batch-tests.ts +++ b/test/integration/short/client-batch-tests.ts @@ -21,7 +21,7 @@ import types from "../../../lib/types/index"; import utils from "../../../lib/utils"; import errors from "../../../lib/errors"; -'use strict'; + const vit = helper.vit; describe('Client @SERVER_API', function () { diff --git a/test/integration/short/client-each-row-tests.ts b/test/integration/short/client-each-row-tests.ts index 552cf861..4f49a994 100644 --- a/test/integration/short/client-each-row-tests.ts +++ b/test/integration/short/client-each-row-tests.ts @@ -22,7 +22,7 @@ import utils from "../../../lib/utils"; import errors from "../../../lib/errors"; import { assert } from "chai"; -"use strict"; + const vit = helper.vit; describe('Client', function () { diff --git a/test/integration/short/client-execute-prepared-tests.ts b/test/integration/short/client-execute-prepared-tests.ts index eea63599..2331e20e 100644 --- a/test/integration/short/client-execute-prepared-tests.ts +++ b/test/integration/short/client-execute-prepared-tests.ts @@ -24,7 +24,7 @@ import loadBalancing from "../../../lib/policies/load-balancing"; import numericTests from "./numeric-tests"; import pagingTests from "./paging-tests"; -'use strict'; + const vit = helper.vit; const vdescribe = helper.vdescribe; const Uuid = types.Uuid; diff --git a/test/integration/short/client-execute-simulator-tests.ts b/test/integration/short/client-execute-simulator-tests.ts index 5264dd41..16094ef7 100644 --- a/test/integration/short/client-execute-simulator-tests.ts +++ b/test/integration/short/client-execute-simulator-tests.ts @@ -21,7 +21,7 @@ import errors from "../../../lib/errors"; import { responseErrorCodes } from "../../../lib/types/index"; import Client from "../../../lib/client"; import {AllowListPolicy, DCAwareRoundRobinPolicy} from "../../../lib/policies/load-balancing"; -'use strict'; + const query = "select * from data"; const clusterSize = 3; diff --git a/test/integration/short/client-execute-tests.ts b/test/integration/short/client-execute-tests.ts index aa2cf86e..a2d07012 100644 --- a/test/integration/short/client-execute-tests.ts +++ b/test/integration/short/client-execute-tests.ts @@ -24,7 +24,7 @@ import numericTests from "./numeric-tests"; import pagingTests from "./paging-tests"; import {ExecutionProfile} from "../../../lib/execution-profile"; -'use strict'; + const vit = helper.vit; const vdescribe = helper.vdescribe; describe('Client @SERVER_API', function () { diff --git a/test/integration/short/client-pool-tests.ts b/test/integration/short/client-pool-tests.ts index e6698575..ce436dc7 100644 --- a/test/integration/short/client-pool-tests.ts +++ b/test/integration/short/client-pool-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import { RoundRobinPolicy } from '../../../lib/policies/load-balancing'; import { Murmur3Tokenizer } from '../../../lib/tokenizer'; import { PlainTextAuthProvider } from '../../../lib/auth/index'; diff --git a/test/integration/short/client-stream-tests.ts b/test/integration/short/client-stream-tests.ts index a48107a1..e81a87dd 100644 --- a/test/integration/short/client-stream-tests.ts +++ b/test/integration/short/client-stream-tests.ts @@ -21,7 +21,7 @@ import types from "../../../lib/types/index"; import utils from "../../../lib/utils"; import errors from "../../../lib/errors"; -'use strict'; + const vit = helper.vit; describe('Client', function () { this.timeout(120000); diff --git a/test/integration/short/cloud/cloud-helper.ts b/test/integration/short/cloud/cloud-helper.ts index 16052d80..79af2c48 100644 --- a/test/integration/short/cloud/cloud-helper.ts +++ b/test/integration/short/cloud/cloud-helper.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import path from "path"; import Client from "../../../../lib/client"; import helper from "../../../test-helper"; diff --git a/test/integration/short/cloud/cloud-tests.ts b/test/integration/short/cloud/cloud-tests.ts index c5b36d70..05ba352b 100644 --- a/test/integration/short/cloud/cloud-tests.ts +++ b/test/integration/short/cloud/cloud-tests.ts @@ -25,7 +25,7 @@ import utils from "../../../../lib/utils"; import types from "../../../../lib/types/index"; import promiseUtils from "../../../../lib/promise-utils"; -'use strict'; + const vdescribe = helper.vdescribe; const port = 9042; diff --git a/test/integration/short/concurrent/execute-concurrent-tests.ts b/test/integration/short/concurrent/execute-concurrent-tests.ts index c9da65ec..27aa2aea 100644 --- a/test/integration/short/concurrent/execute-concurrent-tests.ts +++ b/test/integration/short/concurrent/execute-concurrent-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import fs from "fs"; import types from "../../../../lib/types/index"; diff --git a/test/integration/short/connection-tests.ts b/test/integration/short/connection-tests.ts index 771d4be9..f2de4edf 100644 --- a/test/integration/short/connection-tests.ts +++ b/test/integration/short/connection-tests.ts @@ -24,7 +24,7 @@ import { assert } from "chai"; import { defaultOptions } from "../../../lib/client-options"; import { protocolVersion } from "../../../lib/types"; -"use strict"; + const vit = helper.vit; describe('Connection', function () { diff --git a/test/integration/short/control-connection-simulator-tests.ts b/test/integration/short/control-connection-simulator-tests.ts index 52468823..6a04f7c1 100644 --- a/test/integration/short/control-connection-simulator-tests.ts +++ b/test/integration/short/control-connection-simulator-tests.ts @@ -20,7 +20,7 @@ import utils from "../../../lib/utils"; import types from "../../../lib/types/index"; import Client from "../../../lib/client"; -'use strict'; + describe('ControlConnection', function() { this.timeout(5000); diff --git a/test/integration/short/control-connection-tests.ts b/test/integration/short/control-connection-tests.ts index 4adf08fd..b946e68c 100644 --- a/test/integration/short/control-connection-tests.ts +++ b/test/integration/short/control-connection-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import util from "util"; import helper from "../../test-helper"; diff --git a/test/integration/short/custom-payload-tests.ts b/test/integration/short/custom-payload-tests.ts index 19636066..ddff2c4a 100644 --- a/test/integration/short/custom-payload-tests.ts +++ b/test/integration/short/custom-payload-tests.ts @@ -20,7 +20,7 @@ import Client from "../../../lib/client"; import utils from "../../../lib/utils"; import types from "../../../lib/types/index"; -'use strict'; + const vit = helper.vit; describe('custom payload @SERVER_API', function () { diff --git a/test/integration/short/duration-type-tests.ts b/test/integration/short/duration-type-tests.ts index 3b5f5725..cfe53e41 100644 --- a/test/integration/short/duration-type-tests.ts +++ b/test/integration/short/duration-type-tests.ts @@ -19,7 +19,7 @@ import helper from "../../test-helper"; import types from "../../../lib/types/index"; import utils from "../../../lib/utils"; -'use strict'; + const vdescribe = helper.vdescribe; const Duration = types.Duration; diff --git a/test/integration/short/error-simulator-tests.ts b/test/integration/short/error-simulator-tests.ts index 8472ac58..06823524 100644 --- a/test/integration/short/error-simulator-tests.ts +++ b/test/integration/short/error-simulator-tests.ts @@ -22,7 +22,7 @@ import utils from "../../../lib/utils"; import Client from "../../../lib/client"; import { OrderedLoadBalancingPolicy } from "../../test-helper"; -'use strict'; + const query = "select * from data"; describe('Client', function() { diff --git a/test/integration/short/error-tests.ts b/test/integration/short/error-tests.ts index 6c758a00..8df4c2ea 100644 --- a/test/integration/short/error-tests.ts +++ b/test/integration/short/error-tests.ts @@ -20,7 +20,7 @@ import types from "../../../lib/types/index"; import utils from "../../../lib/utils"; import errors from "../../../lib/errors"; -'use strict'; + const protocolVersion = types.protocolVersion; const vdescribe = helper.vdescribe; const vit = helper.vit; diff --git a/test/integration/short/execution-profile-tests.ts b/test/integration/short/execution-profile-tests.ts index bd518647..13d8580a 100644 --- a/test/integration/short/execution-profile-tests.ts +++ b/test/integration/short/execution-profile-tests.ts @@ -22,7 +22,7 @@ import simulacron from "../simulacron"; import { AllowListPolicy, DCAwareRoundRobinPolicy } from "../../../lib/policies/load-balancing"; import { ExecutionProfile } from "../../../lib/execution-profile"; -'use strict'; + describe('ProfileManager', function() { this.timeout(40000); before(done => simulacron.start(done)); diff --git a/test/integration/short/geometry/line-string-tests.ts b/test/integration/short/geometry/line-string-tests.ts index 050a99c7..1e00ae09 100644 --- a/test/integration/short/geometry/line-string-tests.ts +++ b/test/integration/short/geometry/line-string-tests.ts @@ -21,7 +21,7 @@ import geometry from "../../../../lib/geometry/index"; import types from "../../../../lib/types/index"; import utils from "../../../../lib/utils"; -'use strict'; + const vdescribe = helper.vdescribe; const Point = geometry.Point; const LineString = geometry.LineString; diff --git a/test/integration/short/geometry/point-tests.ts b/test/integration/short/geometry/point-tests.ts index d1f00165..54e7eb52 100644 --- a/test/integration/short/geometry/point-tests.ts +++ b/test/integration/short/geometry/point-tests.ts @@ -21,7 +21,7 @@ import geometry from "../../../../lib/geometry/index"; import types from "../../../../lib/types/index"; import utils from "../../../../lib/utils"; -'use strict'; + const vdescribe = helper.vdescribe; const Point = geometry.Point; const Uuid = types.Uuid; diff --git a/test/integration/short/geometry/polygon-tests.ts b/test/integration/short/geometry/polygon-tests.ts index dab66ef4..9b3b5c53 100644 --- a/test/integration/short/geometry/polygon-tests.ts +++ b/test/integration/short/geometry/polygon-tests.ts @@ -21,7 +21,7 @@ import geometry from "../../../../lib/geometry/index"; import types from "../../../../lib/types/index"; import utils from "../../../../lib/utils"; -'use strict'; + const vdescribe = helper.vdescribe; const Point = geometry.Point; const Polygon = geometry.Polygon; diff --git a/test/integration/short/graph/graph-olap-tests.ts b/test/integration/short/graph/graph-olap-tests.ts index 9843265b..8bbe3006 100644 --- a/test/integration/short/graph/graph-olap-tests.ts +++ b/test/integration/short/graph/graph-olap-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import { assert } from "chai"; import util from "util"; import Client from "../../../../lib/client"; diff --git a/test/integration/short/graph/graph-test-helper.ts b/test/integration/short/graph/graph-test-helper.ts index bc1ad647..a03ea17d 100644 --- a/test/integration/short/graph/graph-test-helper.ts +++ b/test/integration/short/graph/graph-test-helper.ts @@ -15,7 +15,7 @@ */ import utils from "../../../../lib/utils"; -'use strict'; + const makeStrictQuery = 'schema.config().option("graph.schema_mode").set("production")'; const allowScansQuery = 'schema.config().option("graph.allow_scan").set("true")'; diff --git a/test/integration/short/graph/graph-tests.ts b/test/integration/short/graph/graph-tests.ts index 62e0d917..676eab20 100644 --- a/test/integration/short/graph/graph-tests.ts +++ b/test/integration/short/graph/graph-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import sinon from "sinon"; import { assert } from "chai"; import util from "util"; diff --git a/test/integration/short/graph/graph-timeout-tests.ts b/test/integration/short/graph/graph-timeout-tests.ts index 29af4f05..4312a4e0 100644 --- a/test/integration/short/graph/graph-timeout-tests.ts +++ b/test/integration/short/graph/graph-timeout-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import errors from "../../../../lib/errors"; import helper from "../../../test-helper"; diff --git a/test/integration/short/graph/graph-with-down-node-tests.ts b/test/integration/short/graph/graph-with-down-node-tests.ts index 29da2873..9a9e4ddf 100644 --- a/test/integration/short/graph/graph-with-down-node-tests.ts +++ b/test/integration/short/graph/graph-with-down-node-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import Client from "../../../../lib/client"; import helper from "../../../test-helper"; diff --git a/test/integration/short/insights-simulator-tests.ts b/test/integration/short/insights-simulator-tests.ts index 059d8b67..4f233adf 100644 --- a/test/integration/short/insights-simulator-tests.ts +++ b/test/integration/short/insights-simulator-tests.ts @@ -20,7 +20,7 @@ import Client from "../../../lib/client"; import utils from "../../../lib/utils"; import InsightsClient from "../../../lib/insights-client"; -'use strict'; + const vdescribe = helper.vdescribe; const insightsRpcQuery = 'CALL InsightsRpc.reportInsight(?)'; diff --git a/test/integration/short/load-balancing-simulator-tests.ts b/test/integration/short/load-balancing-simulator-tests.ts index af08d5dc..40a78d6b 100644 --- a/test/integration/short/load-balancing-simulator-tests.ts +++ b/test/integration/short/load-balancing-simulator-tests.ts @@ -24,7 +24,7 @@ import promiseUtils from "../../../lib/promise-utils"; import { ExecutionProfile } from "../../../lib/execution-profile"; import Client from "../../../lib/client"; -'use strict'; + const { loadBalancing } = policies; const queryOptions = { prepare: true, routingKey: utils.allocBuffer(16), keyspace: 16 }; diff --git a/test/integration/short/load-balancing-tests.ts b/test/integration/short/load-balancing-tests.ts index 78bf4087..b08694ad 100644 --- a/test/integration/short/load-balancing-tests.ts +++ b/test/integration/short/load-balancing-tests.ts @@ -21,7 +21,7 @@ import utils from "../../../lib/utils"; import types from "../../../lib/types/index"; import { RoundRobinPolicy, AllowListPolicy, TokenAwarePolicy} from "../../../lib/policies/load-balancing"; -'use strict'; + const vdescribe = helper.vdescribe; const maxInFlightRequests = 16; diff --git a/test/integration/short/mapping/custom-queries-tests.ts b/test/integration/short/mapping/custom-queries-tests.ts index 11c913bb..7ae3b2e6 100644 --- a/test/integration/short/mapping/custom-queries-tests.ts +++ b/test/integration/short/mapping/custom-queries-tests.ts @@ -19,7 +19,7 @@ import Result from "../../../../lib/mapping/result"; import mapperTestHelper from "./mapper-test-helper"; import helper from "../../../test-helper"; -'use strict'; + const Uuid = types.Uuid; const assertRowMatchesDoc = mapperTestHelper.assertRowMatchesDoc; describe('ModelMapper', function () { diff --git a/test/integration/short/mapping/from-and-to-model-function-tests.ts b/test/integration/short/mapping/from-and-to-model-function-tests.ts index 2230a754..93afd82a 100644 --- a/test/integration/short/mapping/from-and-to-model-function-tests.ts +++ b/test/integration/short/mapping/from-and-to-model-function-tests.ts @@ -19,7 +19,7 @@ import mapperTestHelper from "./mapper-test-helper"; import helper from "../../../test-helper"; import { UnderscoreCqlToCamelCaseMappings } from "../../../../lib/mapping/table-mappings"; -'use strict'; + describe('Mapper', function () { mapperTestHelper.setupOnce(this); diff --git a/test/integration/short/mapping/mapper-test-helper.ts b/test/integration/short/mapping/mapper-test-helper.ts index 8f98aa02..67f1ce30 100644 --- a/test/integration/short/mapping/mapper-test-helper.ts +++ b/test/integration/short/mapping/mapper-test-helper.ts @@ -21,7 +21,7 @@ import Mapper from "../../../../lib/mapping/mapper"; import Client from "../../../../lib/client"; import utils from "../../../../lib/utils"; -'use strict'; + const Uuid = types.Uuid; const UnderscoreCqlToCamelCaseMappings = tableMappingsModule.UnderscoreCqlToCamelCaseMappings; const videoColumnsToProperties = new Map([ ['videoid', 'id'], ['userid', 'userId'], ['added_date', 'addedDate'], diff --git a/test/integration/short/mapping/mapper-tests.ts b/test/integration/short/mapping/mapper-tests.ts index 8f75c26e..ba937413 100644 --- a/test/integration/short/mapping/mapper-tests.ts +++ b/test/integration/short/mapping/mapper-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import types from "../../../../lib/types/index"; import utils from "../../../../lib/utils"; diff --git a/test/integration/short/mapping/model-mapper-tests.ts b/test/integration/short/mapping/model-mapper-tests.ts index 035c9423..a8f68aab 100644 --- a/test/integration/short/mapping/model-mapper-tests.ts +++ b/test/integration/short/mapping/model-mapper-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import util from "util"; import helper from "../../../test-helper"; diff --git a/test/integration/short/metadata-simulator-tests.ts b/test/integration/short/metadata-simulator-tests.ts index 356f8391..4e888982 100644 --- a/test/integration/short/metadata-simulator-tests.ts +++ b/test/integration/short/metadata-simulator-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import utils from "../../../lib/utils"; import types from "../../../lib/types/index"; import simulacron from "../simulacron"; diff --git a/test/integration/short/metadata-tests.ts b/test/integration/short/metadata-tests.ts index dd3bd3c8..f00e9c3d 100644 --- a/test/integration/short/metadata-tests.ts +++ b/test/integration/short/metadata-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -"use strict"; + import helper from "../../test-helper"; import Client from "../../../lib/client"; import utils from "../../../lib/utils"; diff --git a/test/integration/short/numeric-tests.ts b/test/integration/short/numeric-tests.ts index 5237ff8f..31875b9a 100644 --- a/test/integration/short/numeric-tests.ts +++ b/test/integration/short/numeric-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import Client from "../../../lib/client"; import types from "../../../lib/types/index"; import helper from "../../test-helper"; diff --git a/test/integration/short/paging-tests.ts b/test/integration/short/paging-tests.ts index 1a77feaa..8af3a56a 100644 --- a/test/integration/short/paging-tests.ts +++ b/test/integration/short/paging-tests.ts @@ -19,7 +19,7 @@ import types from "../../../lib/types/index"; import helper from "../../test-helper"; import promiseUtils from "../../../lib/promise-utils"; -'use strict'; + // Exported to be called on other fixtures to take advantage from existing setups // Exported to be called on other fixtures to take advantage from existing setups diff --git a/test/integration/short/pool-simulator-tests.ts b/test/integration/short/pool-simulator-tests.ts index d4d50d3f..59f9161f 100644 --- a/test/integration/short/pool-simulator-tests.ts +++ b/test/integration/short/pool-simulator-tests.ts @@ -24,7 +24,7 @@ import promiseUtils from "../../../lib/promise-utils"; import { version } from "../../../index"; import Client from "../../../lib/client"; -'use strict'; + const { distance } = types; const healthResponseCountInterval = 200; diff --git a/test/integration/short/prepare-simulator-tests.ts b/test/integration/short/prepare-simulator-tests.ts index 7d8b3890..9287b24b 100644 --- a/test/integration/short/prepare-simulator-tests.ts +++ b/test/integration/short/prepare-simulator-tests.ts @@ -21,7 +21,7 @@ import helper from "../../test-helper"; import reconnection from "../../../lib/policies/reconnection"; import simulacron from "../simulacron"; -'use strict'; + describe('Client', function () { this.timeout(20000); diff --git a/test/integration/short/retry-simulator-tests.ts b/test/integration/short/retry-simulator-tests.ts index ebb63a45..9d7990c6 100644 --- a/test/integration/short/retry-simulator-tests.ts +++ b/test/integration/short/retry-simulator-tests.ts @@ -21,7 +21,7 @@ import simulacron from "../simulacron"; import helper from "../../test-helper"; import policies from "../../../lib/policies/index"; -'use strict'; + const RetryPolicy = policies.retry.RetryPolicy; const queries = { diff --git a/test/integration/short/search/date-range-tests.ts b/test/integration/short/search/date-range-tests.ts index be587b45..6dafd412 100644 --- a/test/integration/short/search/date-range-tests.ts +++ b/test/integration/short/search/date-range-tests.ts @@ -21,7 +21,7 @@ import types from "../../../../lib/types/index"; import * as dateRangeModule from "../../../../lib/datastax/search/date-range"; import Client from "../../../../lib/client"; -'use strict'; + const vdescribe = helper.vdescribe; const DateRange = dateRangeModule.DateRange; diff --git a/test/integration/short/speculative-execution-simulator-tests.ts b/test/integration/short/speculative-execution-simulator-tests.ts index 7737fa4a..f3063e90 100644 --- a/test/integration/short/speculative-execution-simulator-tests.ts +++ b/test/integration/short/speculative-execution-simulator-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import simulacron from "../simulacron"; import helper from "../../test-helper"; diff --git a/test/integration/short/ssl-tests.ts b/test/integration/short/ssl-tests.ts index bdf55076..9491aa0a 100644 --- a/test/integration/short/ssl-tests.ts +++ b/test/integration/short/ssl-tests.ts @@ -21,7 +21,7 @@ import errors from "../../../lib/errors"; import utils from "../../../lib/utils"; import types from "../../../lib/types/index"; -'use strict'; + describe('Client @SERVER_API', function () { this.timeout(60000); context('with ssl enabled', function () { diff --git a/test/integration/short/timeout-simulator-tests.ts b/test/integration/short/timeout-simulator-tests.ts index 68436500..8aa1e155 100644 --- a/test/integration/short/timeout-simulator-tests.ts +++ b/test/integration/short/timeout-simulator-tests.ts @@ -20,7 +20,7 @@ import promiseUtils from "../../../lib/promise-utils"; import helper from "../../test-helper"; import simulacron from "../simulacron"; -'use strict'; + const { OrderedLoadBalancingPolicy } = helper; const queryDelayedOnNode0 = 'INSERT INTO paused_on_first_node'; diff --git a/test/integration/short/tracker-simulator-tests.ts b/test/integration/short/tracker-simulator-tests.ts index 485d9de5..3b57d2f7 100644 --- a/test/integration/short/tracker-simulator-tests.ts +++ b/test/integration/short/tracker-simulator-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import { assert } from "chai"; import sinon from "sinon"; import tracker from "../../../lib/tracker/index"; diff --git a/test/integration/short/udf-tests.ts b/test/integration/short/udf-tests.ts index 8dc6867c..24207c89 100644 --- a/test/integration/short/udf-tests.ts +++ b/test/integration/short/udf-tests.ts @@ -19,7 +19,7 @@ import Client from "../../../lib/client"; import utils from "../../../lib/utils"; import types from "../../../lib/types/index"; -'use strict'; + const vit = helper.vit; const vdescribe = helper.vdescribe; diff --git a/test/integration/short/vector-tests.ts b/test/integration/short/vector-tests.ts index 4428f7f3..bcdb082a 100644 --- a/test/integration/short/vector-tests.ts +++ b/test/integration/short/vector-tests.ts @@ -19,7 +19,7 @@ import { types } from "../../../index"; import Vector from "../../../lib/types/vector"; import util from "node:util"; -'use strict'; + const vdescribe = helper.vdescribe; vdescribe('5.0.0', 'Vector tests', function () { this.timeout(120000); diff --git a/test/integration/simulacron.ts b/test/integration/simulacron.ts index bdc94695..969cc671 100644 --- a/test/integration/simulacron.ts +++ b/test/integration/simulacron.ts @@ -20,7 +20,7 @@ import fs from "fs"; import utils from "../../lib/utils"; import Client from "../../lib/client"; import { spawn } from "child_process"; -'use strict'; + const simulacronHelper = { _execute: function(processName, params, cb) { diff --git a/test/other/memory/basic-profile.ts b/test/other/memory/basic-profile.ts index 8d7b9e78..8e2ce967 100644 --- a/test/other/memory/basic-profile.ts +++ b/test/other/memory/basic-profile.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import util from "util"; import helper from "../../test-helper"; diff --git a/test/other/memory/profile-keeping-ref.ts b/test/other/memory/profile-keeping-ref.ts index 055def79..f59469aa 100644 --- a/test/other/memory/profile-keeping-ref.ts +++ b/test/other/memory/profile-keeping-ref.ts @@ -19,7 +19,7 @@ import helper from "../../test-helper"; import cassandra from "../../../index"; import utils from "../../../lib/utils"; -'use strict'; + /* eslint-disable no-console, no-undef */ let heapdump; const heapdumpPath = '/var/log/nodejs-driver'; diff --git a/test/test-helper.ts b/test/test-helper.ts index 9d21a96c..9d2415dc 100644 --- a/test/test-helper.ts +++ b/test/test-helper.ts @@ -29,7 +29,7 @@ import { spawn, exec } from "child_process"; import { defaultOptions } from "../lib/client-options"; import Temp from "temp"; -'use strict'; + const temp = Temp.track(true); const Vector = types.Vector; diff --git a/test/unit/address-resolution-tests.ts b/test/unit/address-resolution-tests.ts index f403dba8..522d6dc3 100644 --- a/test/unit/address-resolution-tests.ts +++ b/test/unit/address-resolution-tests.ts @@ -17,7 +17,7 @@ import assert from "assert"; import dns from "dns"; import * as addressResolution from "../../lib/policies/address-resolution"; -'use strict'; + const EC2MultiRegionTranslator = addressResolution.EC2MultiRegionTranslator; describe('EC2MultiRegionTranslator', function () { diff --git a/test/unit/api-tests.ts b/test/unit/api-tests.ts index 95fb30ae..e73712a9 100644 --- a/test/unit/api-tests.ts +++ b/test/unit/api-tests.ts @@ -18,7 +18,7 @@ import api from "../../index"; import auth from "../../lib/auth/index"; import helper from "../test-helper"; -'use strict'; + describe('API', function () { it('should expose auth module', function () { assert.ok(api.auth); diff --git a/test/unit/basic-tests.ts b/test/unit/basic-tests.ts index 3168bf3e..9842050d 100644 --- a/test/unit/basic-tests.ts +++ b/test/unit/basic-tests.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -"use strict"; + import * as auth from '../../lib/auth/index'; import { assert } from "chai"; import sinon from "sinon"; diff --git a/test/unit/big-decimal-tests.ts b/test/unit/big-decimal-tests.ts index 8335ff76..2c8ae9fc 100644 --- a/test/unit/big-decimal-tests.ts +++ b/test/unit/big-decimal-tests.ts @@ -17,7 +17,7 @@ import assert from "assert"; import types from "../../lib/types/index"; import utils from "../../lib/utils"; -'use strict'; + describe('BigDecimal', function () { const BigDecimal = types.BigDecimal; const Integer = types.Integer; diff --git a/test/unit/client-tests.ts b/test/unit/client-tests.ts index d7c60c55..50714618 100644 --- a/test/unit/client-tests.ts +++ b/test/unit/client-tests.ts @@ -29,7 +29,7 @@ import clientOptions from "../../lib/client-options"; import PrepareHandler from "../../lib/prepare-handler"; import {Host, HostMap} from "../../lib/host"; import { ProfileManager, ExecutionProfile } from "../../lib/execution-profile"; -'use strict'; + describe('Client', function () { describe('constructor', function () { it('should throw an exception when contactPoints are not provided', function () { diff --git a/test/unit/cloud/certificate-validation-tests.ts b/test/unit/cloud/certificate-validation-tests.ts index 088df4cf..fd4b02ad 100644 --- a/test/unit/cloud/certificate-validation-tests.ts +++ b/test/unit/cloud/certificate-validation-tests.ts @@ -16,7 +16,7 @@ import { assert } from "chai"; import { checkServerIdentity } from "../../../lib/datastax/cloud/index"; -'use strict'; + describe('checkServerIdentity()', () => { const port = 32598; const sampleHostName = 'host1.datastax.com'; diff --git a/test/unit/concurrent/execute-concurrent-tests.ts b/test/unit/concurrent/execute-concurrent-tests.ts index 17c01bae..1f34bf32 100644 --- a/test/unit/concurrent/execute-concurrent-tests.ts +++ b/test/unit/concurrent/execute-concurrent-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import types from "../../../lib/types/index"; import utils from "../../../lib/utils"; diff --git a/test/unit/connection-tests.ts b/test/unit/connection-tests.ts index 9d729ccb..b16be81d 100644 --- a/test/unit/connection-tests.ts +++ b/test/unit/connection-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import EventEmitter from "events"; import proxyquire from "proxyquire"; diff --git a/test/unit/control-connection-tests.ts b/test/unit/control-connection-tests.ts index 23fd9b58..ce59039f 100644 --- a/test/unit/control-connection-tests.ts +++ b/test/unit/control-connection-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import { assert } from "chai"; import events from "events"; import proxyquire from "proxyquire"; diff --git a/test/unit/default-load-balancing-policy-tests.ts b/test/unit/default-load-balancing-policy-tests.ts index 2733adfd..ab5080a3 100644 --- a/test/unit/default-load-balancing-policy-tests.ts +++ b/test/unit/default-load-balancing-policy-tests.ts @@ -25,7 +25,7 @@ import { ExecutionOptions } from "../../lib/execution-options"; import errors from "../../lib/errors"; import Client from "../../lib/client"; -'use strict'; + const { loadBalancing } = policies; const { DefaultLoadBalancingPolicy } = loadBalancing; const { lastOctetOf } = helper; diff --git a/test/unit/dse-gssapi-auth-provider-tests.ts b/test/unit/dse-gssapi-auth-provider-tests.ts index 761d9700..c6c52efc 100644 --- a/test/unit/dse-gssapi-auth-provider-tests.ts +++ b/test/unit/dse-gssapi-auth-provider-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import DseGssapiAuthProvider from '../../lib/auth/dse-gssapi-auth-provider'; import assert from "assert"; import helper from "../test-helper"; diff --git a/test/unit/dse-plain-text-auth-provider-tests.ts b/test/unit/dse-plain-text-auth-provider-tests.ts index 8c1bab1f..29a89e5f 100644 --- a/test/unit/dse-plain-text-auth-provider-tests.ts +++ b/test/unit/dse-plain-text-auth-provider-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import { Authenticator } from '../../lib/auth/provider'; import DsePlainTextAuthProvider from '../../lib/auth/dse-plain-text-auth-provider'; import assert from "assert"; diff --git a/test/unit/duration-type-tests.ts b/test/unit/duration-type-tests.ts index 45a3e7b4..92b7d912 100644 --- a/test/unit/duration-type-tests.ts +++ b/test/unit/duration-type-tests.ts @@ -18,7 +18,7 @@ import util from "util"; import types from "../../lib/types/index"; import utils from "../../lib/utils"; -'use strict'; + const Duration = types.Duration; const Long = types.Long; diff --git a/test/unit/encoder-tests.ts b/test/unit/encoder-tests.ts index 12c36dd6..424cee51 100644 --- a/test/unit/encoder-tests.ts +++ b/test/unit/encoder-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import { assert } from "chai"; import sinon from "sinon"; import util from "util"; diff --git a/test/unit/encoder-vector-tests.ts b/test/unit/encoder-vector-tests.ts index 3d681558..f68c2a32 100644 --- a/test/unit/encoder-vector-tests.ts +++ b/test/unit/encoder-vector-tests.ts @@ -19,7 +19,7 @@ import { types } from "../../index"; import Vector from "../../lib/types/vector"; import helper from "../test-helper"; -'use strict'; + describe('Vector tests', function () { const encoder = new Encoder(4, {}); diff --git a/test/unit/error-tests.ts b/test/unit/error-tests.ts index 2e430ac0..e8c457e2 100644 --- a/test/unit/error-tests.ts +++ b/test/unit/error-tests.ts @@ -18,7 +18,7 @@ import path from "path"; import errors from "../../lib/errors"; import helper from "../test-helper"; -'use strict'; + const fileName = path.basename(__filename); describe('DriverError', function () { diff --git a/test/unit/event-debouncer-tests.ts b/test/unit/event-debouncer-tests.ts index 5d4c9226..c7619899 100644 --- a/test/unit/event-debouncer-tests.ts +++ b/test/unit/event-debouncer-tests.ts @@ -18,7 +18,7 @@ import sinon from "sinon"; import helper from "../test-helper"; import EventDebouncer from "../../lib/metadata/event-debouncer"; -'use strict'; + describe('EventDebouncer', function () { describe('timeoutElapsed()', function () { it('should set the queue to null', function (done) { diff --git a/test/unit/execution-options-tests.ts b/test/unit/execution-options-tests.ts index 347eabd8..c5a04966 100644 --- a/test/unit/execution-options-tests.ts +++ b/test/unit/execution-options-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import utils from "../../lib/utils"; import types from "../../lib/types/index"; diff --git a/test/unit/execution-profile-tests.ts b/test/unit/execution-profile-tests.ts index 4026d4da..fb75b560 100644 --- a/test/unit/execution-profile-tests.ts +++ b/test/unit/execution-profile-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import clientOptions from "../../lib/client-options"; import types from "../../lib/types/index"; diff --git a/test/unit/geometry/line-string-tests.ts b/test/unit/geometry/line-string-tests.ts index fc1e2234..6f404385 100644 --- a/test/unit/geometry/line-string-tests.ts +++ b/test/unit/geometry/line-string-tests.ts @@ -18,7 +18,7 @@ import helper from "../../test-helper"; import utils from "../../../lib/utils"; import Point from "../../../lib/geometry/point"; import { LineString } from "../../../lib/geometry"; -'use strict'; + describe('LineString', function () { describe('constructor', function () { diff --git a/test/unit/geometry/point-tests.ts b/test/unit/geometry/point-tests.ts index 30d8b72d..709e5615 100644 --- a/test/unit/geometry/point-tests.ts +++ b/test/unit/geometry/point-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import helper from "../../test-helper"; import utils from "../../../lib/utils"; diff --git a/test/unit/geometry/polygon-tests.ts b/test/unit/geometry/polygon-tests.ts index 9de7c240..66c41316 100644 --- a/test/unit/geometry/polygon-tests.ts +++ b/test/unit/geometry/polygon-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import helper from "../../test-helper"; import utils from "../../../lib/utils"; diff --git a/test/unit/graph/executor-tests.ts b/test/unit/graph/executor-tests.ts index ab9d4a3b..cf44be62 100644 --- a/test/unit/graph/executor-tests.ts +++ b/test/unit/graph/executor-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import Client from "../../../lib/client"; import types from "../../../lib/types/index"; diff --git a/test/unit/graph/graph-result-tests.ts b/test/unit/graph/graph-result-tests.ts index 8316abbf..e69983c4 100644 --- a/test/unit/graph/graph-result-tests.ts +++ b/test/unit/graph/graph-result-tests.ts @@ -18,7 +18,7 @@ import utils from "../../../lib/utils"; import ResultSet from "../../../lib/types/result-set"; import GraphResultSet from "../../../lib/datastax/graph/result-set"; -'use strict'; + const resultVertex = getResultSet([ { "gremlin": JSON.stringify({ "result": { diff --git a/test/unit/graph/graphson-tests.ts b/test/unit/graph/graphson-tests.ts index de44de6f..4292008c 100644 --- a/test/unit/graph/graphson-tests.ts +++ b/test/unit/graph/graphson-tests.ts @@ -22,7 +22,7 @@ import types from "../../../lib/types/index"; import utils from "../../../lib/utils"; import geometry from "../../../lib/geometry/index"; -'use strict'; + const { Tuple } = types; const { asInt, asDouble, asTimestamp } = graphModule; diff --git a/test/unit/host-tests.ts b/test/unit/host-tests.ts index 1da9430d..8b3c2b31 100644 --- a/test/unit/host-tests.ts +++ b/test/unit/host-tests.ts @@ -26,7 +26,7 @@ import utils from "../../lib/utils"; import policies from "../../lib/policies/index"; import helper from "../test-helper"; -'use strict'; + const Host = hostModule.Host; const HostMap = hostModule.HostMap; const defaultOptions = clientOptions.defaultOptions(); diff --git a/test/unit/inet-address-tests.ts b/test/unit/inet-address-tests.ts index 27b13576..64bc9ef5 100644 --- a/test/unit/inet-address-tests.ts +++ b/test/unit/inet-address-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import helper from "../test-helper"; import utils from "../../lib/utils"; diff --git a/test/unit/insights-client-tests.ts b/test/unit/insights-client-tests.ts index 1e1d8be1..69bfb52b 100644 --- a/test/unit/insights-client-tests.ts +++ b/test/unit/insights-client-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import os from "os"; import Client from "../../lib/client"; diff --git a/test/unit/license-tests.ts b/test/unit/license-tests.ts index fea052b6..2e6af295 100644 --- a/test/unit/license-tests.ts +++ b/test/unit/license-tests.ts @@ -17,7 +17,7 @@ import assert from "assert"; import path from "path"; import fs from "fs"; -'use strict'; + const licenseHeaderRegex = new RegExp( `/\\* \\* Copyright DataStax, Inc\\. diff --git a/test/unit/load-balancing-tests.ts b/test/unit/load-balancing-tests.ts index 6f6c8c94..012afa35 100644 --- a/test/unit/load-balancing-tests.ts +++ b/test/unit/load-balancing-tests.ts @@ -24,7 +24,7 @@ import utils from "../../lib/utils"; import { ExecutionOptions } from "../../lib/execution-options"; import { AllowListPolicy, LoadBalancingPolicy, TokenAwarePolicy, RoundRobinPolicy, DCAwareRoundRobinPolicy } from "../../lib/policies/load-balancing"; -'use strict'; + describe('RoundRobinPolicy', function () { it('should yield an error when the hosts are not set', function(done) { const policy = new RoundRobinPolicy(); diff --git a/test/unit/mapping/cache-tests.ts b/test/unit/mapping/cache-tests.ts index 9e76cc6f..1bac2683 100644 --- a/test/unit/mapping/cache-tests.ts +++ b/test/unit/mapping/cache-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import Cache from "../../../lib/mapping/cache"; import {q} from "../../../lib/mapping/q"; diff --git a/test/unit/mapping/mapper-tests.ts b/test/unit/mapping/mapper-tests.ts index d6f984cf..0c3c4644 100644 --- a/test/unit/mapping/mapper-tests.ts +++ b/test/unit/mapping/mapper-tests.ts @@ -20,7 +20,7 @@ import ModelMapper from "../../../lib/mapping/model-mapper"; import helper from "../../test-helper"; import mapperTestHelper from "./mapper-unit-test-helper"; -'use strict'; + describe('Mapper', () => { describe('constructor', () => { it('should validate that client is provided', () => { diff --git a/test/unit/mapping/mapper-unit-test-helper.ts b/test/unit/mapping/mapper-unit-test-helper.ts index 398ef890..32c23462 100644 --- a/test/unit/mapping/mapper-unit-test-helper.ts +++ b/test/unit/mapping/mapper-unit-test-helper.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import types from "../../../lib/types/index"; import ModelMapper from "../../../lib/mapping/model-mapper"; diff --git a/test/unit/mapping/mapping-handler-tests.ts b/test/unit/mapping/mapping-handler-tests.ts index 89bcd4b1..6260df53 100644 --- a/test/unit/mapping/mapping-handler-tests.ts +++ b/test/unit/mapping/mapping-handler-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import mapperTestHelper from "./mapper-unit-test-helper"; import MappingHandler from "../../../lib/mapping/mapping-handler"; diff --git a/test/unit/mapping/model-mapper-mutation-tests.ts b/test/unit/mapping/model-mapper-mutation-tests.ts index 850fba00..62f4d0db 100644 --- a/test/unit/mapping/model-mapper-mutation-tests.ts +++ b/test/unit/mapping/model-mapper-mutation-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import types from "../../../lib/types/index"; import helper from "../../test-helper"; diff --git a/test/unit/mapping/model-mapper-select-tests.ts b/test/unit/mapping/model-mapper-select-tests.ts index c4985f4d..59eab03a 100644 --- a/test/unit/mapping/model-mapper-select-tests.ts +++ b/test/unit/mapping/model-mapper-select-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import helper from "../../test-helper"; import mapperTestHelper from "./mapper-unit-test-helper"; diff --git a/test/unit/mapping/model-mapping-info-tests.ts b/test/unit/mapping/model-mapping-info-tests.ts index 819c2d1d..223f32d5 100644 --- a/test/unit/mapping/model-mapping-info-tests.ts +++ b/test/unit/mapping/model-mapping-info-tests.ts @@ -16,7 +16,7 @@ import { assert } from "chai"; import ModelMappingInfo from "../../../lib/mapping/model-mapping-info"; -'use strict'; + describe('ModelMappingInfo', function () { describe('parse()', function () { it('should throw when the model keyspace is not set', () => { diff --git a/test/unit/mapping/result-mapper-tests.ts b/test/unit/mapping/result-mapper-tests.ts index 2f826899..e60a4ba9 100644 --- a/test/unit/mapping/result-mapper-tests.ts +++ b/test/unit/mapping/result-mapper-tests.ts @@ -17,7 +17,7 @@ import { assert } from "chai"; import sinon from "sinon"; import ResultMapper from "../../../lib/mapping/result-mapper"; -'use strict'; + describe('ResultMapper', function () { describe('getSelectAdapter()', function () { it('should return a function that maps row values into object values', () => { diff --git a/test/unit/mapping/result-tests.ts b/test/unit/mapping/result-tests.ts index 01d13c2c..a5aab7de 100644 --- a/test/unit/mapping/result-tests.ts +++ b/test/unit/mapping/result-tests.ts @@ -17,7 +17,7 @@ import assert from "assert"; import Result from "../../../lib/mapping/result"; import util from "util"; -'use strict'; + const expected = [ { id: 1, name: 'name1', adapted: true }, { id: 2, name: 'name2', adapted: true }]; describe('Result', () => { diff --git a/test/unit/mapping/table-mappings-tests.ts b/test/unit/mapping/table-mappings-tests.ts index 2f8f54d2..f01202b3 100644 --- a/test/unit/mapping/table-mappings-tests.ts +++ b/test/unit/mapping/table-mappings-tests.ts @@ -16,7 +16,7 @@ import assert from "assert"; import tableMappingsModule from "../../../lib/mapping/table-mappings"; -'use strict'; + const UnderscoreCqlToCamelCaseMappings = tableMappingsModule.UnderscoreCqlToCamelCaseMappings; describe('UnderscoreCqlToCamelCaseMappings', () => { diff --git a/test/unit/mapping/tree-tests.ts b/test/unit/mapping/tree-tests.ts index 19af59ce..4cab9a3b 100644 --- a/test/unit/mapping/tree-tests.ts +++ b/test/unit/mapping/tree-tests.ts @@ -16,7 +16,7 @@ import assert from "assert"; import Tree from "../../../lib/mapping/tree"; -'use strict'; + describe('Tree', function () { this.timeout(20000); diff --git a/test/unit/metadata-tests.ts b/test/unit/metadata-tests.ts index 84768679..70a88838 100644 --- a/test/unit/metadata-tests.ts +++ b/test/unit/metadata-tests.ts @@ -27,7 +27,7 @@ import utils from "../../lib/utils"; import errors from "../../lib/errors"; import Encoder from "../../lib/encoder"; -'use strict'; + import { Host, HostMap } from "../../lib/host"; import { Murmur3Token, TokenRange } from "../../lib/token"; import SchemaParser from "../../lib/metadata/schema-parser"; diff --git a/test/unit/mutable-long-tests.ts b/test/unit/mutable-long-tests.ts index 3088c611..736f8b76 100644 --- a/test/unit/mutable-long-tests.ts +++ b/test/unit/mutable-long-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -"use strict"; + import assert from "assert"; import Long from "long"; import MutableLong from "../../lib/types/mutable-long"; diff --git a/test/unit/parser-tests.ts b/test/unit/parser-tests.ts index 34a10ed9..d30f1e72 100644 --- a/test/unit/parser-tests.ts +++ b/test/unit/parser-tests.ts @@ -22,7 +22,7 @@ import types from "../../lib/types/index"; import utils from "../../lib/utils"; import helper from "../test-helper"; -'use strict'; + /** * Tests for the transform streams that are involved in the reading of a response */ diff --git a/test/unit/prepare-handler-tests.ts b/test/unit/prepare-handler-tests.ts index b855e013..8e172b90 100644 --- a/test/unit/prepare-handler-tests.ts +++ b/test/unit/prepare-handler-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import { assert } from "chai"; import events from "events"; import helper from "../test-helper"; diff --git a/test/unit/protocol-stream-tests.ts b/test/unit/protocol-stream-tests.ts index 3477a973..b4f68140 100644 --- a/test/unit/protocol-stream-tests.ts +++ b/test/unit/protocol-stream-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import types from "../../lib/types/index"; import utils from "../../lib/utils"; diff --git a/test/unit/protocol-version-tests.ts b/test/unit/protocol-version-tests.ts index 24b38188..8953ac06 100644 --- a/test/unit/protocol-version-tests.ts +++ b/test/unit/protocol-version-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import {protocolVersion} from "../../lib/types"; import {Host} from "../../lib/host"; diff --git a/test/unit/reconnection-test.ts b/test/unit/reconnection-test.ts index b2748159..69b5760b 100644 --- a/test/unit/reconnection-test.ts +++ b/test/unit/reconnection-test.ts @@ -18,7 +18,7 @@ import utils from "../../lib/utils"; import helper from "../test-helper"; import reconnection from "../../lib/policies/reconnection"; -'use strict'; + //project modules describe('ConstantReconnectionPolicy', function () { it('should yield the same wait time', function (done) { diff --git a/test/unit/request-handler-tests.ts b/test/unit/request-handler-tests.ts index b05f7792..55f7bf27 100644 --- a/test/unit/request-handler-tests.ts +++ b/test/unit/request-handler-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import util from "util"; import RequestHandler from "../../lib/request-handler"; diff --git a/test/unit/requests-test.ts b/test/unit/requests-test.ts index 6ef326a5..b87ae6bf 100644 --- a/test/unit/requests-test.ts +++ b/test/unit/requests-test.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import requests from "../../lib/requests"; import Encoder from "../../lib/encoder"; diff --git a/test/unit/result-set-tests.ts b/test/unit/result-set-tests.ts index 8415b337..26c436f0 100644 --- a/test/unit/result-set-tests.ts +++ b/test/unit/result-set-tests.ts @@ -19,7 +19,7 @@ import utils from "../../lib/utils"; import types from "../../lib/types/index"; import helper from "../test-helper"; -'use strict'; + const { ResultSet } = types; describe('ResultSet', function () { diff --git a/test/unit/retry-policy-tests.ts b/test/unit/retry-policy-tests.ts index 7324a60f..14b08107 100644 --- a/test/unit/retry-policy-tests.ts +++ b/test/unit/retry-policy-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import types from "../../lib/types/index"; import policies from "../../lib/policies/index"; diff --git a/test/unit/search/date-range-tests.ts b/test/unit/search/date-range-tests.ts index c2aa1a95..d0831b74 100644 --- a/test/unit/search/date-range-tests.ts +++ b/test/unit/search/date-range-tests.ts @@ -18,7 +18,7 @@ import util from "util"; import helper from "../../test-helper"; import * as dateRangeModule from "../../../lib/datastax/search/date-range"; -'use strict'; + const DateRange = dateRangeModule.DateRange; const DateRangeBound = dateRangeModule.DateRangeBound; const unbounded = dateRangeModule.unbounded; diff --git a/test/unit/speculative-execution-tests.ts b/test/unit/speculative-execution-tests.ts index a34317e5..9e283cba 100644 --- a/test/unit/speculative-execution-tests.ts +++ b/test/unit/speculative-execution-tests.ts @@ -16,7 +16,7 @@ import helper from "../test-helper"; import specExecModule from "../../lib/policies/speculative-execution"; -'use strict'; + describe('NoSpeculativeExecutionPolicy', () => { describe('#getOptions()', () => { it('should return an empty Map', () => { diff --git a/test/unit/stream-id-stack-tests.ts b/test/unit/stream-id-stack-tests.ts index c67c918f..81fe2449 100644 --- a/test/unit/stream-id-stack-tests.ts +++ b/test/unit/stream-id-stack-tests.ts @@ -17,7 +17,7 @@ import sinon from "sinon"; import assert from "assert"; import StreamIdStack from "../../lib/stream-id-stack"; -"use strict"; + describe('StreamIdStack', function () { let clock; diff --git a/test/unit/timestamp-tests.ts b/test/unit/timestamp-tests.ts index 432d5126..2fde97d7 100644 --- a/test/unit/timestamp-tests.ts +++ b/test/unit/timestamp-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import helper from "../test-helper"; import { MonotonicTimestampGenerator } from "../../lib/policies/timestamp-generation"; diff --git a/test/unit/token-tests.ts b/test/unit/token-tests.ts index abe08385..7d578c40 100644 --- a/test/unit/token-tests.ts +++ b/test/unit/token-tests.ts @@ -17,7 +17,7 @@ import tokenizer from "../../lib/tokenizer"; import token from "../../lib/token"; import assert from "assert"; -'use strict'; + class TokenTester { constructor(tokenizer) { diff --git a/test/unit/tokenizer-tests.ts b/test/unit/tokenizer-tests.ts index d31d69c7..f730e019 100644 --- a/test/unit/tokenizer-tests.ts +++ b/test/unit/tokenizer-tests.ts @@ -21,7 +21,7 @@ import utils from "../../lib/utils"; import MutableLong from "../../lib/types/mutable-long"; import helper from "../test-helper"; -'use strict'; + const Murmur3Tokenizer = tokenizer.Murmur3Tokenizer; const RandomTokenizer = tokenizer.RandomTokenizer; const ByteOrderedTokenizer = tokenizer.ByteOrderedTokenizer; diff --git a/test/unit/tracker-tests.ts b/test/unit/tracker-tests.ts index ba9a7351..ca54bb91 100644 --- a/test/unit/tracker-tests.ts +++ b/test/unit/tracker-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import helper from "../test-helper"; import types from "../../lib/types/index"; diff --git a/test/unit/typescript/api-generation-test.ts b/test/unit/typescript/api-generation-test.ts index cb6f94c5..a7fd0d65 100644 --- a/test/unit/typescript/api-generation-test.ts +++ b/test/unit/typescript/api-generation-test.ts @@ -47,7 +47,7 @@ export function generate(): void { * limitations under the License. */ -'use strict'; + import { auth, concurrent, errors, datastax, mapping, geometry, metadata, metrics, policies, tracker, types } from "../../../index"; import * as root from "../../../index"; diff --git a/test/unit/utils-tests.ts b/test/unit/utils-tests.ts index f4c14e20..2322f7a7 100644 --- a/test/unit/utils-tests.ts +++ b/test/unit/utils-tests.ts @@ -18,7 +18,7 @@ import sinon from "sinon"; import utils from "../../lib/utils"; import helper from "../test-helper"; -'use strict'; + const AddressResolver = utils.AddressResolver; describe('utils', function () { diff --git a/test/unit/uuid-tests.ts b/test/unit/uuid-tests.ts index 8c34d49a..f0efd1df 100644 --- a/test/unit/uuid-tests.ts +++ b/test/unit/uuid-tests.ts @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -'use strict'; + import assert from "assert"; import helper from "../test-helper"; import utils from "../../lib/utils"; diff --git a/test/unit/version-number-tests.ts b/test/unit/version-number-tests.ts index f7f02008..9e90cba9 100644 --- a/test/unit/version-number-tests.ts +++ b/test/unit/version-number-tests.ts @@ -16,7 +16,7 @@ import assert from "assert"; import VersionNumber from "../../lib/types/version-number"; -'use strict'; + describe('VersionNumber', () => { describe('#parse()', () => { it('should parse release version', validateVersion('3.0.13', 3, 0, 13)); From 73ddf859e706b0d5e6c83c77c7f3949e48ce0663 Mon Sep 17 00:00:00 2001 From: janehe Date: Wed, 12 Mar 2025 23:43:20 -0700 Subject: [PATCH 16/19] revert package name --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d1f8b78a..334b7364 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "@SiyaoIsHiding/cassandra-driver", - "version": "0.0.8", + "name": "cassandra-driver", + "version": "4.8.0", "description": "DataStax Node.js Driver for Apache Cassandra", "author": "DataStax", "keywords": [ From 9a3050915953698a2c3b9fb64789866df1103e62 Mon Sep 17 00:00:00 2001 From: janehe Date: Wed, 12 Mar 2025 23:44:13 -0700 Subject: [PATCH 17/19] Fixing indentation --- lib/auth/provider.ts | 2 +- lib/datastax/graph/type-serializers.ts | 48 ++--- lib/datastax/index.ts | 4 +- lib/datastax/search/date-range.ts | 2 +- lib/errors.ts | 2 +- lib/geometry/index.ts | 20 +- lib/mapping/index.ts | 40 ++-- lib/mapping/q.ts | 4 +- lib/mapping/table-mappings.ts | 4 +- lib/metadata/schema-parser.ts | 2 +- lib/policies/address-resolution.ts | 2 +- lib/policies/index.ts | 28 +-- lib/policies/reconnection.ts | 10 +- lib/policies/retry.ts | 4 +- lib/policies/speculative-execution.ts | 4 +- lib/policies/timestamp-generation.ts | 4 +- lib/streams.ts | 4 +- lib/token.ts | 4 +- lib/tokenizer.ts | 4 +- lib/tracker/index.ts | 12 +- lib/types/index.ts | 4 +- lib/types/integer.ts | 270 ++++++++++++------------- 22 files changed, 239 insertions(+), 239 deletions(-) diff --git a/lib/auth/provider.ts b/lib/auth/provider.ts index a410b9ed..6af902d5 100644 --- a/lib/auth/provider.ts +++ b/lib/auth/provider.ts @@ -78,4 +78,4 @@ Authenticator.prototype.onAuthenticationSuccess = function (token) { export { Authenticator, AuthProvider -} \ No newline at end of file +}; \ No newline at end of file diff --git a/lib/datastax/graph/type-serializers.ts b/lib/datastax/graph/type-serializers.ts index c0cdc8ed..eaef5ff0 100644 --- a/lib/datastax/graph/type-serializers.ts +++ b/lib/datastax/graph/type-serializers.ts @@ -78,22 +78,22 @@ class NumberSerializer extends TypeSerializer { [typeKey]: 'g:Double', [valueKey]: '-Infinity' }; - } else { - return item; - } + } + return item; + } deserialize(obj) { - var val = obj[valueKey]; + const val = obj[valueKey]; if (val === 'NaN') { return NaN; } else if (val === 'Infinity') { return Number.POSITIVE_INFINITY; } else if (val === '-Infinity') { return Number.NEGATIVE_INFINITY; - } else { - return parseFloat(val); - } + } + return parseFloat(val); + } canBeUsedFor(value) { @@ -377,9 +377,9 @@ class TSerializer extends TypeSerializer { } class DirectionSerializer extends TypeSerializer { - deserialize(obj) { - return t.direction[obj[valueKey].toLowerCase()]; - } + deserialize(obj) { + return t.direction[obj[valueKey].toLowerCase()]; + } } class ArraySerializer extends TypeSerializer { @@ -411,22 +411,22 @@ class ArraySerializer extends TypeSerializer { class BulkSetSerializer extends TypeSerializer { deserialize(obj) { - const value = obj[valueKey]; - if (!Array.isArray(value)) { - throw new Error('Expected Array, obtained: ' + value); - } + const value = obj[valueKey]; + if (!Array.isArray(value)) { + throw new Error('Expected Array, obtained: ' + value); + } - // coerce the BulkSet to List. if the bulk exceeds the int space then we can't coerce to List anyway, - // so this query will be trouble. we'd need a legit BulkSet implementation here in js. this current - // implementation is here to replicate the previous functionality that existed on the server side in - // previous versions. - let result = []; - for (let ix = 0, iy = value.length; ix < iy; ix += 2) { - const pair = value.slice(ix, ix + 2); - result = result.concat(Array(this.reader.read(pair[1])).fill(this.reader.read(pair[0]))); - } + // coerce the BulkSet to List. if the bulk exceeds the int space then we can't coerce to List anyway, + // so this query will be trouble. we'd need a legit BulkSet implementation here in js. this current + // implementation is here to replicate the previous functionality that existed on the server side in + // previous versions. + let result = []; + for (let ix = 0, iy = value.length; ix < iy; ix += 2) { + const pair = value.slice(ix, ix + 2); + result = result.concat(Array(this.reader.read(pair[1])).fill(this.reader.read(pair[0]))); + } - return result; + return result; } } diff --git a/lib/datastax/index.ts b/lib/datastax/index.ts index 7b413572..5fd4ba79 100644 --- a/lib/datastax/index.ts +++ b/lib/datastax/index.ts @@ -28,7 +28,7 @@ import graph from "./graph/index"; import { DateRange } from "./search/index"; export default { - graph, - DateRange + graph, + DateRange }; diff --git a/lib/datastax/search/date-range.ts b/lib/datastax/search/date-range.ts index 1951af12..1a39fba4 100644 --- a/lib/datastax/search/date-range.ts +++ b/lib/datastax/search/date-range.ts @@ -535,4 +535,4 @@ export { dateRangePrecision, DateRange, DateRangeBound -} \ No newline at end of file +}; \ No newline at end of file diff --git a/lib/errors.ts b/lib/errors.ts index ff62203b..a84ac9b4 100644 --- a/lib/errors.ts +++ b/lib/errors.ts @@ -189,4 +189,4 @@ export default { NotSupportedError, ResponseError, VIntOutOfRangeException -} \ No newline at end of file +}; \ No newline at end of file diff --git a/lib/geometry/index.ts b/lib/geometry/index.ts index 90c62f48..e9c97c2e 100644 --- a/lib/geometry/index.ts +++ b/lib/geometry/index.ts @@ -30,15 +30,15 @@ import Polygon from './polygon'; import Geometry from './geometry'; export default { - Point, - LineString, - Polygon, - Geometry -} + Point, + LineString, + Polygon, + Geometry +}; export { - Point, - LineString, - Polygon, - Geometry -} \ No newline at end of file + Point, + LineString, + Polygon, + Geometry +}; \ No newline at end of file diff --git a/lib/mapping/index.ts b/lib/mapping/index.ts index cf2ff094..bd8af8a2 100644 --- a/lib/mapping/index.ts +++ b/lib/mapping/index.ts @@ -29,25 +29,25 @@ import {TableMappings, DefaultTableMappings, UnderscoreCqlToCamelCaseMappings} f */ export { - Mapper, - ModelMapper, - ModelBatchMapper, - ModelBatchItem, - Result, - TableMappings, - DefaultTableMappings, - UnderscoreCqlToCamelCaseMappings, - q -} + Mapper, + ModelMapper, + ModelBatchMapper, + ModelBatchItem, + Result, + TableMappings, + DefaultTableMappings, + UnderscoreCqlToCamelCaseMappings, + q +}; export default { - Mapper, - ModelMapper, - ModelBatchMapper, - ModelBatchItem, - Result, - TableMappings, - DefaultTableMappings, - UnderscoreCqlToCamelCaseMappings, - q -} \ No newline at end of file + Mapper, + ModelMapper, + ModelBatchMapper, + ModelBatchItem, + Result, + TableMappings, + DefaultTableMappings, + UnderscoreCqlToCamelCaseMappings, + q +}; \ No newline at end of file diff --git a/lib/mapping/q.ts b/lib/mapping/q.ts index d63c5149..b9c565aa 100644 --- a/lib/mapping/q.ts +++ b/lib/mapping/q.ts @@ -152,10 +152,10 @@ export default { q, QueryAssignment, QueryOperator, -} +}; export { q, QueryAssignment, QueryOperator, -} \ No newline at end of file +}; \ No newline at end of file diff --git a/lib/mapping/table-mappings.ts b/lib/mapping/table-mappings.ts index 4966039e..94ed0ff0 100644 --- a/lib/mapping/table-mappings.ts +++ b/lib/mapping/table-mappings.ts @@ -121,10 +121,10 @@ export default { TableMappings, UnderscoreCqlToCamelCaseMappings, DefaultTableMappings -} +}; export { TableMappings, UnderscoreCqlToCamelCaseMappings, DefaultTableMappings -} \ No newline at end of file +}; \ No newline at end of file diff --git a/lib/metadata/schema-parser.ts b/lib/metadata/schema-parser.ts index e9760b13..faf6de20 100644 --- a/lib/metadata/schema-parser.ts +++ b/lib/metadata/schema-parser.ts @@ -1176,4 +1176,4 @@ function getByVersion(options, cc, udtResolver, version, currentInstance) { export default { getByVersion, isDoneForToken -} \ No newline at end of file +}; \ No newline at end of file diff --git a/lib/policies/address-resolution.ts b/lib/policies/address-resolution.ts index 93f1b4fe..27a3036b 100644 --- a/lib/policies/address-resolution.ts +++ b/lib/policies/address-resolution.ts @@ -140,4 +140,4 @@ EC2MultiRegionTranslator.prototype.logError = function (address, err) { export { AddressTranslator, EC2MultiRegionTranslator -} \ No newline at end of file +}; \ No newline at end of file diff --git a/lib/policies/index.ts b/lib/policies/index.ts index 158db734..98062c14 100644 --- a/lib/policies/index.ts +++ b/lib/policies/index.ts @@ -85,19 +85,19 @@ const defaultTimestampGenerator = function () { */ export { - addressResolution, - loadBalancing, - reconnection, - retry, - speculativeExecution, - timestampGeneration, - defaultAddressTranslator, - defaultLoadBalancingPolicy, - defaultRetryPolicy, - defaultReconnectionPolicy, - defaultSpeculativeExecutionPolicy, - defaultTimestampGenerator -} + addressResolution, + loadBalancing, + reconnection, + retry, + speculativeExecution, + timestampGeneration, + defaultAddressTranslator, + defaultLoadBalancingPolicy, + defaultRetryPolicy, + defaultReconnectionPolicy, + defaultSpeculativeExecutionPolicy, + defaultTimestampGenerator +}; export default { addressResolution, @@ -112,4 +112,4 @@ export default { defaultReconnectionPolicy, defaultSpeculativeExecutionPolicy, defaultTimestampGenerator -} +}; diff --git a/lib/policies/reconnection.ts b/lib/policies/reconnection.ts index beb18c4e..14fcfc32 100644 --- a/lib/policies/reconnection.ts +++ b/lib/policies/reconnection.ts @@ -154,13 +154,13 @@ ExponentialReconnectionPolicy.prototype.getOptions = function () { }; export { - ReconnectionPolicy, - ConstantReconnectionPolicy, - ExponentialReconnectionPolicy -} + ReconnectionPolicy, + ConstantReconnectionPolicy, + ExponentialReconnectionPolicy +}; export default { ReconnectionPolicy, ConstantReconnectionPolicy, ExponentialReconnectionPolicy -} \ No newline at end of file +}; \ No newline at end of file diff --git a/lib/policies/retry.ts b/lib/policies/retry.ts index 2a7fa042..cdaeb51c 100644 --- a/lib/policies/retry.ts +++ b/lib/policies/retry.ts @@ -275,10 +275,10 @@ export { IdempotenceAwareRetryPolicy, FallthroughRetryPolicy, RetryPolicy -} +}; export default { IdempotenceAwareRetryPolicy, FallthroughRetryPolicy, RetryPolicy -} \ No newline at end of file +}; \ No newline at end of file diff --git a/lib/policies/speculative-execution.ts b/lib/policies/speculative-execution.ts index 56fc5b02..201a825b 100644 --- a/lib/policies/speculative-execution.ts +++ b/lib/policies/speculative-execution.ts @@ -142,10 +142,10 @@ export { NoSpeculativeExecutionPolicy, SpeculativeExecutionPolicy, ConstantSpeculativeExecutionPolicy -} +}; export default{ NoSpeculativeExecutionPolicy, SpeculativeExecutionPolicy, ConstantSpeculativeExecutionPolicy -} \ No newline at end of file +}; \ No newline at end of file diff --git a/lib/policies/timestamp-generation.ts b/lib/policies/timestamp-generation.ts index b0869d52..c91fd4c2 100644 --- a/lib/policies/timestamp-generation.ts +++ b/lib/policies/timestamp-generation.ts @@ -168,9 +168,9 @@ MonotonicTimestampGenerator.prototype._generateMicroseconds = function () { export { TimestampGenerator, MonotonicTimestampGenerator -} +}; export default{ TimestampGenerator, MonotonicTimestampGenerator -} \ No newline at end of file +}; \ No newline at end of file diff --git a/lib/streams.ts b/lib/streams.ts index e971929d..7dd07159 100644 --- a/lib/streams.ts +++ b/lib/streams.ts @@ -579,9 +579,9 @@ export { Protocol, Parser, ResultEmitter -} +}; export default { Protocol, Parser, ResultEmitter -} \ No newline at end of file +}; \ No newline at end of file diff --git a/lib/token.ts b/lib/token.ts index e2269127..29a9c14b 100644 --- a/lib/token.ts +++ b/lib/token.ts @@ -284,7 +284,7 @@ export { ByteOrderedToken, Murmur3Token, RandomToken -} +}; export default { Token, @@ -292,4 +292,4 @@ export default { ByteOrderedToken, Murmur3Token, RandomToken -} \ No newline at end of file +}; \ No newline at end of file diff --git a/lib/tokenizer.ts b/lib/tokenizer.ts index 0aaaaa3d..8544f024 100644 --- a/lib/tokenizer.ts +++ b/lib/tokenizer.ts @@ -583,10 +583,10 @@ export { Murmur3Tokenizer, RandomTokenizer, ByteOrderedTokenizer -} +}; export default { Murmur3Tokenizer, RandomTokenizer, ByteOrderedTokenizer -} \ No newline at end of file +}; \ No newline at end of file diff --git a/lib/tracker/index.ts b/lib/tracker/index.ts index f028d987..4faeb356 100644 --- a/lib/tracker/index.ts +++ b/lib/tracker/index.ts @@ -24,10 +24,10 @@ import RequestTracker from "./request-tracker"; import RequestLogger from "./request-logger"; export { - RequestTracker, - RequestLogger -} + RequestTracker, + RequestLogger +}; export default { - RequestTracker, - RequestLogger -} \ No newline at end of file + RequestTracker, + RequestLogger +}; \ No newline at end of file diff --git a/lib/types/index.ts b/lib/types/index.ts index 94665928..567cb741 100644 --- a/lib/types/index.ts +++ b/lib/types/index.ts @@ -653,7 +653,7 @@ export { unset, generateTimestamp, Vector -} +}; export default { opcodes, @@ -688,4 +688,4 @@ export default { unset, generateTimestamp, Vector -} +}; diff --git a/lib/types/integer.ts b/lib/types/integer.ts index ae7e2539..94d0f014 100644 --- a/lib/types/integer.ts +++ b/lib/types/integer.ts @@ -50,9 +50,9 @@ function Integer (bits, sign) { // Copy the 32-bit signed integer values passed in. We prune out those at the // top that equal the sign since they are redundant. - var top = true; - for (var i = bits.length - 1; i >= 0; i--) { - var val = bits[i] | 0; + let top = true; + for (let i = bits.length - 1; i >= 0; i--) { + const val = bits[i] | 0; if (!top || val != sign) { this.bits_[i] = val; top = false; @@ -79,15 +79,15 @@ Integer.IntCache_ = {}; * @return {!Integer} The corresponding Integer value. */ Integer.fromInt = function(value) { - if (-128 <= value && value < 128) { - var cachedObj = Integer.IntCache_[value]; + if (value >= -128 && value < 128) { + const cachedObj = Integer.IntCache_[value]; if (cachedObj) { return cachedObj; } } - var obj = new Integer([value | 0], value < 0 ? -1 : 0); - if (-128 <= value && value < 128) { + const obj = new Integer([value | 0], value < 0 ? -1 : 0); + if (value >= -128 && value < 128) { Integer.IntCache_[value] = obj; } return obj; @@ -105,15 +105,15 @@ Integer.fromNumber = function(value) { return Integer.ZERO; } else if (value < 0) { return Integer.fromNumber(-value).negate(); - } else { - var bits = []; - var pow = 1; - for (var i = 0; value >= pow; i++) { - bits[i] = (value / pow) | 0; - pow *= Integer.TWO_PWR_32_DBL_; - } - return new Integer(bits, 0); + } + const bits = []; + let pow = 1; + for (let i = 0; value >= pow; i++) { + bits[i] = (value / pow) | 0; + pow *= Integer.TWO_PWR_32_DBL_; } + return new Integer(bits, 0); + }; @@ -127,7 +127,7 @@ Integer.fromNumber = function(value) { * @return {!Integer} The corresponding Integer value. */ Integer.fromBits = function(bits) { - var high = bits[bits.length - 1]; + const high = bits[bits.length - 1]; //noinspection JSBitwiseOperatorUsage return new Integer(bits, high & (1 << 31) ? -1 : 0); }; @@ -145,8 +145,8 @@ Integer.fromString = function(str, opt_radix) { throw TypeError('number format error: empty string'); } - var radix = opt_radix || 10; - if (radix < 2 || 36 < radix) { + const radix = opt_radix || 10; + if (radix < 2 || radix > 36) { throw Error('radix out of range: ' + radix); } @@ -158,14 +158,14 @@ Integer.fromString = function(str, opt_radix) { // Do several (8) digits each time through the loop, so as to // minimize the calls to the very expensive emulated div. - var radixToPower = Integer.fromNumber(Math.pow(radix, 8)); + const radixToPower = Integer.fromNumber(Math.pow(radix, 8)); - var result = Integer.ZERO; - for (var i = 0; i < str.length; i += 8) { - var size = Math.min(8, str.length - i); - var value = parseInt(str.substring(i, i + size), radix); + let result = Integer.ZERO; + for (let i = 0; i < str.length; i += 8) { + const size = Math.min(8, str.length - i); + const value = parseInt(str.substring(i, i + size), radix); if (size < 8) { - var power = Integer.fromNumber(Math.pow(radix, size)); + const power = Integer.fromNumber(Math.pow(radix, size)); result = result.multiply(power).add(Integer.fromNumber(value)); } else { result = result.multiply(radixToPower); @@ -182,18 +182,18 @@ Integer.fromString = function(str, opt_radix) { * @returns {Integer} */ Integer.fromBuffer = function (buf) { - var bits = new Array(Math.ceil(buf.length / 4)); + const bits = new Array(Math.ceil(buf.length / 4)); //noinspection JSBitwiseOperatorUsage - var sign = buf[0] & (1 << 7) ? -1 : 0; - for (var i = 0; i < bits.length; i++) { - var offset = buf.length - ((i + 1) * 4); + const sign = buf[0] & (1 << 7) ? -1 : 0; + for (let i = 0; i < bits.length; i++) { + let offset = buf.length - ((i + 1) * 4); var value; if (offset < 0) { //The buffer length is not multiple of 4 offset = offset + 4; value = 0; - for (var j = 0; j < offset; j++) { - var byte = buf[j]; + for (let j = 0; j < offset; j++) { + let byte = buf[j]; if (sign === -1) { //invert the bits byte = ~byte & 0xff; @@ -222,18 +222,18 @@ Integer.fromBuffer = function (buf) { * @returns {Buffer} */ Integer.toBuffer = function (value) { - var sign = value.sign_; - var bits = value.bits_; + const sign = value.sign_; + const bits = value.bits_; if (bits.length === 0) { //[0] or [0xffffffff] return utils.allocBufferFromArray([value.sign_]); } //the high bits might need to be represented in less than 4 bytes - var highBits = bits[bits.length-1]; + let highBits = bits[bits.length-1]; if (sign === -1) { highBits = ~highBits; } - var high = []; + const high = []; if (highBits >>> 24 > 0) { high.push((highBits >> 24) & 0xff); } @@ -255,9 +255,9 @@ Integer.toBuffer = function (value) { //its positive but it lost the byte containing the sign bit high.unshift(0); } - var buf = utils.allocBufferUnsafe(high.length + ((bits.length-1) * 4)); - for (var j = 0; j < high.length; j++) { - var b = high[j]; + const buf = utils.allocBufferUnsafe(high.length + ((bits.length-1) * 4)); + for (let j = 0; j < high.length; j++) { + const b = high[j]; if (sign === -1) { buf[j] = ~b; } @@ -265,9 +265,9 @@ Integer.toBuffer = function (value) { buf[j] = b; } } - for (var i = 0; i < bits.length - 1; i++) { - var group = bits[bits.length - 2 - i]; - var offset = high.length + i * 4; + for (let i = 0; i < bits.length - 1; i++) { + const group = bits[bits.length - 2 - i]; + const offset = high.length + i * 4; buf.writeInt32BE(group, offset); } return buf; @@ -311,15 +311,15 @@ Integer.prototype.toInt = function() { Integer.prototype.toNumber = function() { if (this.isNegative()) { return -this.negate().toNumber(); - } else { - var val = 0; - var pow = 1; - for (var i = 0; i < this.bits_.length; i++) { - val += this.getBitsUnsigned(i) * pow; - pow *= Integer.TWO_PWR_32_DBL_; - } - return val; + } + let val = 0; + let pow = 1; + for (let i = 0; i < this.bits_.length; i++) { + val += this.getBitsUnsigned(i) * pow; + pow *= Integer.TWO_PWR_32_DBL_; } + return val; + }; @@ -329,8 +329,8 @@ Integer.prototype.toNumber = function() { * @override */ Integer.prototype.toString = function(opt_radix) { - var radix = opt_radix || 10; - if (radix < 2 || 36 < radix) { + const radix = opt_radix || 10; + if (radix < 2 || radix > 36) { throw Error('radix out of range: ' + radix); } @@ -342,24 +342,24 @@ Integer.prototype.toString = function(opt_radix) { // Do several (6) digits each time through the loop, so as to // minimize the calls to the very expensive emulated div. - var radixToPower = Integer.fromNumber(Math.pow(radix, 6)); + const radixToPower = Integer.fromNumber(Math.pow(radix, 6)); - var rem = this; - var result = ''; + let rem = this; + let result = ''; while (true) { - var remDiv = rem.divide(radixToPower); - var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt(); - var digits = intval.toString(radix); + const remDiv = rem.divide(radixToPower); + const intval = rem.subtract(remDiv.multiply(radixToPower)).toInt(); + let digits = intval.toString(radix); rem = remDiv; if (rem.isZero()) { return digits + result; - } else { - while (digits.length < 6) { - digits = '0' + digits; - } - result = '' + digits + result; + } + while (digits.length < 6) { + digits = '0' + digits; } + result = '' + digits + result; + } }; @@ -372,12 +372,12 @@ Integer.prototype.toString = function(opt_radix) { */ Integer.prototype.getBits = function(index) { if (index < 0) { - return 0; // Allowing this simplifies bit shifting operations below... + return 0; // Allowing this simplifies bit shifting operations below... } else if (index < this.bits_.length) { return this.bits_[index]; - } else { - return this.sign_; - } + } + return this.sign_; + }; @@ -387,7 +387,7 @@ Integer.prototype.getBits = function(index) { * @return {number} The requested 32-bits as an unsigned number. */ Integer.prototype.getBitsUnsigned = function(index) { - var val = this.getBits(index); + const val = this.getBits(index); return val >= 0 ? val : Integer.TWO_PWR_32_DBL_ + val; }; @@ -403,7 +403,7 @@ Integer.prototype.isZero = function() { if (this.sign_ != 0) { return false; } - for (var i = 0; i < this.bits_.length; i++) { + for (let i = 0; i < this.bits_.length; i++) { if (this.bits_[i] != 0) { return false; } @@ -433,8 +433,8 @@ Integer.prototype.equals = function(other) { if (this.sign_ != other.sign_) { return false; } - var len = Math.max(this.bits_.length, other.bits_.length); - for (var i = 0; i < len; i++) { + const len = Math.max(this.bits_.length, other.bits_.length); + for (let i = 0; i < len; i++) { if (this.getBits(i) != other.getBits(i)) { return false; } @@ -495,14 +495,14 @@ Integer.prototype.lessThanOrEqual = function(other) { * if the given one is greater. */ Integer.prototype.compare = function(other) { - var diff = this.subtract(other); + const diff = this.subtract(other); if (diff.isNegative()) { return -1; } else if (diff.isZero()) { return 0; - } else { - return +1; - } + } + return +1; + }; @@ -513,23 +513,23 @@ Integer.prototype.compare = function(other) { * @return {!Integer} The shorted integer value. */ Integer.prototype.shorten = function(numBits) { - var arr_index = (numBits - 1) >> 5; - var bit_index = (numBits - 1) % 32; - var bits = []; - for (var i = 0; i < arr_index; i++) { + const arr_index = (numBits - 1) >> 5; + const bit_index = (numBits - 1) % 32; + const bits = []; + for (let i = 0; i < arr_index; i++) { bits[i] = this.getBits(i); } - var sigBits = bit_index == 31 ? 0xFFFFFFFF : (1 << (bit_index + 1)) - 1; - var val = this.getBits(arr_index) & sigBits; + const sigBits = bit_index == 31 ? 0xFFFFFFFF : (1 << (bit_index + 1)) - 1; + let val = this.getBits(arr_index) & sigBits; //noinspection JSBitwiseOperatorUsage if (val & (1 << bit_index)) { val |= 0xFFFFFFFF - sigBits; bits[arr_index] = val; return new Integer(bits, -1); - } else { - bits[arr_index] = val; - return new Integer(bits, 0); - } + } + bits[arr_index] = val; + return new Integer(bits, 0); + }; @@ -545,19 +545,19 @@ Integer.prototype.negate = function() { * @return {!Integer} The Integer result. */ Integer.prototype.add = function(other) { - var len = Math.max(this.bits_.length, other.bits_.length); - var arr = []; - var carry = 0; + const len = Math.max(this.bits_.length, other.bits_.length); + const arr = []; + let carry = 0; - for (var i = 0; i <= len; i++) { - var a1 = this.getBits(i) >>> 16; - var a0 = this.getBits(i) & 0xFFFF; + for (let i = 0; i <= len; i++) { + const a1 = this.getBits(i) >>> 16; + const a0 = this.getBits(i) & 0xFFFF; - var b1 = other.getBits(i) >>> 16; - var b0 = other.getBits(i) & 0xFFFF; + const b1 = other.getBits(i) >>> 16; + const b0 = other.getBits(i) & 0xFFFF; - var c0 = carry + a0 + b0; - var c1 = (c0 >>> 16) + a1 + b1; + let c0 = carry + a0 + b0; + let c1 = (c0 >>> 16) + a1 + b1; carry = c1 >>> 16; c0 &= 0xFFFF; c1 &= 0xFFFF; @@ -592,9 +592,9 @@ Integer.prototype.multiply = function(other) { if (this.isNegative()) { if (other.isNegative()) { return this.negate().multiply(other.negate()); - } else { - return this.negate().multiply(other).negate(); - } + } + return this.negate().multiply(other).negate(); + } else if (other.isNegative()) { return this.multiply(other.negate()).negate(); } @@ -606,18 +606,18 @@ Integer.prototype.multiply = function(other) { } // Fill in an array of 16-bit products. - var len = this.bits_.length + other.bits_.length; - var arr = []; + const len = this.bits_.length + other.bits_.length; + const arr = []; for (var i = 0; i < 2 * len; i++) { arr[i] = 0; } for (var i = 0; i < this.bits_.length; i++) { - for (var j = 0; j < other.bits_.length; j++) { - var a1 = this.getBits(i) >>> 16; - var a0 = this.getBits(i) & 0xFFFF; + for (let j = 0; j < other.bits_.length; j++) { + const a1 = this.getBits(i) >>> 16; + const a0 = this.getBits(i) & 0xFFFF; - var b1 = other.getBits(j) >>> 16; - var b0 = other.getBits(j) & 0xFFFF; + const b1 = other.getBits(j) >>> 16; + const b0 = other.getBits(j) & 0xFFFF; arr[2 * i + 2 * j] += a0 * b0; Integer.carry16_(arr, 2 * i + 2 * j); @@ -670,9 +670,9 @@ Integer.prototype.divide = function(other) { if (this.isNegative()) { if (other.isNegative()) { return this.negate().divide(other.negate()); - } else { - return this.negate().divide(other).negate(); - } + } + return this.negate().divide(other).negate(); + } else if (other.isNegative()) { return this.divide(other.negate()).negate(); } @@ -682,22 +682,22 @@ Integer.prototype.divide = function(other) { // into the result, and subtract it from the remainder. It is critical that // the approximate value is less than or equal to the real value so that the // remainder never becomes negative. - var res = Integer.ZERO; - var rem = this; + let res = Integer.ZERO; + let rem = this; while (rem.greaterThanOrEqual(other)) { // Approximate the result of division. This may be a little greater or // smaller than the actual value. - var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber())); + let approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber())); // We will tweak the approximate result by changing it in the 48-th digit or // the smallest non-fractional digit, whichever is larger. - var log2 = Math.ceil(Math.log(approx) / Math.LN2); - var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48); + const log2 = Math.ceil(Math.log(approx) / Math.LN2); + const delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48); // Decrease the approximation until it is smaller than the remainder. Note // that if it is too large, the product overflows and is negative. - var approxRes = Integer.fromNumber(approx); - var approxRem = approxRes.multiply(other); + let approxRes = Integer.fromNumber(approx); + let approxRem = approxRes.multiply(other); while (approxRem.isNegative() || approxRem.greaterThan(rem)) { approx -= delta; approxRes = Integer.fromNumber(approx); @@ -729,9 +729,9 @@ Integer.prototype.modulo = function(other) { /** @return {!Integer} The bitwise-NOT of this value. */ Integer.prototype.not = function() { - var len = this.bits_.length; - var arr = []; - for (var i = 0; i < len; i++) { + const len = this.bits_.length; + const arr = []; + for (let i = 0; i < len; i++) { arr[i] = ~this.bits_[i]; } return new Integer(arr, ~this.sign_); @@ -744,9 +744,9 @@ Integer.prototype.not = function() { * @return {!Integer} The bitwise-AND of this and the other. */ Integer.prototype.and = function(other) { - var len = Math.max(this.bits_.length, other.bits_.length); - var arr = []; - for (var i = 0; i < len; i++) { + const len = Math.max(this.bits_.length, other.bits_.length); + const arr = []; + for (let i = 0; i < len; i++) { arr[i] = this.getBits(i) & other.getBits(i); } return new Integer(arr, this.sign_ & other.sign_); @@ -759,9 +759,9 @@ Integer.prototype.and = function(other) { * @return {!Integer} The bitwise-OR of this and the other. */ Integer.prototype.or = function(other) { - var len = Math.max(this.bits_.length, other.bits_.length); - var arr = []; - for (var i = 0; i < len; i++) { + const len = Math.max(this.bits_.length, other.bits_.length); + const arr = []; + for (let i = 0; i < len; i++) { arr[i] = this.getBits(i) | other.getBits(i); } return new Integer(arr, this.sign_ | other.sign_); @@ -774,9 +774,9 @@ Integer.prototype.or = function(other) { * @return {!Integer} The bitwise-XOR of this and the other. */ Integer.prototype.xor = function(other) { - var len = Math.max(this.bits_.length, other.bits_.length); - var arr = []; - for (var i = 0; i < len; i++) { + const len = Math.max(this.bits_.length, other.bits_.length); + const arr = []; + for (let i = 0; i < len; i++) { arr[i] = this.getBits(i) ^ other.getBits(i); } return new Integer(arr, this.sign_ ^ other.sign_); @@ -789,11 +789,11 @@ Integer.prototype.xor = function(other) { * @return {!Integer} This shifted to the left by the given amount. */ Integer.prototype.shiftLeft = function(numBits) { - var arr_delta = numBits >> 5; - var bit_delta = numBits % 32; - var len = this.bits_.length + arr_delta + (bit_delta > 0 ? 1 : 0); - var arr = []; - for (var i = 0; i < len; i++) { + const arr_delta = numBits >> 5; + const bit_delta = numBits % 32; + const len = this.bits_.length + arr_delta + (bit_delta > 0 ? 1 : 0); + const arr = []; + for (let i = 0; i < len; i++) { if (bit_delta > 0) { arr[i] = (this.getBits(i - arr_delta) << bit_delta) | (this.getBits(i - arr_delta - 1) >>> (32 - bit_delta)); @@ -811,11 +811,11 @@ Integer.prototype.shiftLeft = function(numBits) { * @return {!Integer} This shifted to the right by the given amount. */ Integer.prototype.shiftRight = function(numBits) { - var arr_delta = numBits >> 5; - var bit_delta = numBits % 32; - var len = this.bits_.length - arr_delta; - var arr = []; - for (var i = 0; i < len; i++) { + const arr_delta = numBits >> 5; + const bit_delta = numBits % 32; + const len = this.bits_.length - arr_delta; + const arr = []; + for (let i = 0; i < len; i++) { if (bit_delta > 0) { arr[i] = (this.getBits(i + arr_delta) >>> bit_delta) | (this.getBits(i + arr_delta + 1) << (32 - bit_delta)); From 0fdf8b14be5ed827da4c57ef332cdab949c53b4f Mon Sep 17 00:00:00 2001 From: janehe Date: Wed, 12 Mar 2025 23:53:37 -0700 Subject: [PATCH 18/19] clear some eslint errors. delete index.d.ts --- .eslintrc.js | 3 + lib/auth/index.d.ts | 47 ---- lib/concurrent/index.d.ts | 45 ---- lib/datastax/graph/index.d.ts | 92 ------- lib/datastax/index.d.ts | 24 -- lib/datastax/search/index.d.ts | 58 ---- lib/geometry/index.d.ts | 67 ----- lib/mapping/index.d.ts | 189 ------------- lib/metadata/index.d.ts | 211 --------------- lib/metrics/index.d.ts | 89 ------- lib/policies/index.d.ts | 210 --------------- lib/tracker/index.d.ts | 58 ---- lib/types/index.d.ts | 468 --------------------------------- lib/utils.ts | 1 + 14 files changed, 4 insertions(+), 1558 deletions(-) delete mode 100644 lib/auth/index.d.ts delete mode 100644 lib/concurrent/index.d.ts delete mode 100644 lib/datastax/graph/index.d.ts delete mode 100644 lib/datastax/index.d.ts delete mode 100644 lib/datastax/search/index.d.ts delete mode 100644 lib/geometry/index.d.ts delete mode 100644 lib/mapping/index.d.ts delete mode 100644 lib/metadata/index.d.ts delete mode 100644 lib/metrics/index.d.ts delete mode 100644 lib/policies/index.d.ts delete mode 100644 lib/tracker/index.d.ts delete mode 100644 lib/types/index.d.ts diff --git a/.eslintrc.js b/.eslintrc.js index 1dfeced6..cd94041a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -38,6 +38,7 @@ module.exports = { "array-callback-return": "error", "curly": "error", "no-unused-vars": ["error", { "args": "none" }], + "@typescript-eslint/no-unused-vars": ["error", { "args": "none" }], "global-require": "error", "eqeqeq": ["error", "allow-null"], @@ -93,6 +94,8 @@ module.exports = { allowShortCircuit: false, allowTernary: false, }], + "@typescript-eslint/no-this-alias": "off", + "@typescript-eslint/no-explicit-any": "off", "no-useless-call": "off", "no-useless-concat": "error", "no-useless-escape": "error", diff --git a/lib/auth/index.d.ts b/lib/auth/index.d.ts deleted file mode 100644 index c1c37413..00000000 --- a/lib/auth/index.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright DataStax, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export namespace auth { - interface Authenticator { - initialResponse(callback: Function): void; - - evaluateChallenge(challenge: Buffer, callback: Function): void; - - onAuthenticationSuccess(token?: Buffer): void; - } - - interface AuthProvider { - newAuthenticator(endpoint: string, name: string): Authenticator; - } - - class PlainTextAuthProvider implements AuthProvider { - constructor(username: string, password: string); - - newAuthenticator(endpoint: string, name: string): Authenticator; - } - - class DsePlainTextAuthProvider implements AuthProvider { - constructor(username: string, password: string, authorizationId?: string); - - newAuthenticator(endpoint: string, name: string): Authenticator; - } - - class DseGssapiAuthProvider implements AuthProvider { - constructor(gssOptions?: { authorizationId?: string, service?: string, hostNameResolver?: Function }); - - newAuthenticator(endpoint: string, name: string): Authenticator; - } -} \ No newline at end of file diff --git a/lib/concurrent/index.d.ts b/lib/concurrent/index.d.ts deleted file mode 100644 index 91ab56f7..00000000 --- a/lib/concurrent/index.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright DataStax, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Client } from '../../'; -import { Readable } from 'stream'; - -export namespace concurrent { - interface ResultSetGroup { - errors: Error[]; - resultItems: any[]; - totalExecuted: number; - } - - type Options = { - collectResults?: boolean; - concurrencyLevel?: number; - executionProfile?: string; - maxErrors?: number; - raiseOnFirstError?: boolean; - } - - function executeConcurrent( - client: Client, - query: string, - parameters: any[][]|Readable, - options?: Options): Promise; - - function executeConcurrent( - client: Client, - queries: Array<{query: string, params: any[]}>, - options?: Options): Promise; -} \ No newline at end of file diff --git a/lib/datastax/graph/index.d.ts b/lib/datastax/graph/index.d.ts deleted file mode 100644 index b6e860c4..00000000 --- a/lib/datastax/graph/index.d.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright DataStax, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { types } from '../../types'; - -export namespace graph { - interface Edge extends Element { - outV?: Vertex; - outVLabel?: string; - inV?: Vertex; - inVLabel?: string; - properties?: object; - } - - interface Element { - id: any; - label: string; - } - - class GraphResultSet implements Iterator { - constructor(rs: types.ResultSet); - - first(): any; - - toArray(): any[]; - - values(): Iterator; - - next(value?: any): IteratorResult; - } - - interface Path { - labels: any[]; - objects: any[]; - } - - interface Property { - value: any - key: any - } - - interface Vertex extends Element { - properties?: { [key: string]: any[] } - } - - interface VertexProperty extends Element { - value: any - key: string - properties?: any - } - - function asDouble(value: number): object; - - function asFloat(value: number): object; - - function asInt(value: number): object; - - function asTimestamp(value: Date): object; - - function asUdt(value: object): object; - - interface EnumValue { - toString(): string - } - - namespace t { - const id: EnumValue; - const key: EnumValue; - const label: EnumValue; - const value: EnumValue; - } - - namespace direction { - // `in` is a reserved word - const in_: EnumValue; - const out: EnumValue; - const both: EnumValue; - } -} \ No newline at end of file diff --git a/lib/datastax/index.d.ts b/lib/datastax/index.d.ts deleted file mode 100644 index e41483f8..00000000 --- a/lib/datastax/index.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright DataStax, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import * as graphModule from './graph'; -import * as searchModule from './search'; - -export namespace datastax { - export import graph = graphModule.graph; - - export import search = searchModule.search; -} \ No newline at end of file diff --git a/lib/datastax/search/index.d.ts b/lib/datastax/search/index.d.ts deleted file mode 100644 index 57ba44f7..00000000 --- a/lib/datastax/search/index.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright DataStax, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export namespace search { - enum dateRangePrecision { - year = 0, - month, - day, - hour, - minute, - second, - millisecond - } - - class DateRange { - lowerBound: DateRangeBound; - upperBound: DateRangeBound; - - constructor(lowerBound: DateRangeBound, upperBound: DateRangeBound); - - equals(other: DateRangeBound): boolean; - - toString(): string; - - static fromString(value: string): DateRange; - - static fromBuffer(value: Buffer): DateRange; - } - - class DateRangeBound { - date: Date; - - precision: number; - - equals(other: DateRangeBound): boolean; - - toString(): string; - - static fromString(value: string): DateRangeBound; - - static toLowerBound(bound: DateRangeBound): DateRangeBound; - - static toUpperBound(bound: DateRangeBound): DateRangeBound; - } -} \ No newline at end of file diff --git a/lib/geometry/index.d.ts b/lib/geometry/index.d.ts deleted file mode 100644 index 82ad292b..00000000 --- a/lib/geometry/index.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright DataStax, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -export namespace geometry { - class LineString { - constructor(...args: Point[]); - - static fromBuffer(buffer: Buffer): LineString; - - static fromString(textValue: string): LineString; - - equals(other: LineString): boolean; - - toBuffer(): Buffer; - - toJSON(): string; - - toString(): string; - - } - - class Point { - constructor(x: number, y: number); - - static fromBuffer(buffer: Buffer): Point; - - static fromString(textValue: string): Point; - - equals(other: Point): boolean; - - toBuffer(): Buffer; - - toJSON(): string; - - toString(): string; - - } - - class Polygon { - constructor(...args: Point[]); - - static fromBuffer(buffer: Buffer): Polygon; - - static fromString(textValue: string): Polygon; - - equals(other: Polygon): boolean; - - toBuffer(): Buffer; - - toJSON(): string; - - toString(): string; - } -} \ No newline at end of file diff --git a/lib/mapping/index.d.ts b/lib/mapping/index.d.ts deleted file mode 100644 index 694e789c..00000000 --- a/lib/mapping/index.d.ts +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright DataStax, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { types } from '../types'; -import { Client } from '../../'; -import Long = types.Long; - -export namespace mapping { - interface TableMappings { - getColumnName(propName: string): string; - - getPropertyName(columnName: string): string; - - newObjectInstance(): any; - } - - class DefaultTableMappings implements TableMappings { - getColumnName(propName: string): string; - - getPropertyName(columnName: string): string; - - newObjectInstance(): any; - } - - class UnderscoreCqlToCamelCaseMappings implements TableMappings { - getColumnName(propName: string): string; - - getPropertyName(columnName: string): string; - - newObjectInstance(): any; - } - - interface Result extends Iterator { - wasApplied(): boolean; - - first(): T | null; - - forEach(callback: (currentValue: T, index: number) => void, thisArg?: any): void; - - toArray(): T[]; - } - - type MappingExecutionOptions = { - executionProfile?: string; - isIdempotent?: boolean; - logged?: boolean; - timestamp?: number | Long; - fetchSize?: number; - pageState?: number; - } - - interface ModelTables { - name: string; - isView: boolean; - } - - class Mapper { - constructor(client: Client, options?: MappingOptions); - - batch(items: ModelBatchItem[], executionOptions?: string | MappingExecutionOptions): Promise; - - forModel(name: string): ModelMapper; - } - - type MappingOptions = { - models: { [key: string]: ModelOptions }; - } - - type FindDocInfo = { - fields?: string[]; - orderBy?: { [key: string]: string }; - limit?: number; - } - - type InsertDocInfo = { - fields?: string[]; - ttl?: number; - ifNotExists?: boolean; - } - - type UpdateDocInfo = { - fields?: string[]; - ttl?: number; - ifExists?: boolean; - when?: { [key: string]: any }; - orderBy?: { [key: string]: string }; - limit?: number; - deleteOnlyColumns?: boolean; - } - - type RemoveDocInfo = { - fields?: string[]; - ttl?: number; - ifExists?: boolean; - when?: { [key: string]: any }; - deleteOnlyColumns?: boolean; - } - - type ModelOptions = { - tables?: string[] | ModelTables[]; - mappings?: TableMappings; - columns?: { [key: string]: string|ModelColumnOptions }; - keyspace?: string; - } - - type ModelColumnOptions = { - name: string; - toModel?: (columnValue: any) => any; - fromModel?: (modelValue: any) => any; - }; - - interface ModelBatchItem { - - } - - interface ModelBatchMapper { - insert(doc: any, docInfo?: InsertDocInfo): ModelBatchItem; - - remove(doc: any, docInfo?: RemoveDocInfo): ModelBatchItem; - - update(doc: any, docInfo?: UpdateDocInfo): ModelBatchItem; - } - - interface ModelMapper { - name: string; - batching: ModelBatchMapper; - - get(doc: { [key: string]: any }, docInfo?: { fields?: string[] }, executionOptions?: string | MappingExecutionOptions): Promise; - - find(doc: { [key: string]: any }, docInfo?: FindDocInfo, executionOptions?: string | MappingExecutionOptions): Promise>; - - findAll(docInfo?: FindDocInfo, executionOptions?: string | MappingExecutionOptions): Promise>; - - insert(doc: { [key: string]: any }, docInfo?: InsertDocInfo, executionOptions?: string | MappingExecutionOptions): Promise>; - - update(doc: { [key: string]: any }, docInfo?: UpdateDocInfo, executionOptions?: string | MappingExecutionOptions): Promise>; - - remove(doc: { [key: string]: any }, docInfo?: RemoveDocInfo, executionOptions?: string | MappingExecutionOptions): Promise>; - - mapWithQuery( - query: string, - paramsHandler: (doc: any) => any[], - executionOptions?: string | MappingExecutionOptions - ): (doc: any, executionOptions?: string | MappingExecutionOptions) => Promise>; - } - - namespace q { - interface QueryOperator { - - } - - function in_(arr: any): QueryOperator; - - function gt(value: any): QueryOperator; - - function gte(value: any): QueryOperator; - - function lt(value: any): QueryOperator; - - function lte(value: any): QueryOperator; - - function notEq(value: any): QueryOperator; - - function and(condition1: any, condition2: any): QueryOperator; - - function incr(value: any): QueryOperator; - - function decr(value: any): QueryOperator; - - function append(value: any): QueryOperator; - - function prepend(value: any): QueryOperator; - - function remove(value: any): QueryOperator; - } -} \ No newline at end of file diff --git a/lib/metadata/index.d.ts b/lib/metadata/index.d.ts deleted file mode 100644 index 80c0d967..00000000 --- a/lib/metadata/index.d.ts +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Copyright DataStax, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { types } from '../types'; -import { EmptyCallback, Host, token, ValueCallback } from '../../'; -import dataTypes = types.dataTypes; -import Uuid = types.Uuid; -import InetAddress = types.InetAddress; - -export namespace metadata { - - interface Aggregate { - argumentTypes: Array<{ code: dataTypes, info: any }>; - finalFunction: string; - initCondition: string; - keyspaceName: string; - returnType: string; - signature: string[]; - stateFunction: string; - stateType: string; - } - - interface ClientState { - getConnectedHosts(): Host[]; - - getInFlightQueries(host: Host): number; - - getOpenConnections(host: Host): number; - - toString(): string; - } - - interface DataTypeInfo { - code: dataTypes; - info: string | DataTypeInfo | DataTypeInfo[]; - options: { - frozen: boolean; - reversed: boolean; - }; - } - - interface ColumnInfo { - name: string; - type: DataTypeInfo; - } - - enum IndexKind { - custom = 0, - keys, - composites - } - - interface Index { - kind: IndexKind; - name: string; - options: object; - target: string; - - isCompositesKind(): boolean; - - isCustomKind(): boolean; - - isKeysKind(): boolean; - } - - interface DataCollection { - bloomFilterFalsePositiveChance: number; - caching: string; - clusteringKeys: ColumnInfo[]; - clusteringOrder: string[]; - columns: ColumnInfo[]; - columnsByName: { [key: string]: ColumnInfo }; - comment: string; - compactionClass: string; - compactionOptions: { [option: string]: any; }; - compression: { - class?: string; - [option: string]: any; - }; - crcCheckChange?: number; - defaultTtl: number; - extensions: { [option: string]: any; }; - gcGraceSeconds: number; - localReadRepairChance: number; - maxIndexInterval?: number; - minIndexInterval?: number; - name: string; - partitionKeys: ColumnInfo[]; - populateCacheOnFlush: boolean; - readRepairChance: number; - speculativeRetry: string; - } - - interface MaterializedView extends DataCollection { - tableName: string; - whereClause: string; - includeAllColumns: boolean; - } - - interface TableMetadata extends DataCollection { - indexes: Index[]; - indexInterval?: number; - isCompact: boolean; - memtableFlushPeriod: number; - replicateOnWrite: boolean; - cdc?: boolean; - virtual: boolean; - } - - interface QueryTrace { - requestType: string; - coordinator: InetAddress; - parameters: { [key: string]: any }; - startedAt: number | types.Long; - duration: number; - clientAddress: string; - events: Array<{ id: Uuid; activity: any; source: any; elapsed: any; thread: any }>; - } - - interface SchemaFunction { - argumentNames: string[]; - argumentTypes: Array<{ code: dataTypes, info: any }>; - body: string; - calledOnNullInput: boolean; - keyspaceName: string; - language: string; - name: string; - returnType: string; - signature: string[]; - } - - interface Udt { - name: string; - fields: ColumnInfo[] - } - - interface Metadata { - keyspaces: { [name: string]: { name: string, strategy: string }}; - - clearPrepared(): void; - - getAggregate(keyspaceName: string, name: string, signature: string[] | Array<{ code: number, info: any }>, callback: ValueCallback): void; - - getAggregate(keyspaceName: string, name: string, signature: string[] | Array<{ code: number, info: any }>): Promise; - - getAggregates(keyspaceName: string, name: string, callback: ValueCallback): void; - - getAggregates(keyspaceName: string, name: string): Promise; - - getFunction(keyspaceName: string, name: string, signature: string[] | Array<{ code: number, info: any }>, callback: ValueCallback): void; - - getFunction(keyspaceName: string, name: string, signature: string[] | Array<{ code: number, info: any }>): Promise; - - getFunctions(keyspaceName: string, name: string, callback: ValueCallback): void; - - getFunctions(keyspaceName: string, name: string): Promise; - - getMaterializedView(keyspaceName: string, name: string, callback: ValueCallback): void; - - getMaterializedView(keyspaceName: string, name: string, callback: EmptyCallback): Promise; - - getReplicas(keyspaceName: string, token: Buffer | token.Token | token.TokenRange): Host[]; - - getTable(keyspaceName: string, name: string, callback: ValueCallback): void; - - getTable(keyspaceName: string, name: string): Promise; - - getTokenRanges(): Set; - - getTokenRangesForHost(keyspaceName: string, host: Host): Set | null; - - getTrace(traceId: Uuid, consistency: types.consistencies, callback: ValueCallback): void; - - getTrace(traceId: Uuid, consistency: types.consistencies): Promise; - - getTrace(traceId: Uuid, callback: ValueCallback): void; - - getTrace(traceId: Uuid): Promise; - - getUdt(keyspaceName: string, name: string, callback: ValueCallback): void; - - getUdt(keyspaceName: string, name: string): Promise; - - newToken(components: Buffer[] | Buffer | string): token.Token; - - newTokenRange(start: token.Token, end: token.Token): token.TokenRange; - - refreshKeyspace(name: string, callback: EmptyCallback): void; - - refreshKeyspace(name: string): Promise; - - refreshKeyspaces(waitReconnect: boolean, callback: EmptyCallback): void; - - refreshKeyspaces(waitReconnect?: boolean): Promise; - - refreshKeyspaces(callback: EmptyCallback): void; - } -} \ No newline at end of file diff --git a/lib/metrics/index.d.ts b/lib/metrics/index.d.ts deleted file mode 100644 index 4ad80054..00000000 --- a/lib/metrics/index.d.ts +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright DataStax, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { errors } from '../../'; - -export namespace metrics { - interface ClientMetrics { - onAuthenticationError(e: Error | errors.AuthenticationError): void; - - onClientTimeoutError(e: errors.OperationTimedOutError): void; - - onClientTimeoutRetry(e: Error): void; - - onConnectionError(e: Error): void; - - onIgnoreError(e: Error): void; - - onOtherError(e: Error): void; - - onOtherErrorRetry(e: Error): void; - - onReadTimeoutError(e: errors.ResponseError): void; - - onReadTimeoutRetry(e: Error): void; - - onResponse(latency: number[]): void; - - onSpeculativeExecution(): void; - - onSuccessfulResponse(latency: number[]): void; - - onUnavailableError(e: errors.ResponseError): void; - - onUnavailableRetry(e: Error): void; - - onWriteTimeoutError(e: errors.ResponseError): void; - - onWriteTimeoutRetry(e: Error): void; - } - - class DefaultMetrics implements ClientMetrics { - constructor(); - - onAuthenticationError(e: Error | errors.AuthenticationError): void; - - onClientTimeoutError(e: errors.OperationTimedOutError): void; - - onClientTimeoutRetry(e: Error): void; - - onConnectionError(e: Error): void; - - onIgnoreError(e: Error): void; - - onOtherError(e: Error): void; - - onOtherErrorRetry(e: Error): void; - - onReadTimeoutError(e: errors.ResponseError): void; - - onReadTimeoutRetry(e: Error): void; - - onResponse(latency: number[]): void; - - onSpeculativeExecution(): void; - - onSuccessfulResponse(latency: number[]): void; - - onUnavailableError(e: errors.ResponseError): void; - - onUnavailableRetry(e: Error): void; - - onWriteTimeoutError(e: errors.ResponseError): void; - - onWriteTimeoutRetry(e: Error): void; - } -} \ No newline at end of file diff --git a/lib/policies/index.d.ts b/lib/policies/index.d.ts deleted file mode 100644 index ffae185b..00000000 --- a/lib/policies/index.d.ts +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright DataStax, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Client, EmptyCallback, ExecutionOptions, Host, HostMap } from '../../'; -import { types } from '../types'; - - -export namespace policies { - function defaultAddressTranslator(): addressResolution.AddressTranslator; - - function defaultLoadBalancingPolicy(localDc?: string): loadBalancing.LoadBalancingPolicy; - - function defaultReconnectionPolicy(): reconnection.ReconnectionPolicy; - - function defaultRetryPolicy(): retry.RetryPolicy; - - function defaultSpeculativeExecutionPolicy(): speculativeExecution.SpeculativeExecutionPolicy; - - function defaultTimestampGenerator(): timestampGeneration.TimestampGenerator; - - namespace addressResolution { - interface AddressTranslator { - translate(address: string, port: number, callback: Function): void; - } - - class EC2MultiRegionTranslator implements AddressTranslator { - translate(address: string, port: number, callback: Function): void; - } - } - - namespace loadBalancing { - abstract class LoadBalancingPolicy { - init(client: Client, hosts: HostMap, callback: EmptyCallback): void; - - getDistance(host: Host): types.distance; - - newQueryPlan( - keyspace: string, - executionOptions: ExecutionOptions, - callback: (error: Error, iterator: Iterator) => void): void; - - getOptions(): Map; - } - - class DCAwareRoundRobinPolicy extends LoadBalancingPolicy { - constructor(localDc: string); - } - - class TokenAwarePolicy extends LoadBalancingPolicy { - constructor(childPolicy: LoadBalancingPolicy); - } - - class AllowListPolicy extends LoadBalancingPolicy { - constructor(childPolicy: LoadBalancingPolicy, allowList: string[]); - } - - class WhiteListPolicy extends AllowListPolicy { - } - - class RoundRobinPolicy extends LoadBalancingPolicy { - constructor(); - } - - class DefaultLoadBalancingPolicy extends LoadBalancingPolicy { - constructor(options?: { localDc?: string, filter?: (host: Host) => boolean }); - } - } - - namespace reconnection { - class ConstantReconnectionPolicy implements ReconnectionPolicy { - constructor(delay: number); - - getOptions(): Map; - - newSchedule(): Iterator; - - } - - class ExponentialReconnectionPolicy implements ReconnectionPolicy { - constructor(baseDelay: number, maxDelay: number, startWithNoDelay?: boolean); - - getOptions(): Map; - - newSchedule(): Iterator; - } - - interface ReconnectionPolicy { - getOptions(): Map; - - newSchedule(): Iterator; - } - } - - namespace retry { - class DecisionInfo { - decision: number; - consistency: types.consistencies; - } - - class OperationInfo { - query: string; - executionOptions: ExecutionOptions; - nbRetry: number; - } - - class IdempotenceAwareRetryPolicy extends RetryPolicy { - constructor(childPolicy: RetryPolicy); - } - - class FallthroughRetryPolicy extends RetryPolicy { - constructor(); - } - - class RetryPolicy { - onReadTimeout( - info: OperationInfo, - consistency: types.consistencies, - received: number, - blockFor: number, - isDataPresent: boolean): DecisionInfo; - - onRequestError(info: OperationInfo, consistency: types.consistencies, err: Error): DecisionInfo; - - onUnavailable( - info: OperationInfo, consistency: types.consistencies, required: number, alive: boolean): DecisionInfo; - - onWriteTimeout( - info: OperationInfo, - consistency: types.consistencies, - received: number, - blockFor: number, - writeType: string): DecisionInfo; - - rethrowResult(): DecisionInfo; - - retryResult(consistency: types.consistencies, useCurrentHost?: boolean): DecisionInfo; - } - - namespace RetryDecision { - enum retryDecision { - ignore, - rethrow, - retry - } - } - } - - namespace speculativeExecution { - class ConstantSpeculativeExecutionPolicy implements SpeculativeExecutionPolicy { - constructor(delay: number, maxSpeculativeExecutions: number); - - getOptions(): Map; - - init(client: Client): void; - - newPlan(keyspace: string, queryInfo: string | Array): { nextExecution: Function }; - - shutdown(): void; - } - - class NoSpeculativeExecutionPolicy implements SpeculativeExecutionPolicy { - constructor(); - - getOptions(): Map; - - init(client: Client): void; - - newPlan(keyspace: string, queryInfo: string | Array): { nextExecution: Function }; - - shutdown(): void; - } - - interface SpeculativeExecutionPolicy { - getOptions(): Map; - - init(client: Client): void; - - newPlan(keyspace: string, queryInfo: string|Array): { nextExecution: Function }; - - shutdown(): void; - } - } - - namespace timestampGeneration { - class MonotonicTimestampGenerator implements TimestampGenerator { - constructor(warningThreshold: number, minLogInterval: number); - - getDate(): number; - - next(client: Client): types.Long | number; - } - - interface TimestampGenerator { - next(client: Client): types.Long|number; - } - } -} \ No newline at end of file diff --git a/lib/tracker/index.d.ts b/lib/tracker/index.d.ts deleted file mode 100644 index e39e8bae..00000000 --- a/lib/tracker/index.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright DataStax, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { ExecutionOptions, Host } from '../../'; - -export namespace tracker { - interface RequestTracker { - onError( - host: Host, - query: string | Array<{ query: string, params?: any }>, - parameters: any[] | { [key: string]: any } | null, - executionOptions: ExecutionOptions, - requestLength: number, - err: Error, - latency: number[]): void; - - onSuccess( - host: Host, - query: string | Array<{ query: string, params?: any }>, - parameters: any[] | { [key: string]: any } | null, - executionOptions: ExecutionOptions, - requestLength: number, - responseLength: number, - latency: number[]): void; - - shutdown(): void; - } - - class RequestLogger implements RequestTracker { - constructor(options: { - slowThreshold?: number; - logNormalRequests?: boolean; - logErroredRequests?: boolean; - messageMaxQueryLength?: number; - messageMaxParameterValueLength?: number; - messageMaxErrorStackTraceLength?: number; - }); - - onError(host: Host, query: string | Array<{ query: string; params?: any }>, parameters: any[] | { [p: string]: any } | null, executionOptions: ExecutionOptions, requestLength: number, err: Error, latency: number[]): void; - - onSuccess(host: Host, query: string | Array<{ query: string; params?: any }>, parameters: any[] | { [p: string]: any } | null, executionOptions: ExecutionOptions, requestLength: number, responseLength: number, latency: number[]): void; - - shutdown(): void; - } -} \ No newline at end of file diff --git a/lib/types/index.d.ts b/lib/types/index.d.ts deleted file mode 100644 index 3826ed80..00000000 --- a/lib/types/index.d.ts +++ /dev/null @@ -1,468 +0,0 @@ -/* - * Copyright DataStax, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import _Long = require('long'); -import * as stream from 'stream'; -import { ValueCallback } from '../../'; - -export namespace types { - class Long extends _Long { - - } - - enum consistencies { - any = 0x00, - one = 0x01, - two = 0x02, - three = 0x03, - quorum = 0x04, - all = 0x05, - localQuorum = 0x06, - eachQuorum = 0x07, - serial = 0x08, - localSerial = 0x09, - localOne = 0x0a - } - - enum dataTypes { - custom = 0x0000, - ascii = 0x0001, - bigint = 0x0002, - blob = 0x0003, - boolean = 0x0004, - counter = 0x0005, - decimal = 0x0006, - double = 0x0007, - float = 0x0008, - int = 0x0009, - text = 0x000a, - timestamp = 0x000b, - uuid = 0x000c, - varchar = 0x000d, - varint = 0x000e, - timeuuid = 0x000f, - inet = 0x0010, - date = 0x0011, - time = 0x0012, - smallint = 0x0013, - tinyint = 0x0014, - duration = 0x0015, - list = 0x0020, - map = 0x0021, - set = 0x0022, - udt = 0x0030, - tuple = 0x0031, - } - - enum distance { - local = 0, - remote, - ignored - } - - enum responseErrorCodes { - serverError = 0x0000, - protocolError = 0x000A, - badCredentials = 0x0100, - unavailableException = 0x1000, - overloaded = 0x1001, - isBootstrapping = 0x1002, - truncateError = 0x1003, - writeTimeout = 0x1100, - readTimeout = 0x1200, - readFailure = 0x1300, - functionFailure = 0x1400, - writeFailure = 0x1500, - syntaxError = 0x2000, - unauthorized = 0x2100, - invalid = 0x2200, - configError = 0x2300, - alreadyExists = 0x2400, - unprepared = 0x2500, - clientWriteFailure = 0x8000 - } - - enum protocolVersion { - v1 = 0x01, - v2 = 0x02, - v3 = 0x03, - v4 = 0x04, - v5 = 0x05, - v6 = 0x06, - dseV1 = 0x41, - dseV2 = 0x42, - maxSupported = dseV2, - minSupported = v1 - } - - namespace protocolVersion { - function isSupported(version: protocolVersion): boolean; - } - - const unset: object; - - class BigDecimal { - constructor(unscaledValue: number, scale: number); - - static fromBuffer(buf: Buffer): BigDecimal; - - static fromString(value: string): BigDecimal; - - static toBuffer(value: BigDecimal): Buffer; - - static fromNumber(value: number): BigDecimal; - - add(other: BigDecimal): BigDecimal; - - compare(other: BigDecimal): number; - - equals(other: BigDecimal): boolean; - - greaterThan(other: BigDecimal): boolean; - - isNegative(): boolean; - - isZero(): boolean; - - notEquals(other: BigDecimal): boolean; - - subtract(other: BigDecimal): BigDecimal; - - toNumber(): number; - - toString(): string; - - toJSON(): string; - } - - class Duration { - constructor(month: number, days: number, nanoseconds: number | Long); - - static fromBuffer(buffer: Buffer): Duration; - - static fromString(input: string): Duration; - - equals(other: Duration): boolean; - - toBuffer(): Buffer; - - toString(): string; - } - - class InetAddress { - length: number; - - version: number; - - constructor(buffer: Buffer); - - static fromString(value: string): InetAddress; - - equals(other: InetAddress): boolean; - - getBuffer(): Buffer; - - toString(): string; - - toJSON(): string; - } - - class Integer { - static ONE: Integer; - static ZERO: Integer; - - constructor(bits: Array, sign: number); - - static fromBits(bits: Array): Integer; - - static fromBuffer(bits: Buffer): Integer; - - static fromInt(value: number): Integer; - - static fromNumber(value: number): Integer; - - static fromString(str: string, opt_radix?: number): Integer; - - static toBuffer(value: Integer): Buffer; - - abs(): Integer; - - add(other: Integer): Integer; - - compare(other: Integer): number; - - divide(other: Integer): Integer; - - equals(other: Integer): boolean; - - getBits(index: number): number; - - getBitsUnsigned(index: number): number; - - getSign(): number; - - greaterThan(other: Integer): boolean; - - greaterThanOrEqual(other: Integer): boolean; - - isNegative(): boolean; - - isOdd(): boolean; - - isZero(): boolean; - - lessThan(other: Integer): boolean; - - lessThanOrEqual(other: Integer): boolean; - - modulo(other: Integer): Integer; - - multiply(other: Integer): Integer; - - negate(): Integer; - - not(): Integer; - - notEquals(other: Integer): boolean; - - or(other: Integer): Integer; - - shiftLeft(numBits: number): Integer; - - shiftRight(numBits: number): Integer; - - shorten(numBits: number): Integer; - - subtract(other: Integer): Integer; - - toInt(): number; - - toJSON(): string; - - toNumber(): number; - - toString(opt_radix?: number): string; - - xor(other: Integer): Integer; - } - - class LocalDate { - year: number; - month: number; - day: number; - - constructor(year: number, month: number, day: number); - - static fromDate(date: Date): LocalDate; - - static fromString(value: string): LocalDate; - - static fromBuffer(buffer: Buffer): LocalDate; - - static now(): LocalDate; - - static utcNow(): LocalDate; - - equals(other: LocalDate): boolean; - - inspect(): string; - - toBuffer(): Buffer; - - toJSON(): string; - - toString(): string; - } - - class LocalTime { - hour: number; - minute: number; - nanosecond: number; - second: number; - - constructor(totalNanoseconds: Long); - - static fromBuffer(value: Buffer): LocalTime; - - static fromDate(date: Date, nanoseconds: number): LocalTime; - - static fromMilliseconds(milliseconds: number, nanoseconds?: number): LocalTime; - - static fromString(value: string): LocalTime; - - static now(nanoseconds?: number): LocalTime; - - compare(other: LocalTime): boolean; - - equals(other: LocalTime): boolean; - - getTotalNanoseconds(): Long; - - inspect(): string; - - toBuffer(): Buffer; - - toJSON(): string; - - toString(): string; - } - - interface ResultSet extends Iterable, AsyncIterable { - info: { - queriedHost: string, - triedHosts: { [key: string]: any; }, - speculativeExecutions: number, - achievedConsistency: consistencies, - traceId: Uuid, - warnings: string[], - customPayload: any - }; - - columns: Array<{ name: string, type: { code: dataTypes, info: any } }>; - nextPage: (() => void) | null; - pageState: string; - rowLength: number; - rows: Row[]; - - first(): Row; - - wasApplied(): boolean; - } - - interface ResultStream extends stream.Readable { - buffer: Buffer; - paused: boolean; - - add(chunk: Buffer): void; - } - - interface Row { - get(columnName: string | number): any; - - keys(): string[]; - - forEach(callback: (row: Row) => void): void; - - values(): any[]; - - [key: string]: any; - } - - class TimeUuid extends Uuid { - static now(): TimeUuid; - - static now(nodeId: string | Buffer, clockId?: string | Buffer): TimeUuid; - - static now(nodeId: string | Buffer, clockId: string | Buffer, callback: ValueCallback): void; - - static now(callback: ValueCallback): void; - - static fromDate(date: Date, ticks?: number, nodeId?: string | Buffer, clockId?: string | Buffer): TimeUuid; - - static fromDate( - date: Date, - ticks: number, - nodeId: string | Buffer, - clockId: string | Buffer, - callback: ValueCallback): void; - - static fromString(value: string): TimeUuid; - - static max(date: Date, ticks: number): TimeUuid; - - static min(date: Date, ticks: number): TimeUuid; - - getDatePrecision(): { date: Date, ticks: number }; - - getDate(): Date; - } - - class Tuple { - elements: any[]; - length: number; - - constructor(...args: any[]); - - static fromArray(elements: any[]): Tuple; - - get(index: number): any; - - toString(): string; - - toJSON(): string; - - values(): any[]; - } - - class Uuid { - constructor(buffer: Buffer); - - static fromString(value: string): Uuid; - - static random(callback: ValueCallback): void; - - static random(): Uuid; - - equals(other: Uuid): boolean; - - getBuffer(): Buffer; - - toString(): string; - - toJSON(): string; - } - - class Vector { - static get [Symbol.species](): typeof Vector; - /** - * - * @param {Float32Array | Array} elements - * @param {string?} subtype - */ - constructor(elements: Float32Array | Array, subtype?: string | null); - elements: any[]; - /** - * Returns the number of the elements. - * @type Number - */ - length: number; - subtype: string; - /** - * Returns the string representation of the vector. - * @returns {string} - */ - toString(): string; - /** - * - * @param {number} index - */ - at(index: number): any; - /** - * - * @param {(value: any, index: number, array: any[]) => void} callback - */ - forEach(callback: (value: any, index: number, array: any[]) => void): void; - /** - * @returns {string | null} get the subtype string, e.g., "float", but it's optional so it can return null - */ - getSubtype(): string | null; - /** - * - * @returns {IterableIterator} - */ - [Symbol.iterator](): IterableIterator; - } -} \ No newline at end of file diff --git a/lib/utils.ts b/lib/utils.ts index 2d74a8ba..83613ad3 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -1252,6 +1252,7 @@ const VIntCoding = (function () { * @throws VIntOutOfRangeException If the vint doesn't fit into a 32-bit integer */ // eslint-disable-next-line no-unused-vars + // eslint-disable-next-line @typescript-eslint/no-unused-vars function getUnsignedVInt32(input, readerIndex) { return checkedCast(getUnsignedVInt(input, readerIndex, input.length)); } From fc5e85f0b2e65a27cbeb55cd3118c2b843d05239 Mon Sep 17 00:00:00 2001 From: janehe Date: Thu, 13 Mar 2025 00:03:50 -0700 Subject: [PATCH 19/19] add "@stylistic/eslint-plugin": "^3.1.0", --- package-lock.json | 8 ++++---- package.json | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 57e54b8b..60fb2b57 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "@SiyaoIsHiding/cassandra-driver", - "version": "0.0.8", + "name": "cassandra-driver", + "version": "4.8.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "@SiyaoIsHiding/cassandra-driver", - "version": "0.0.8", + "name": "cassandra-driver", + "version": "4.8.0", "license": "Apache-2.0", "dependencies": { "@types/node": "^18.11.18", diff --git a/package.json b/package.json index 334b7364..29cea70a 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "long": "~5.2.3" }, "devDependencies": { + "@stylistic/eslint-plugin": "^3.1.0", "@types/mocha": "^10.0.10", "@typescript-eslint/eslint-plugin": "^8.26.1", "@typescript-eslint/parser": "^8.26.1",