Skip to content

Commit 340689e

Browse files
fix: improve types for row (#661)
1 parent 4910e77 commit 340689e

File tree

4 files changed

+366
-136
lines changed

4 files changed

+366
-136
lines changed

src/chunktransformer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export interface Chunk {
2323
rowContents: Value;
2424
commitRow: boolean;
2525
resetRow: boolean;
26-
rowKey?: string | Uint8Array;
26+
rowKey?: string | Bytes;
2727
familyName?: {value: string};
2828
qualifier?: Qualifier | {value: Value};
2929
timestampMicros?: number | Long;

src/instance.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export class Instance {
156156
bigtable: Bigtable;
157157
id: string;
158158
name: string;
159-
metadata?: {};
159+
metadata?: google.bigtable.admin.v2.IInstance;
160160
getTablesStream!: (options?: GetTablesOptions) => ResourceStream<Table>;
161161
constructor(bigtable: Bigtable, id: string) {
162162
this.bigtable = bigtable;

src/mutation.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@ export interface ParsedColumn {
3636
qualifier: string | null;
3737
}
3838
export interface ConvertFromBytesOptions {
39-
userOptions?: {decode?: boolean; encoding?: string};
39+
userOptions?: ConvertFromBytesUserOptions;
4040
isPossibleNumber?: boolean;
4141
}
42+
export interface ConvertFromBytesUserOptions {
43+
decode?: boolean;
44+
encoding?: string;
45+
}
4246
export interface MutationConstructorObj {
4347
key: string;
4448
method: string;
@@ -103,9 +107,9 @@ export class Mutation {
103107
* @private
104108
*/
105109
static convertFromBytes(
106-
bytes: Bytes,
110+
bytes: Buffer | string,
107111
options?: ConvertFromBytesOptions
108-
): Buffer | Value {
112+
): Buffer | Value | string {
109113
const buf = bytes instanceof Buffer ? bytes : Buffer.from(bytes, 'base64');
110114
if (options && options.isPossibleNumber && buf.length === 8) {
111115
// tslint:disable-next-line no-any

0 commit comments

Comments
 (0)