Skip to content

Commit 2adbe31

Browse files
renovate[bot]JustinBeckwith
authored andcommitted
chore(deps): update dependency gts to v1 (#383)
1 parent 8374d68 commit 2adbe31

14 files changed

Lines changed: 1156 additions & 915 deletions

File tree

handwritten/datastore/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"eslint-plugin-node": "^9.0.0",
7979
"eslint-plugin-prettier": "^3.0.0",
8080
"google-proto-files": "^0.20.0",
81-
"gts": "^0.9.0",
81+
"gts": "^1.0.0",
8282
"intelli-espower-loader": "^1.0.1",
8383
"jsdoc": "^3.5.5",
8484
"jsdoc-baseline": "git+https://github.com/hegemonic/jsdoc-baseline.git",

handwritten/datastore/src/entity.ts

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export namespace entity {
9191
*/
9292
export class Int {
9393
value: string;
94-
constructor(value: number|string) {
94+
constructor(value: number | string) {
9595
/**
9696
* @name Int#value
9797
* @type {string}
@@ -162,7 +162,7 @@ export namespace entity {
162162

163163
export interface KeyOptions {
164164
namespace?: string;
165-
path: Array<string|number>;
165+
path: Array<string | number>;
166166
}
167167

168168
/**
@@ -216,7 +216,7 @@ export namespace entity {
216216
name?: string;
217217
kind: string;
218218
parent?: Key;
219-
path!: Array<string|number>;
219+
path!: Array<string | number>;
220220

221221
constructor(options: KeyOptions) {
222222
/**
@@ -231,7 +231,7 @@ export namespace entity {
231231
const identifier = options.path.pop();
232232

233233
if (is.number(identifier) || isDsInt(identifier)) {
234-
this.id = ((identifier as {} as Int).value || identifier) as string;
234+
this.id = (((identifier as {}) as Int).value || identifier) as string;
235235
} else if (is.string(identifier)) {
236236
this.name = identifier as string;
237237
}
@@ -333,7 +333,9 @@ export namespace entity {
333333
return new Date(Number(value.seconds) * 1000 + milliseconds);
334334
}
335335

336-
default: { return value; }
336+
default: {
337+
return value;
338+
}
337339
}
338340
}
339341

@@ -519,14 +521,14 @@ export namespace entity {
519521
const entityProto: EntityProto = {
520522
key: null,
521523

522-
properties: Object.keys(properties)
523-
.reduce(
524-
(encoded, key) => {
525-
encoded[key] = entity.encodeValue(properties[key]);
526-
return encoded;
527-
},
528-
// tslint:disable-next-line no-any
529-
{} as any),
524+
properties: Object.keys(properties).reduce(
525+
(encoded, key) => {
526+
encoded[key] = entity.encodeValue(properties[key]);
527+
return encoded;
528+
},
529+
// tslint:disable-next-line no-any
530+
{} as any
531+
),
530532
};
531533

532534
if (excludeFromIndexes && excludeFromIndexes.length > 0) {
@@ -547,9 +549,11 @@ export namespace entity {
547549
if (!hasArrayPath && !hasEntityPath) {
548550
// This is the path end node. Traversal ends here in either case.
549551
if (entity.properties) {
550-
if (entity.properties[path] &&
551-
// array properties should be excluded with [] syntax:
552-
!entity.properties[path].arrayValue) {
552+
if (
553+
entity.properties[path] &&
554+
// array properties should be excluded with [] syntax:
555+
!entity.properties[path].arrayValue
556+
) {
553557
// This is the property to exclude!
554558
entity.properties[path].excludeFromIndexes = true;
555559
}
@@ -580,9 +584,11 @@ export namespace entity {
580584
return;
581585
}
582586

583-
if (firstPathPartIsArray &&
584-
// check also if the property in question is actually an array value.
585-
entity.properties[firstPathPart].arrayValue) {
587+
if (
588+
firstPathPartIsArray &&
589+
// check also if the property in question is actually an array value.
590+
entity.properties[firstPathPart].arrayValue
591+
) {
586592
const array = entity.properties[firstPathPart].arrayValue;
587593
// tslint:disable-next-line no-any
588594
array.values.forEach((value: any) => {
@@ -591,15 +597,15 @@ export namespace entity {
591597
// equivalent with excluding all its values
592598
// (including entity values at their roots):
593599
excludePathFromEntity(
594-
value,
595-
remainderPath // === ''
600+
value,
601+
remainderPath // === ''
596602
);
597603
} else {
598604
// Path traversal continues at value.entityValue,
599605
// if it is an entity, or must end at value.
600606
excludePathFromEntity(
601-
value.entityValue || value,
602-
remainderPath // !== ''
607+
value.entityValue || value,
608+
remainderPath // !== ''
603609
);
604610
}
605611
});
@@ -915,7 +921,7 @@ export interface ValueProto {
915921
}
916922

917923
export interface EntityProto {
918-
key: KeyProto|null;
924+
key: KeyProto | null;
919925
// tslint:disable-next-line no-any
920926
properties: any;
921927
excludeFromIndexes?: boolean;
@@ -927,7 +933,9 @@ export type Entity = any;
927933
export interface KeyProto {
928934
path: Array<{
929935
// tslint:disable-next-line no-any
930-
[index: string]: any; id: string; name: string;
936+
[index: string]: any;
937+
id: string;
938+
name: string;
931939
kind?: string;
932940
idType?: string;
933941
}>;

handwritten/datastore/src/index.ts

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ class Datastore extends DatastoreRequest {
395395
this.namespace = options.namespace;
396396

397397
const userProvidedProjectId =
398-
options.projectId || process.env.DATASTORE_PROJECT_ID;
398+
options.projectId || process.env.DATASTORE_PROJECT_ID;
399399
const defaultProjectId = '{{projectId}}';
400400

401401
/**
@@ -408,15 +408,16 @@ class Datastore extends DatastoreRequest {
408408
this.determineBaseUrl_(options.apiEndpoint);
409409

410410
this.options = Object.assign(
411-
{
412-
libName: 'gccl',
413-
libVersion: require('../../package.json').version,
414-
scopes: gapic.v1.DatastoreClient.scopes,
415-
servicePath: this.baseUrl_,
416-
port: is.number(this.port_) ? this.port_ : 443,
417-
projectId: userProvidedProjectId,
418-
},
419-
options);
411+
{
412+
libName: 'gccl',
413+
libVersion: require('../../package.json').version,
414+
scopes: gapic.v1.DatastoreClient.scopes,
415+
servicePath: this.baseUrl_,
416+
port: is.number(this.port_) ? this.port_ : 443,
417+
projectId: userProvidedProjectId,
418+
},
419+
options
420+
);
420421
if (this.customEndpoint_) {
421422
this.options.sslCreds = grpc.credentials.createInsecure();
422423
}
@@ -536,11 +537,11 @@ class Datastore extends DatastoreRequest {
536537
* datastore.int('100000000000001234')
537538
* ]);
538539
*/
539-
static int(value: number|string) {
540+
static int(value: number | string) {
540541
return new entity.Int(value);
541542
}
542543

543-
int(value: number|string) {
544+
int(value: number | string) {
544545
return Datastore.int(value);
545546
}
546547

@@ -635,8 +636,10 @@ class Datastore extends DatastoreRequest {
635636
* const datastore = new Datastore();
636637
* const query = datastore.createQuery('Company');
637638
*/
638-
createQuery(namespaceOrKind?: string|string[], kind?: string|string[]):
639-
Query {
639+
createQuery(
640+
namespaceOrKind?: string | string[],
641+
kind?: string | string[]
642+
): Query {
640643
let namespace = namespaceOrKind as string;
641644
if (arguments.length < 2) {
642645
kind = namespaceOrKind;
@@ -697,11 +700,13 @@ class Datastore extends DatastoreRequest {
697700
* path: ['Company', 123]
698701
* });
699702
*/
700-
key(options: string|entity.KeyOptions|PathType[]): entity.Key {
701-
options = is.object(options) ? options : {
702-
namespace: this.namespace,
703-
path: arrify(options) as PathType[],
704-
};
703+
key(options: string | entity.KeyOptions | PathType[]): entity.Key {
704+
options = is.object(options)
705+
? options
706+
: {
707+
namespace: this.namespace,
708+
path: arrify(options) as PathType[],
709+
};
705710
return new entity.Key(options as entity.KeyOptions);
706711
}
707712

@@ -769,9 +774,10 @@ class Datastore extends DatastoreRequest {
769774
this.port_ = Number(baseUrl.match(port)![1]);
770775
}
771776

772-
this.baseUrl_ = baseUrl.replace(leadingProtocol, '')
773-
.replace(port, '')
774-
.replace(trailingSlashes, '');
777+
this.baseUrl_ = baseUrl
778+
.replace(leadingProtocol, '')
779+
.replace(port, '')
780+
.replace(trailingSlashes, '');
775781
}
776782

777783
/**

handwritten/datastore/src/query.ts

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ import {Datastore} from '.';
2020
import {Entity} from './entity';
2121
import {Transaction} from './transaction';
2222

23-
export type Operator = '='|'<'|'>'|'<='|'>='|'HAS_ANCESTOR';
23+
export type Operator = '=' | '<' | '>' | '<=' | '>=' | 'HAS_ANCESTOR';
2424

2525
export interface OrderOptions {
2626
descending?: boolean;
2727
}
2828

2929
export interface Order {
3030
name: string;
31-
sign: '-'|'+';
31+
sign: '-' | '+';
3232
}
3333

3434
export interface Filter {
@@ -58,24 +58,29 @@ export interface Filter {
5858
* const query = datastore.createQuery('AnimalNamespace', 'Lion');
5959
*/
6060
class Query {
61-
scope?: Datastore|Transaction;
62-
namespace?: string|null;
61+
scope?: Datastore | Transaction;
62+
namespace?: string | null;
6363
kinds: string[];
6464
filters: Filter[];
6565
orders: Order[];
6666
groupByVal: Array<{}>;
6767
selectVal: Array<{}>;
68-
startVal: string|Buffer|null;
69-
endVal: string|Buffer|null;
68+
startVal: string | Buffer | null;
69+
endVal: string | Buffer | null;
7070
limitVal: number;
7171
offsetVal: number;
7272

73-
constructor(scope?: Datastore|Transaction, kinds?: string[]|null);
73+
constructor(scope?: Datastore | Transaction, kinds?: string[] | null);
7474
constructor(
75-
scope?: Datastore|Transaction, namespace?: string|null, kinds?: string[]);
75+
scope?: Datastore | Transaction,
76+
namespace?: string | null,
77+
kinds?: string[]
78+
);
7679
constructor(
77-
scope?: Datastore|Transaction, namespaceOrKinds?: string|string[]|null,
78-
kinds?: string[]) {
80+
scope?: Datastore | Transaction,
81+
namespaceOrKinds?: string | string[] | null,
82+
kinds?: string[]
83+
) {
7984
let namespace = namespaceOrKinds as string | null;
8085
if (!kinds) {
8186
kinds = namespaceOrKinds as string[];
@@ -260,7 +265,7 @@ class Query {
260265
* const companyQuery = datastore.createQuery('Company');
261266
* const groupedQuery = companyQuery.groupBy(['name', 'size']);
262267
*/
263-
groupBy(fieldNames: string|string[]) {
268+
groupBy(fieldNames: string | string[]) {
264269
this.groupByVal = arrify(fieldNames);
265270
return this;
266271
}
@@ -287,7 +292,7 @@ class Query {
287292
* // Only retrieve the name and size properties.
288293
* const selectQuery = companyQuery.select(['name', 'size']);
289294
*/
290-
select(fieldNames: string|string[]) {
295+
select(fieldNames: string | string[]) {
291296
this.selectVal = arrify(fieldNames);
292297
return this;
293298
}
@@ -310,7 +315,7 @@ class Query {
310315
* // Retrieve results starting from cursorToken.
311316
* const startQuery = companyQuery.start(cursorToken);
312317
*/
313-
start(start: string|Buffer) {
318+
start(start: string | Buffer) {
314319
this.startVal = start;
315320
return this;
316321
}
@@ -333,7 +338,7 @@ class Query {
333338
* // Retrieve results limited to the extent of cursorToken.
334339
* const endQuery = companyQuery.end(cursorToken);
335340
*/
336-
end(end: string|Buffer) {
341+
end(end: string | Buffer) {
337342
this.endVal = end;
338343
return this;
339344
}
@@ -438,13 +443,15 @@ class Query {
438443
* const entities = data[0];
439444
* });
440445
*/
441-
run(optionsOrCallback?: RunQueryOptions|RunQueryCallback,
442-
cb?: RunQueryCallback): void|Promise<RunQueryResponse> {
446+
run(
447+
optionsOrCallback?: RunQueryOptions | RunQueryCallback,
448+
cb?: RunQueryCallback
449+
): void | Promise<RunQueryResponse> {
443450
const query = this as Query;
444451
const options =
445-
typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
452+
typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
446453
const callback =
447-
typeof optionsOrCallback === 'function' ? optionsOrCallback : cb!;
454+
typeof optionsOrCallback === 'function' ? optionsOrCallback : cb!;
448455
const runQuery = this.scope!.runQuery.bind(this.scope);
449456
return (runQuery as Function)(query, options, callback);
450457
}
@@ -491,12 +498,12 @@ class Query {
491498
}
492499

493500
export interface QueryProto {
494-
startCursor?: string|Buffer;
501+
startCursor?: string | Buffer;
495502
distinctOn: {};
496503
kind: {};
497504
order: {};
498505
projection: {};
499-
endCursor?: string|Buffer;
506+
endCursor?: string | Buffer;
500507
limit?: {};
501508
offset?: number;
502509
filter?: {};
@@ -510,17 +517,19 @@ export interface QueryProto {
510517
export {Query};
511518

512519
export interface RunQueryOptions {
513-
consistency?: 'strong'|'eventual';
520+
consistency?: 'strong' | 'eventual';
514521
}
515522

516523
export interface RunQueryCallback {
517-
(err: Error|null, entities?: Entity[], info?: RunQueryInfo): void;
524+
(err: Error | null, entities?: Entity[], info?: RunQueryInfo): void;
518525
}
519526

520527
export type RunQueryResponse = [Entity[], RunQueryInfo];
521528

522529
export interface RunQueryInfo {
523530
endCursor?: string;
524-
moreResults?: 'MORE_RESULTS_AFTER_LIMIT'|'MORE_RESULTS_AFTER_CURSOR'|
525-
'NO_MORE_RESULTS';
531+
moreResults?:
532+
| 'MORE_RESULTS_AFTER_LIMIT'
533+
| 'MORE_RESULTS_AFTER_CURSOR'
534+
| 'NO_MORE_RESULTS';
526535
}

0 commit comments

Comments
 (0)