Skip to content

Commit

Permalink
chore(deps): update dependency gts to v1 (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
renovate[bot] authored and JustinBeckwith committed May 3, 2019
1 parent 5426907 commit 549d480
Show file tree
Hide file tree
Showing 10 changed files with 630 additions and 462 deletions.
2 changes: 1 addition & 1 deletion packages/google-cloud-dns/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"eslint-config-prettier": "^4.0.0",
"eslint-plugin-node": "^9.0.0",
"eslint-plugin-prettier": "^3.0.0",
"gts": "^0.9.0",
"gts": "^1.0.0",
"intelli-espower-loader": "^1.0.1",
"jsdoc": "^3.5.5",
"jsdoc-baseline": "git+https://github.com/hegemonic/jsdoc-baseline.git",
Expand Down
15 changes: 8 additions & 7 deletions packages/google-cloud-dns/src/change.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ import {Record} from './record';
import {Zone} from './zone';

export interface CreateChangeRequest {
add?: Record|Record[];
delete?: Record|Record[];
add?: Record | Record[];
delete?: Record | Record[];
}

export type CreateChangeResponse = [Change, Metadata];

export interface CreateChangeCallback {
(err: Error|null, change?: Change|null, apiResponse?: Metadata): void;
(err: Error | null, change?: Change | null, apiResponse?: Metadata): void;
}

/**
Expand Down Expand Up @@ -191,7 +191,7 @@ export class Change extends ServiceObject {
* @type {string}
*/
id,
methods
methods,
});
}

Expand Down Expand Up @@ -233,11 +233,12 @@ export class Change extends ServiceObject {
* });
*/
create(
configOrCallback?: CreateChangeRequest|CreateChangeCallback,
callback?: CreateChangeCallback): void|Promise<CreateChangeResponse> {
configOrCallback?: CreateChangeRequest | CreateChangeCallback,
callback?: CreateChangeCallback
): void | Promise<CreateChangeResponse> {
const config = typeof configOrCallback === 'object' ? configOrCallback : {};
callback =
typeof configOrCallback === 'function' ? configOrCallback! : callback;
typeof configOrCallback === 'function' ? configOrCallback! : callback;
this.parent.createChange(config, (err, change, apiResponse) => {
if (err) {
callback!(err, null, apiResponse);
Expand Down
110 changes: 62 additions & 48 deletions packages/google-cloud-dns/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,18 @@ export interface DNSConfig extends GoogleAuthOptions {
}

export interface GetZonesCallback {
(err: Error|null, zones: Zone[]|null, nextQuery?: GetZonesRequest|null,
apiResponse?: Metadata): void;
(
err: Error | null,
zones: Zone[] | null,
nextQuery?: GetZonesRequest | null,
apiResponse?: Metadata
): void;
}

export type GetZonesResponse = [Zone[], GetZonesRequest | null, Metadata];

export interface GetZoneCallback {
(err: Error|null, zone?: Zone|null, apiResponse?: Metadata): void;
(err: Error | null, zone?: Zone | null, apiResponse?: Metadata): void;
}

export interface CreateZoneRequest {
Expand Down Expand Up @@ -122,7 +126,7 @@ class DNS extends Service {
'https://www.googleapis.com/auth/ndev.clouddns.readwrite',
'https://www.googleapis.com/auth/cloud-platform',
],
packageJson: require('../../package.json')
packageJson: require('../../package.json'),
};
super(config, options);

Expand Down Expand Up @@ -159,10 +163,15 @@ class DNS extends Service {
this.getZonesStream = paginator.streamify('getZones');
}

createZone(name: string, config: CreateZoneRequest):
Promise<CreateZoneResponse>;
createZone(
name: string, config: CreateZoneRequest, callback: GetZoneCallback): void;
name: string,
config: CreateZoneRequest
): Promise<CreateZoneResponse>;
createZone(
name: string,
config: CreateZoneRequest,
callback: GetZoneCallback
): void;
/**
* Config to set for the zone.
*
Expand Down Expand Up @@ -221,8 +230,10 @@ class DNS extends Service {
* });
*/
createZone(
name: string, config: CreateZoneRequest,
callback?: GetZoneCallback): void|Promise<CreateZoneResponse> {
name: string,
config: CreateZoneRequest,
callback?: GetZoneCallback
): void | Promise<CreateZoneResponse> {
if (!name) {
throw new Error('A zone name is required.');
}
Expand All @@ -233,20 +244,21 @@ class DNS extends Service {
// Required by the API.
config.description = config.description || '';
this.request(
{
method: 'POST',
uri: '/managedZones',
json: config,
},
(err, resp) => {
if (err) {
callback!(err, null, resp);
return;
}
const zone = this.zone(resp.name);
zone.metadata = resp;
callback!(null, zone, resp);
});
{
method: 'POST',
uri: '/managedZones',
json: config,
},
(err, resp) => {
if (err) {
callback!(err, null, resp);
return;
}
const zone = this.zone(resp.name);
zone.metadata = resp;
callback!(null, zone, resp);
}
);
}

getZones(query?: GetZonesRequest): Promise<GetZonesResponse>;
Expand Down Expand Up @@ -299,35 +311,37 @@ class DNS extends Service {
* });
*/
getZones(
queryOrCallback?: GetZonesRequest|GetZonesCallback,
callback?: GetZonesCallback): void|Promise<GetZonesResponse> {
queryOrCallback?: GetZonesRequest | GetZonesCallback,
callback?: GetZonesCallback
): void | Promise<GetZonesResponse> {
const query = typeof queryOrCallback === 'object' ? queryOrCallback : {};
callback =
typeof queryOrCallback === 'function' ? queryOrCallback : callback;
typeof queryOrCallback === 'function' ? queryOrCallback : callback;
this.request(
{
uri: '/managedZones',
qs: query,
},
(err, resp) => {
if (err) {
callback!(err, null, null, resp);
return;
}
// tslint:disable-next-line no-any
const zones = arrify(resp.managedZones).map((zone: any) => {
const zoneInstance = this.zone(zone.name);
zoneInstance.metadata = zone;
return zoneInstance;
});
let nextQuery: GetZonesRequest|null = null;
if (resp.nextPageToken) {
nextQuery = Object.assign({}, query, {
pageToken: resp.nextPageToken,
});
}
callback!(null, zones, nextQuery, resp);
{
uri: '/managedZones',
qs: query,
},
(err, resp) => {
if (err) {
callback!(err, null, null, resp);
return;
}
// tslint:disable-next-line no-any
const zones = arrify(resp.managedZones).map((zone: any) => {
const zoneInstance = this.zone(zone.name);
zoneInstance.metadata = zone;
return zoneInstance;
});
let nextQuery: GetZonesRequest | null = null;
if (resp.nextPageToken) {
nextQuery = Object.assign({}, query, {
pageToken: resp.nextPageToken,
});
}
callback!(null, zones, nextQuery, resp);
}
);
}

/**
Expand Down
18 changes: 10 additions & 8 deletions packages/google-cloud-dns/src/record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface RecordObject {

export interface RecordMetadata {
name: string;
data: string|string[];
data: string | string[];
ttl: number;
type?: string;
signatureRrdatas?: string[];
Expand All @@ -51,7 +51,7 @@ export type DeleteRecordResponse = [Change, r.Response];
* @param {object} apiResponse The full API response.
*/
export interface DeleteRecordCallback {
(err: Error|null, change?: Change, apiResponse?: r.Response): void;
(err: Error | null, change?: Change, apiResponse?: r.Response): void;
}

/**
Expand Down Expand Up @@ -151,7 +151,9 @@ export class Record implements RecordObject {
* const apiResponse = data[1];
* });
*/
delete(callback?: CreateChangeCallback): void|Promise<DeleteRecordResponse> {
delete(
callback?: CreateChangeCallback
): void | Promise<DeleteRecordResponse> {
this.zone_.deleteRecords(this, callback!);
}
/**
Expand All @@ -177,11 +179,11 @@ export class Record implements RecordObject {
toString() {
const json = this.toJSON();
return (json.rrdatas || [{}])
.map(data => {
json.rrdata = data;
return format('{name} {ttl} IN {type} {rrdata}', json);
})
.join('\n');
.map(data => {
json.rrdata = data;
return format('{name} {ttl} IN {type} {rrdata}', json);
})
.join('\n');
}
/**
* Create a Record instance from a resource record set in a zone file.
Expand Down
Loading

0 comments on commit 549d480

Please sign in to comment.