Skip to content

Commit

Permalink
fix: improve types for row (#661)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith committed Mar 20, 2020
1 parent 4910e77 commit 340689e
Show file tree
Hide file tree
Showing 4 changed files with 366 additions and 136 deletions.
2 changes: 1 addition & 1 deletion src/chunktransformer.ts
Expand Up @@ -23,7 +23,7 @@ export interface Chunk {
rowContents: Value;
commitRow: boolean;
resetRow: boolean;
rowKey?: string | Uint8Array;
rowKey?: string | Bytes;
familyName?: {value: string};
qualifier?: Qualifier | {value: Value};
timestampMicros?: number | Long;
Expand Down
2 changes: 1 addition & 1 deletion src/instance.ts
Expand Up @@ -156,7 +156,7 @@ export class Instance {
bigtable: Bigtable;
id: string;
name: string;
metadata?: {};
metadata?: google.bigtable.admin.v2.IInstance;
getTablesStream!: (options?: GetTablesOptions) => ResourceStream<Table>;
constructor(bigtable: Bigtable, id: string) {
this.bigtable = bigtable;
Expand Down
10 changes: 7 additions & 3 deletions src/mutation.ts
Expand Up @@ -36,9 +36,13 @@ export interface ParsedColumn {
qualifier: string | null;
}
export interface ConvertFromBytesOptions {
userOptions?: {decode?: boolean; encoding?: string};
userOptions?: ConvertFromBytesUserOptions;
isPossibleNumber?: boolean;
}
export interface ConvertFromBytesUserOptions {
decode?: boolean;
encoding?: string;
}
export interface MutationConstructorObj {
key: string;
method: string;
Expand Down Expand Up @@ -103,9 +107,9 @@ export class Mutation {
* @private
*/
static convertFromBytes(
bytes: Bytes,
bytes: Buffer | string,
options?: ConvertFromBytesOptions
): Buffer | Value {
): Buffer | Value | string {
const buf = bytes instanceof Buffer ? bytes : Buffer.from(bytes, 'base64');
if (options && options.isPossibleNumber && buf.length === 8) {
// tslint:disable-next-line no-any
Expand Down

0 comments on commit 340689e

Please sign in to comment.