Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(typescript): noImplicitAny for row file in test folder #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

import {promisifyAll} from '@google-cloud/promisify';
import {ServiceError} from '@grpc/grpc-js';
import {CallOptions, Operation as GaxOperation} from 'google-gax';
import {ServiceError} from 'grpc';

import {google as btTypes} from '../proto/bigtable';

Expand Down
102 changes: 102 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,115 @@ import {AppProfile} from './app-profile';
import {Cluster} from './cluster';
import {Instance} from './instance';


import {google as btTypes} from '../proto/bigtable';

import {ServiceError} from 'grpc';

import {Row} from './row';
import {PartialFailureError} from '@google-cloud/common/build/src/util';
import {IMutation} from './mutation';



const retryRequest = require('retry-request');
const streamEvents = require('stream-events');

const PKG = require('../../package.json');
const v2 = require('./v2');
const {grpc} = new gax.GrpcClient();



type RequestCallback<T, R = void> =
R extends void ? NormalCallback<T>: FullCallback<T, R>;
type NormalCallback<T> = (err: ServiceError|null, response?: T|null) => void;
type FullCallback<T, R> =
(err: ServiceError|null, response?: T|null, apiResponse?: R|null) => void;

type ApiResponse<T, R = void> =
R extends void ? NormalResponse<T>: FullResponse<T, R>;
type NormalResponse<T> = [T];
type FullResponse<T, R> = [T, R];
interface OptionInterface {
gaxOptions?: gax.CallOptions;
}


export type IOperation = btTypes.longrunning.IOperation;

export interface CreateRowOptions extends OptionInterface {
entry?: Entry;
}



export interface Rule {
age?: {};
versions?: number;
intersect?: boolean;
union?: boolean;
}

export interface GetRowOptions extends OptionInterface {
decode?: boolean;
filter?: Array<{}>;
}

export type EmptyResponse = ApiResponse<btTypes.protobuf.IEmpty>;

export interface FilterRowConfigOptions {
onMatch: IMutation[]|null;
onNoMatch?: IMutation[];
gaxOptions?: gax.CallOptions;
}


export interface GetTableRowsOptions extends OptionInterface {}
export type ExistsCallback = RequestCallback<boolean>;
export type ExistsResponse = ApiResponse<boolean>;

export interface MutateTableRowsOptions extends OptionInterface {
rawMutation?: boolean;
}
export type CreateRowCallback =
RequestCallback<Row, btTypes.bigtable.v2.IReadModifyWriteRowResponse>;
export type CreateRowResponse =
ApiResponse<Row, btTypes.bigtable.v2.IReadModifyWriteRowResponse>;
export type CreateRulesCallback =
RequestCallback<btTypes.bigtable.v2.IReadModifyWriteRowResponse>;
export type CreateRulesResponse =
ApiResponse<btTypes.bigtable.v2.IReadModifyWriteRowResponse>;
export type DeleteRowCallback = RequestCallback<PartialFailureError>;
export type DeleteRowResponse = ApiResponse<PartialFailureError>;
export type DeleteRowCellsCallback = RequestCallback<PartialFailureError>;
export type DeleteRowCellsResponse = ApiResponse<PartialFailureError>;
export type SaveRowCallback = RequestCallback<PartialFailureError>;
export type SaveRowResponse = ApiResponse<PartialFailureError>;
export type IncrementRowCallback =
RequestCallback<number, btTypes.bigtable.v2.IReadModifyWriteRowResponse>;
export type IncrementRowResponse =
ApiResponse<number, btTypes.bigtable.v2.IReadModifyWriteRowResponse>;
export type GetRowMetadataCallback = RequestCallback<btTypes.bigtable.v2.IRow>;
export type GetRowMetadataResponse = ApiResponse<btTypes.bigtable.v2.IRow>;
export type GetRowCallback = RequestCallback<Row>;
export type GetRowResponse = ApiResponse<Row>;
export type FilterRowCallback =
RequestCallback<boolean, btTypes.bigtable.v2.CheckAndMutateRowResponse>;
export type FilterRowResponse =
ApiResponse<boolean, btTypes.bigtable.v2.CheckAndMutateRowResponse>;

export type Data = Value|Value[]|Entry;
export type Value = string|number|boolean;


export interface Entry {
key?: string;
method?: string;
data?: Data;
}


/**
* @typedef {object} ClientConfig
* @property {string} [apiEndpoint] Override the default API endpoint used
Expand Down
Loading