Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(deps): opn -> open #1778

Merged
merged 4 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions samples/oauth2-codeVerifier.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017, Google, Inc.
// Copyright 2017 Google LLC
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand All @@ -16,7 +16,7 @@
const {OAuth2Client} = require('google-auth-library');
const http = require('http');
const url = require('url');
const opn = require('opn');
const open = require('open');
const destroyer = require('server-destroy');

// Download your OAuth2 configuration from the Google Developer Console.
Expand Down Expand Up @@ -95,7 +95,7 @@ async function getAuthenticatedClient() {
})
.listen(3000, () => {
// open the browser to the authorize url to start the workflow
opn(authorizeUrl, {wait: false}).then(cp => cp.unref());
open(authorizeUrl, {wait: false}).then(cp => cp.unref());
});
destroyer(server);
});
Expand Down
6 changes: 3 additions & 3 deletions samples/oauth2.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017, Google, Inc.
// Copyright 2017 Google LLC
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand All @@ -16,7 +16,7 @@
const {OAuth2Client} = require('google-auth-library');
const http = require('http');
const url = require('url');
const opn = require('opn');
const open = require('open');
const destroyer = require('server-destroy');

// Download your OAuth2 configuration from the Google
Expand Down Expand Up @@ -88,7 +88,7 @@ function getAuthenticatedClient() {
})
.listen(3000, () => {
// open the browser to the authorize url to start the workflow
opn(authorizeUrl, {wait: false}).then(cp => cp.unref());
open(authorizeUrl, {wait: false}).then(cp => cp.unref());
});
destroyer(server);
});
Expand Down
2 changes: 1 addition & 1 deletion samples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@googleapis/iam": "^15.0.0",
"google-auth-library": "^9.7.0",
"node-fetch": "^2.3.0",
"opn": "^6.0.0",
"open": "^6.0.0",
"server-destroy": "^1.0.1"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions samples/verifyIdToken.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017, Google, Inc.
// Copyright 2017 Google LLC
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand All @@ -16,7 +16,7 @@
const {OAuth2Client} = require('google-auth-library');
const http = require('http');
const url = require('url');
const opn = require('opn');
const open = require('open');
const destroyer = require('server-destroy');

// Download your OAuth2 configuration from the Google
Expand Down Expand Up @@ -87,7 +87,7 @@ function getAuthenticatedClient() {
})
.listen(3000, () => {
// open the browser to the authorize url to start the workflow
opn(authorizeUrl, {wait: false}).then(cp => cp.unref());
open(authorizeUrl, {wait: false}).then(cp => cp.unref());
});
destroyer(server);
});
Expand Down
4 changes: 2 additions & 2 deletions src/auth/computeclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ export class Compute extends OAuth2Client {
this.scopes = Array.isArray(options.scopes)
? options.scopes
: options.scopes
? [options.scopes]
: [];
? [options.scopes]
: [];
}

/**
Expand Down
5 changes: 2 additions & 3 deletions src/transporters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,8 @@ export class DefaultTransporter implements Transporter {
if (!uaValue) {
opts.headers['User-Agent'] = DefaultTransporter.USER_AGENT;
} else if (!uaValue.includes(`${PRODUCT_NAME}/`)) {
opts.headers[
'User-Agent'
] = `${uaValue} ${DefaultTransporter.USER_AGENT}`;
opts.headers['User-Agent'] =
`${uaValue} ${DefaultTransporter.USER_AGENT}`;
}
// track google-auth-library-nodejs version:
if (!opts.headers['x-goog-api-client']) {
Expand Down
4 changes: 2 additions & 2 deletions test/test.downscopedclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import * as nock from 'nock';
import * as sinon from 'sinon';

import {GaxiosError, GaxiosOptions, GaxiosPromise} from 'gaxios';

Check warning on line 20 in test/test.downscopedclient.ts

View workflow job for this annotation

GitHub Actions / lint

'GaxiosOptions' is defined but never used
import {Credentials} from '../src/auth/credentials';
import {StsSuccessfulResponse} from '../src/auth/stscredentials';
import {
Expand Down Expand Up @@ -54,11 +54,11 @@
this.credentials.expiry_date = expirationTime;
}

async getRequestHeaders(url?: string): Promise<Headers> {
async getRequestHeaders(): Promise<Headers> {
throw new Error('Not implemented.');
}

request<T>(opts: GaxiosOptions): GaxiosPromise<T> {
request<T>(): GaxiosPromise<T> {
throw new Error('Not implemented.');
}
}
Expand Down
1 change: 0 additions & 1 deletion test/test.jwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ describe('jwt', () => {
const keypair = require('keypair');
const PEM_PATH = './test/fixtures/private.pem';
const PEM_CONTENTS = fs.readFileSync(PEM_PATH, 'utf8');
const P12_PATH = './test/fixtures/key.p12';

nock.disableNetConnect();

Expand Down
30 changes: 12 additions & 18 deletions test/test.oauth2common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,8 @@ describe('OAuthClientAuthHandler', () => {
};
const actualOptions = Object.assign({}, originalOptions);
const expectedOptions = Object.assign({}, originalOptions);
(
expectedOptions.headers as Headers
).Authorization = `Basic ${expectedBase64EncodedCred}`;
(expectedOptions.headers as Headers).Authorization =
`Basic ${expectedBase64EncodedCred}`;

handler.testApplyClientAuthenticationOptions(actualOptions);
assert.deepStrictEqual(expectedOptions, actualOptions);
Expand All @@ -127,9 +126,8 @@ describe('OAuthClientAuthHandler', () => {
};
const actualOptions = Object.assign({}, originalOptions);
const expectedOptions = Object.assign({}, originalOptions);
(
expectedOptions.headers as Headers
).Authorization = `Basic ${expectedBase64EncodedCredNoSecret}`;
(expectedOptions.headers as Headers).Authorization =
`Basic ${expectedBase64EncodedCredNoSecret}`;

handler.testApplyClientAuthenticationOptions(actualOptions);
assert.deepStrictEqual(expectedOptions, actualOptions);
Expand All @@ -146,9 +144,8 @@ describe('OAuthClientAuthHandler', () => {
};
const actualOptions = Object.assign({}, originalOptions);
const expectedOptions = Object.assign({}, originalOptions);
(
expectedOptions.headers as Headers
).Authorization = `Basic ${expectedBase64EncodedCred}`;
(expectedOptions.headers as Headers).Authorization =
`Basic ${expectedBase64EncodedCred}`;

handler.testApplyClientAuthenticationOptions(actualOptions);
assert.deepStrictEqual(expectedOptions, actualOptions);
Expand Down Expand Up @@ -349,9 +346,8 @@ describe('OAuthClientAuthHandler', () => {
};
const actualOptions = Object.assign({}, originalOptions);
const expectedOptions = Object.assign({}, originalOptions);
(
expectedOptions.headers as Headers
).Authorization = `Bearer ${bearerToken}`;
(expectedOptions.headers as Headers).Authorization =
`Bearer ${bearerToken}`;

handler.testApplyClientAuthenticationOptions(actualOptions, bearerToken);
assert.deepStrictEqual(expectedOptions, actualOptions);
Expand All @@ -374,9 +370,8 @@ describe('OAuthClientAuthHandler', () => {
const actualOptions = Object.assign({}, originalOptions);
// Expected options should have bearer token in header.
const expectedOptions = Object.assign({}, originalOptions);
(
expectedOptions.headers as Headers
).Authorization = `Bearer ${bearerToken}`;
(expectedOptions.headers as Headers).Authorization =
`Bearer ${bearerToken}`;

handler.testApplyClientAuthenticationOptions(actualOptions, bearerToken);
assert.deepStrictEqual(expectedOptions, actualOptions);
Expand All @@ -399,9 +394,8 @@ describe('OAuthClientAuthHandler', () => {
const actualOptions = Object.assign({}, originalOptions);
// Expected options should have bearer token in header.
const expectedOptions = Object.assign({}, originalOptions);
(
expectedOptions.headers as Headers
).Authorization = `Bearer ${bearerToken}`;
(expectedOptions.headers as Headers).Authorization =
`Bearer ${bearerToken}`;

handler.testApplyClientAuthenticationOptions(actualOptions, bearerToken);
assert.deepStrictEqual(expectedOptions, actualOptions);
Expand Down
2 changes: 1 addition & 1 deletion test/test.pluggableauthclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
ExecutableError,
PluggableAuthClient,
} from '../src/auth/pluggable-auth-client';
import {BaseExternalAccountClient, IdentityPoolClient} from '../src';
import {BaseExternalAccountClient} from '../src';
import {
assertGaxiosResponsePresent,
getAudience,
Expand Down
4 changes: 2 additions & 2 deletions test/test.transporters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ describe('transporters', () => {
assert.strictEqual(res!.status, 200);
done();
},
_error => {
error => {
scope.done();
done('Unexpected promise failure');
done(error);
}
);
});
Expand Down
Loading