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

Change how version string is loaded from package.json #21

Merged
merged 5 commits into from
Feb 2, 2024
Merged
Changes from 1 commit
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
Next Next commit
Change how version string is loaded from package.json
mbish committed Jan 22, 2024
commit 790c2c026a70942e66ffc5fa985013ac36a7d29f
6 changes: 2 additions & 4 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -3,9 +3,7 @@
//
// SPDX-License-Identifier: MIT

import fs from 'fs';

const pkg = JSON.parse(fs.readFileSync('package.json', { encoding: 'utf-8' }));
import { version } from '../package.json';

Check failure on line 6 in src/constants.ts

GitHub Actions / Node CI - test (18.x)

Cannot find module '../package.json'. Consider using '--resolveJsonModule' to import module with '.json' extension.

Check failure on line 6 in src/constants.ts

GitHub Actions / Node CI - test (20.x)

Cannot find module '../package.json'. Consider using '--resolveJsonModule' to import module with '.json' extension.

export const CLIENT_ID_LENGTH = 20;
export const CLIENT_SECRET_LENGTH = 40;
@@ -16,7 +14,7 @@
export const JWT_EXPIRATION = 300;
export const JWT_LEEWAY = 60;

export const USER_AGENT = `duo_universal_node/${pkg.version}`;
export const USER_AGENT = `duo_universal_node/${version}`;
export const SIG_ALGORITHM = 'HS512';
export const GRANT_TYPE = 'authorization_code';
export const CLIENT_ASSERTION_TYPE = 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer';

Unchanged files with check annotations Beta

message?: string;
code?: string;
config?: AxiosRequestConfig;
request?: any;

Check warning on line 11 in src/axios-error.ts

GitHub Actions / Node CI - test (18.x)

Unexpected any. Specify a different type

Check warning on line 11 in src/axios-error.ts

GitHub Actions / Node CI - test (20.x)

Unexpected any. Specify a different type
response?: any;

Check warning on line 12 in src/axios-error.ts

GitHub Actions / Node CI - test (18.x)

Unexpected any. Specify a different type

Check warning on line 12 in src/axios-error.ts

GitHub Actions / Node CI - test (20.x)

Unexpected any. Specify a different type
};
export class AxiosError extends Error {
code?: string;
config?: AxiosRequestConfig;
request?: any;

Check warning on line 20 in src/axios-error.ts

GitHub Actions / Node CI - test (18.x)

Unexpected any. Specify a different type

Check warning on line 20 in src/axios-error.ts

GitHub Actions / Node CI - test (20.x)

Unexpected any. Specify a different type
response?: any;

Check warning on line 21 in src/axios-error.ts

GitHub Actions / Node CI - test (18.x)

Unexpected any. Specify a different type

Check warning on line 21 in src/axios-error.ts

GitHub Actions / Node CI - test (20.x)

Unexpected any. Specify a different type
constructor(ops: AxiosErrorOps = {}) {
super(ops.message);
* @returns {string}
* @memberof Client
*/
private getExceptionFromResult(result: any): string {

Check warning on line 109 in src/client.ts

GitHub Actions / Node CI - test (18.x)

Unexpected any. Specify a different type

Check warning on line 109 in src/client.ts

GitHub Actions / Node CI - test (20.x)

Unexpected any. Specify a different type
const { message, message_detail, error, error_description } = result;
if (message && message_detail) return `${message}: ${message_detail}`;