2 Commits
1.1.3 ... 1.1.5

Author SHA1 Message Date
8418b242c3 Replace Axios with fetch API. 2023-05-29 19:20:12 -05:00
f0944d0d7e Update Axios for security fixes. 2023-05-29 19:03:55 -05:00
4 changed files with 33 additions and 47 deletions

56
package-lock.json generated
View File

@ -1,43 +1,29 @@
{
"name": "js-log",
"version": "1.0.0",
"lockfileVersion": 1,
"name": "@jdbernard/logging",
"version": "1.1.5",
"lockfileVersion": 3,
"requires": true,
"dependencies": {
"axios": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz",
"integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==",
"requires": {
"follow-redirects": "1.5.10"
"packages": {
"": {
"name": "@jdbernard/logging",
"version": "1.1.4",
"license": "GPL-3.0",
"devDependencies": {
"typescript": "^5.0.4"
}
},
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
"node_modules/typescript": {
"version": "5.0.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz",
"integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=12.20"
}
},
"follow-redirects": {
"version": "1.5.10",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
"integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
"requires": {
"debug": "=3.1.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"typescript": {
"version": "3.9.7",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz",
"integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==",
"dev": true
}
}
}

View File

@ -1,12 +1,14 @@
{
"name": "@jdbernard/logging",
"version": "1.1.3",
"version": "1.1.5",
"description": "Simple Javascript logging service.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [ "/dist" ],
"files": [
"/dist"
],
"scripts": {
"build": "tsc --build tsconfig.json",
"build": "tsc",
"prepare": "npm run build",
"test": "echo \"Error: no test specified\" && exit 1"
},
@ -21,9 +23,6 @@
"author": "Jonathan Bernard",
"license": "GPL-3.0",
"devDependencies": {
"typescript": "^3.9.7"
},
"dependencies": {
"axios": "^0.19.2"
"typescript": "^5.0.4"
}
}

View File

@ -1,5 +1,3 @@
import Axios from 'axios';
import { LogMessage, LogLevel } from './log-message';
import LogAppender from './log-appender';
@ -16,7 +14,6 @@ export class ApiLogAppender implements LogAppender {
public maximumTimePassedInSec = 120;
public threshold = LogLevel.ALL;
private http = Axios.create();
private msgBuffer: ApiMessage[] = [];
private lastSent = 0;
@ -50,7 +47,10 @@ export class ApiLogAppender implements LogAppender {
private doPost() {
if (this.msgBuffer.length > 0 && this.authToken) {
this.http.post(this.apiEndpoint, this.msgBuffer, {
fetch(this.apiEndpoint, {
method: 'POST',
mode: 'cors',
body: JSON.stringify(this.msgBuffer),
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${this.authToken}`

View File

@ -4,7 +4,8 @@
"target": "es6",
"declaration": true,
"outDir": "./dist",
"strict": true
"strict": true,
"skipLibCheck": true
},
"include": [
"src/**/*"