Skip to content

Commit bbd05cd

Browse files
renovate[bot]shivanee-p
authored andcommitted
chore(deps): update dependency gts to v1 (#459)
1 parent 5285021 commit bbd05cd

26 files changed

Lines changed: 3462 additions & 2928 deletions

handwritten/bigtable/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"eslint-config-prettier": "^4.0.0",
8888
"eslint-plugin-node": "^9.0.0",
8989
"eslint-plugin-prettier": "^3.0.0",
90-
"gts": "^0.9.0",
90+
"gts": "^1.0.0",
9191
"intelli-espower-loader": "^1.0.1",
9292
"jsdoc": "^3.5.5",
9393
"jsdoc-baseline": "git+https://github.com/hegemonic/jsdoc-baseline.git",

handwritten/bigtable/src/app-profile.ts

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ export class AppProfile {
5252
} else {
5353
throw new Error(`AppProfile id '${id}' is not formatted correctly.
5454
Please use the format 'my-app-profile' or '${
55-
instance.name}/appProfiles/my-app-profile'.`);
55+
instance.name
56+
}/appProfiles/my-app-profile'.`);
5657
}
5758
} else {
5859
name = `${instance.name}/appProfiles/${id}`;
@@ -108,11 +109,12 @@ Please use the format 'my-app-profile' or '${
108109
};
109110
if (is.boolean(options.allowTransactionalWrites)) {
110111
appProfile.singleClusterRouting.allowTransactionalWrites =
111-
options.allowTransactionalWrites;
112+
options.allowTransactionalWrites;
112113
}
113114
} else {
114115
throw new Error(
115-
'An app profile routing policy can only contain "any" or a `Cluster`.');
116+
'An app profile routing policy can only contain "any" or a `Cluster`.'
117+
);
116118
}
117119
}
118120

@@ -172,13 +174,14 @@ Please use the format 'my-app-profile' or '${
172174
}
173175

174176
this.bigtable.request(
175-
{
176-
client: 'BigtableInstanceAdminClient',
177-
method: 'deleteAppProfile',
178-
reqOpts,
179-
gaxOpts: options.gaxOptions,
180-
},
181-
callback);
177+
{
178+
client: 'BigtableInstanceAdminClient',
179+
method: 'deleteAppProfile',
180+
reqOpts,
181+
gaxOpts: options.gaxOptions,
182+
},
183+
callback
184+
);
182185
}
183186

184187
/**
@@ -259,21 +262,22 @@ Please use the format 'my-app-profile' or '${
259262
}
260263

261264
this.bigtable.request(
262-
{
263-
client: 'BigtableInstanceAdminClient',
264-
method: 'getAppProfile',
265-
reqOpts: {
266-
name: this.name,
267-
},
268-
gaxOpts: gaxOptions,
265+
{
266+
client: 'BigtableInstanceAdminClient',
267+
method: 'getAppProfile',
268+
reqOpts: {
269+
name: this.name,
269270
},
270-
(...args) => {
271-
if (args[1]) {
272-
this.metadata = args[1];
273-
}
271+
gaxOpts: gaxOptions,
272+
},
273+
(...args) => {
274+
if (args[1]) {
275+
this.metadata = args[1];
276+
}
274277

275-
callback(...args);
276-
});
278+
callback(...args);
279+
}
280+
);
277281
}
278282

279283
/**
@@ -323,13 +327,14 @@ Please use the format 'my-app-profile' or '${
323327
}
324328

325329
this.bigtable.request(
326-
{
327-
client: 'BigtableInstanceAdminClient',
328-
method: 'updateAppProfile',
329-
reqOpts,
330-
gaxOpts: gaxOptions,
331-
},
332-
callback);
330+
{
331+
client: 'BigtableInstanceAdminClient',
332+
method: 'updateAppProfile',
333+
reqOpts,
334+
gaxOpts: gaxOptions,
335+
},
336+
callback
337+
);
333338
}
334339
}
335340

handwritten/bigtable/src/chunktransformer.ts

Lines changed: 92 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ import {Transform, TransformOptions} from 'stream';
1717

1818
import {Bytes, Mutation} from './mutation';
1919

20-
export type Value = string|number|boolean|Uint8Array;
20+
export type Value = string | number | boolean | Uint8Array;
2121

2222
export interface Chunk {
2323
rowContents: Value;
2424
commitRow: boolean;
2525
resetRow: boolean;
26-
rowKey?: string|Uint8Array;
26+
rowKey?: string | Uint8Array;
2727
familyName?: {value: string};
28-
qualifier?: Qualifier|{value: Value};
29-
timestampMicros?: number|Long;
28+
qualifier?: Qualifier | {value: Value};
29+
timestampMicros?: number | Long;
3030
labels?: string[];
31-
value?: string|Buffer;
31+
value?: string | Buffer;
3232
valueSize?: number;
3333
}
3434
export interface Data {
@@ -39,9 +39,9 @@ interface Family {
3939
[qualifier: string]: Qualifier[];
4040
}
4141
export interface Qualifier {
42-
value?: string|Buffer;
42+
value?: string | Buffer;
4343
labels?: string[];
44-
timestamp?: number|Long;
44+
timestamp?: number | Long;
4545
size?: number;
4646
}
4747
export interface Row {
@@ -50,7 +50,7 @@ export interface Row {
5050
}
5151
export interface TransformErrorProps {
5252
message: string;
53-
chunk: Chunk|null;
53+
chunk: Chunk | null;
5454
}
5555

5656
class TransformError extends Error {
@@ -88,7 +88,7 @@ export class ChunkTransformer extends Transform {
8888
qualifiers?: Qualifier[];
8989
qualifier?: Qualifier;
9090
constructor(options: TransformOptions = {}) {
91-
options.objectMode = true; // forcing object mode
91+
options.objectMode = true; // forcing object mode
9292
super(options);
9393
this.options = options;
9494
this._destroyed = false;
@@ -103,10 +103,12 @@ export class ChunkTransformer extends Transform {
103103
*/
104104
_flush(cb: Function): void {
105105
if (typeof this.row!.key !== 'undefined') {
106-
this.destroy(new TransformError({
107-
message: 'Response ended with pending row without commit',
108-
chunk: null,
109-
}));
106+
this.destroy(
107+
new TransformError({
108+
message: 'Response ended with pending row without commit',
109+
chunk: null,
110+
})
111+
);
110112
return;
111113
}
112114
cb();
@@ -149,10 +151,12 @@ export class ChunkTransformer extends Transform {
149151
}
150152
}
151153
if (data.lastScannedRowKey && data.lastScannedRowKey.length > 0) {
152-
this.lastRowKey =
153-
Mutation.convertFromBytes(data.lastScannedRowKey as Bytes, {
154-
userOptions: this.options,
155-
});
154+
this.lastRowKey = Mutation.convertFromBytes(
155+
data.lastScannedRowKey as Bytes,
156+
{
157+
userOptions: this.options,
158+
}
159+
);
156160
}
157161
next();
158162
}
@@ -200,10 +204,12 @@ export class ChunkTransformer extends Transform {
200204
*/
201205
validateValueSizeAndCommitRow(chunk: Chunk): void {
202206
if (chunk.valueSize! > 0 && chunk.commitRow) {
203-
this.destroy(new TransformError({
204-
message: 'A row cannot be have a value size and be a commit row',
205-
chunk,
206-
}));
207+
this.destroy(
208+
new TransformError({
209+
message: 'A row cannot be have a value size and be a commit row',
210+
chunk,
211+
})
212+
);
207213
}
208214
}
209215

@@ -213,14 +219,19 @@ export class ChunkTransformer extends Transform {
213219
* @param {chunk} chunk chunk to validate for resetrow
214220
*/
215221
validateResetRow(chunk: Chunk): void {
216-
const containsData = (chunk.rowKey && chunk.rowKey.length !== 0) ||
217-
chunk.familyName || chunk.qualifier ||
218-
(chunk.value && chunk.value.length !== 0) || chunk.timestampMicros! > 0;
222+
const containsData =
223+
(chunk.rowKey && chunk.rowKey.length !== 0) ||
224+
chunk.familyName ||
225+
chunk.qualifier ||
226+
(chunk.value && chunk.value.length !== 0) ||
227+
chunk.timestampMicros! > 0;
219228
if (chunk.resetRow && containsData) {
220-
this.destroy(new TransformError({
221-
message: 'A reset should have no data',
222-
chunk,
223-
}));
229+
this.destroy(
230+
new TransformError({
231+
message: 'A reset should have no data',
232+
chunk,
233+
})
234+
);
224235
}
225236
}
226237

@@ -230,16 +241,18 @@ export class ChunkTransformer extends Transform {
230241
* @param {chunk} chunk chunk to validate
231242
* @param {newRowKey} newRowKey newRowKey of the new row
232243
*/
233-
validateNewRow(chunk: Chunk, newRowKey: string|Buffer): void {
244+
validateNewRow(chunk: Chunk, newRowKey: string | Buffer): void {
234245
const row = this.row;
235246
const lastRowKey = this.lastRowKey;
236-
let errorMessage: string|undefined;
247+
let errorMessage: string | undefined;
237248

238249
if (typeof row!.key !== 'undefined') {
239250
errorMessage = 'A new row cannot have existing state';
240251
} else if (
241-
typeof chunk.rowKey === 'undefined' || chunk.rowKey.length === 0 ||
242-
newRowKey.length === 0) {
252+
typeof chunk.rowKey === 'undefined' ||
253+
chunk.rowKey.length === 0 ||
254+
newRowKey.length === 0
255+
) {
243256
errorMessage = 'A row key must be set';
244257
} else if (chunk.resetRow) {
245258
errorMessage = 'A new row cannot be reset';
@@ -269,21 +282,31 @@ export class ChunkTransformer extends Transform {
269282
userOptions: this.options,
270283
});
271284
const oldRowKey = row!.key || '';
272-
if (newRowKey && chunk.rowKey && (newRowKey as string).length !== 0 &&
273-
newRowKey.toString() !== oldRowKey.toString()) {
274-
this.destroy(new TransformError({
275-
message: 'A commit is required between row keys',
276-
chunk,
277-
}));
285+
if (
286+
newRowKey &&
287+
chunk.rowKey &&
288+
(newRowKey as string).length !== 0 &&
289+
newRowKey.toString() !== oldRowKey.toString()
290+
) {
291+
this.destroy(
292+
new TransformError({
293+
message: 'A commit is required between row keys',
294+
chunk,
295+
})
296+
);
278297
return;
279298
}
280299
}
281-
if (chunk.familyName &&
282-
(chunk.qualifier === null || chunk.qualifier === undefined)) {
283-
this.destroy(new TransformError({
284-
message: 'A qualifier must be specified',
285-
chunk,
286-
}));
300+
if (
301+
chunk.familyName &&
302+
(chunk.qualifier === null || chunk.qualifier === undefined)
303+
) {
304+
this.destroy(
305+
new TransformError({
306+
message: 'A qualifier must be specified',
307+
chunk,
308+
})
309+
);
287310
return;
288311
}
289312
this.validateResetRow(chunk);
@@ -335,11 +358,13 @@ export class ChunkTransformer extends Transform {
335358
row!.key = newRowKey;
336359
row!.data = {} as Data;
337360
this.family = row!.data![chunk.familyName.value] = {} as Family;
338-
const qualifierName =
339-
Mutation.convertFromBytes(chunk.qualifier.value as Bytes, {
340-
userOptions: this.options,
341-
});
342-
this.qualifiers = this.family[qualifierName as {} as string] = [];
361+
const qualifierName = Mutation.convertFromBytes(
362+
chunk.qualifier.value as Bytes,
363+
{
364+
userOptions: this.options,
365+
}
366+
);
367+
this.qualifiers = this.family[(qualifierName as {}) as string] = [];
343368
this.qualifier = {
344369
value: Mutation.convertFromBytes(chunk.value! as Bytes, {
345370
userOptions: this.options,
@@ -366,15 +391,17 @@ export class ChunkTransformer extends Transform {
366391
const row = this.row;
367392
if (chunk.familyName) {
368393
this.family = row!.data![chunk.familyName.value] =
369-
row!.data![chunk.familyName.value] || {};
394+
row!.data![chunk.familyName.value] || {};
370395
}
371396
if (chunk.qualifier) {
372-
const qualifierName =
373-
Mutation.convertFromBytes(chunk.qualifier.value as Bytes, {
374-
userOptions: this.options,
375-
}) as string;
397+
const qualifierName = Mutation.convertFromBytes(
398+
chunk.qualifier.value as Bytes,
399+
{
400+
userOptions: this.options,
401+
}
402+
) as string;
376403
this.qualifiers = this.family![qualifierName] =
377-
this.family![qualifierName] || [];
404+
this.family![qualifierName] || [];
378405
}
379406
this.qualifier = {
380407
value: Mutation.convertFromBytes(chunk.value! as Bytes, {
@@ -398,13 +425,17 @@ export class ChunkTransformer extends Transform {
398425
if (chunk.resetRow) {
399426
return this.reset();
400427
}
401-
const chunkQualifierValue =
402-
Mutation.convertFromBytes(chunk.value! as Bytes, {
403-
userOptions: this.options,
404-
});
428+
const chunkQualifierValue = Mutation.convertFromBytes(
429+
chunk.value! as Bytes,
430+
{
431+
userOptions: this.options,
432+
}
433+
);
405434

406-
if (chunkQualifierValue instanceof Buffer &&
407-
this.qualifier!.value instanceof Buffer) {
435+
if (
436+
chunkQualifierValue instanceof Buffer &&
437+
this.qualifier!.value instanceof Buffer
438+
) {
408439
this.qualifier!.value = Buffer.concat([
409440
this.qualifier!.value,
410441
chunkQualifierValue,

0 commit comments

Comments
 (0)