Skip to content

Commit

Permalink
refactor: run gts fix (#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored Dec 2, 2018
1 parent 23906fb commit 8d08ac2
Show file tree
Hide file tree
Showing 10 changed files with 317 additions and 345 deletions.
6 changes: 3 additions & 3 deletions src/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class Key {
*/
Object.defineProperty(this, 'path', {
enumerable: true,
get: function() {
get() {
return arrify(this.parent && this.parent.path).concat([
this.kind,
this.name || this.id,
Expand Down Expand Up @@ -880,14 +880,14 @@ function queryToQueryProto(query) {
name: filter.name,
},
op: OP_TO_OPERATOR[filter.op],
value: value,
value,
},
};
});

queryProto.filter = {
compositeFilter: {
filters: filters,
filters,
op: 'AND',
},
};
Expand Down
14 changes: 7 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ class Datastore extends DatastoreRequest {
*/
static int(value) {
return new entity.Int(value);
};
}

int(value) {
return Datastore.int(value);
Expand All @@ -564,7 +564,7 @@ class Datastore extends DatastoreRequest {
*/
static isInt(value) {
return entity.isDsInt(value);
};
}

isInt(value) {
return Datastore.isInt(value);
Expand Down Expand Up @@ -644,7 +644,7 @@ class Datastore extends DatastoreRequest {
namespace = this.namespace;
}
return new Query(this, namespace, arrify(kind));
};
}

/**
* Helper to create a Key object, scoped to the instance's namespace by default.
Expand Down Expand Up @@ -702,7 +702,7 @@ class Datastore extends DatastoreRequest {
path: arrify(options),
};
return new entity.Key(options);
};
}

/**
* Helper function to check if something is a Datastore Key object.
Expand All @@ -718,7 +718,7 @@ class Datastore extends DatastoreRequest {
*/
static isKey(value) {
return entity.isDsKey(value);
};
}
isKey(value) {
return Datastore.isKey(value);
}
Expand All @@ -739,7 +739,7 @@ class Datastore extends DatastoreRequest {
*/
transaction(options?) {
return new Transaction(this, options);
};
}

/**
* Determine the appropriate endpoint to use for API requests. If not explicitly
Expand Down Expand Up @@ -772,7 +772,7 @@ class Datastore extends DatastoreRequest {
.replace(leadingProtocol, '')
.replace(port, '')
.replace(trailingSlashes, '');
};
}

/**
* {@link DatastoreRequest} class.
Expand Down
2 changes: 1 addition & 1 deletion src/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class Query {
*/
order(property: string, options?) {
const sign = options && options.descending ? '-' : '+';
this.orders.push({name: property, sign: sign});
this.orders.push({name: property, sign});
return this;
}

Expand Down
14 changes: 7 additions & 7 deletions src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class DatastoreRequest {
const makeRequest = keys => {
// tslint:disable-next-line no-any
const reqOpts: any = {
keys: keys,
keys,
};

if (options.consistency) {
Expand All @@ -245,7 +245,7 @@ class DatastoreRequest {
{
client: 'DatastoreClient',
method: 'lookup',
reqOpts: reqOpts,
reqOpts,
gaxOpts: options.gaxOptions,
},
(err, resp) => {
Expand Down Expand Up @@ -355,7 +355,7 @@ class DatastoreRequest {
{
client: 'DatastoreClient',
method: 'commit',
reqOpts: reqOpts,
reqOpts,
gaxOpts: gaxOptions,
},
callback
Expand Down Expand Up @@ -660,7 +660,7 @@ class DatastoreRequest {
{
client: 'DatastoreClient',
method: 'runQuery',
reqOpts: reqOpts,
reqOpts,
gaxOpts: options.gaxOptions,
},
onResultSet
Expand Down Expand Up @@ -935,7 +935,7 @@ class DatastoreRequest {
}

const insertIndexes = {};
const mutations: {}[] = [];
const mutations: Array<{}> = [];
const methods = {
insert: true,
update: true,
Expand Down Expand Up @@ -1002,7 +1002,7 @@ class DatastoreRequest {
});

const reqOpts = {
mutations: mutations,
mutations,
};

function onCommit(err, resp) {
Expand Down Expand Up @@ -1035,7 +1035,7 @@ class DatastoreRequest {
{
client: 'DatastoreClient',
method: 'commit',
reqOpts: reqOpts,
reqOpts,
gaxOpts: gaxOptions,
},
onCommit
Expand Down
4 changes: 2 additions & 2 deletions src/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class Transaction extends DatastoreRequest {
{
client: 'DatastoreClient',
method: 'commit',
reqOpts: reqOpts,
reqOpts,
gaxOpts: gaxOptions,
},
(err, resp) => {
Expand Down Expand Up @@ -457,7 +457,7 @@ class Transaction extends DatastoreRequest {
{
client: 'DatastoreClient',
method: 'beginTransaction',
reqOpts: reqOpts,
reqOpts,
gaxOpts: options.gaxOptions,
},
(err, resp) => {
Expand Down
38 changes: 19 additions & 19 deletions system-test/datastore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {Datastore} from '../src';
import {entity} from '../src/entity';

describe('Datastore', () => {
const testKinds: {}[] = [];
const testKinds: Array<{}> = [];
const datastore = new Datastore();
// Override the Key method so we can track what keys are created during the
// tests. They are then deleted in the `after` hook.
Expand Down Expand Up @@ -81,38 +81,38 @@ describe('Datastore', () => {
const postKey = datastore.key(['Post', 'post1']);

const data = {
longString: longString,
longString,
notMetadata: true,
longStringArray: [longString],
metadata: {
longString: longString,
longString,
otherProperty: 'value',
obj: {
longStringArray: [
{
longString: longString,
longString,
nestedLongStringArray: [
{
longString: longString,
longString,
nestedProperty: true,
},
{
longString: longString,
longString,
},
],
},
],
},
longStringArray: [
{
longString: longString,
longString,
nestedLongStringArray: [
{
longString: longString,
longString,
nestedProperty: true,
},
{
longString: longString,
longString,
},
],
},
Expand All @@ -123,7 +123,7 @@ describe('Datastore', () => {
datastore.save(
{
key: postKey,
data: data,
data,
excludeFromIndexes: [
'longString',
'longStringArray[]',
Expand Down Expand Up @@ -189,7 +189,7 @@ describe('Datastore', () => {
buf: Buffer.from('010100000000000000000059400000000000006940', 'hex'),
};

datastore.save({key: postKey, data: data}, err => {
datastore.save({key: postKey, data}, err => {
assert.ifError(err);

const assignedId = postKey.id;
Expand Down Expand Up @@ -406,7 +406,7 @@ describe('Datastore', () => {

datastore.save(
{
key: key,
key,
data: {
year: integerType,
},
Expand All @@ -431,7 +431,7 @@ describe('Datastore', () => {

datastore.save(
{
key: key,
key,
data: {
nines: doubleType,
},
Expand Down Expand Up @@ -459,7 +459,7 @@ describe('Datastore', () => {

datastore.save(
{
key: key,
key,
data: {
location: geoPointType,
},
Expand Down Expand Up @@ -549,7 +549,7 @@ describe('Datastore', () => {
before(done => {
const keysToSave = keys.map((key, index) => {
return {
key: key,
key,
data: characters[index],
};
});
Expand Down Expand Up @@ -817,7 +817,7 @@ describe('Datastore', () => {
assert.ifError(err);
transaction.get(key, err => {
assert.ifError(err);
transaction.save({key: key, data: obj});
transaction.save({key, data: obj});
transaction.commit(err => {
assert.ifError(err);
datastore.get(key, (err, entity) => {
Expand Down Expand Up @@ -852,7 +852,7 @@ describe('Datastore', () => {

transaction.save([
{
key: key,
key,
data: {rating: 10},
},
{
Expand Down Expand Up @@ -906,7 +906,7 @@ describe('Datastore', () => {

transaction.save([
{
key: key,
key,
data: {
rating: 10,
},
Expand Down Expand Up @@ -969,7 +969,7 @@ describe('Datastore', () => {
assert.ifError(err);
transaction.get(key, err => {
assert.ifError(err);
transaction.save({key: key, data: {}});
transaction.save({key, data: {}});
transaction.commit(err => {
assert(err instanceof Error);
done();
Expand Down
6 changes: 3 additions & 3 deletions test/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ describe('entity', function() {
describe('Key', function() {
it('should assign the namespace', function() {
const namespace = 'NS';
const key = new entity.Key({namespace: namespace, path: []});
const key = new entity.Key({namespace, path: []});
assert.strictEqual(key.namespace, namespace);
});

Expand Down Expand Up @@ -295,7 +295,7 @@ describe('entity', function() {
const valueProto = {
valueType: 'timestampValue',
timestampValue: {
seconds: seconds,
seconds,
nanos: ms * 1e6,
},
};
Expand Down Expand Up @@ -1016,7 +1016,7 @@ describe('entity', function() {
const key = {};

const entityProto = {
key: key,
key,
};

const results = [
Expand Down
Loading

0 comments on commit 8d08ac2

Please sign in to comment.