@openreplay/tracker-axios
Advanced tools
Comparing version 3.4.1 to 3.4.2
@@ -1,2 +0,2 @@ | ||
import { AxiosInstance } from 'axios'; | ||
import type { AxiosInstance } from 'axios'; | ||
import { App } from '@openreplay/tracker/cjs'; | ||
@@ -3,0 +3,0 @@ export interface Options { |
@@ -5,4 +5,9 @@ "use strict"; | ||
const tracker_1 = require("@openreplay/tracker/cjs"); | ||
const exception_1 = require("@openreplay/tracker/cjs/modules/exception"); // TODO: export from tracker root | ||
const url_1 = require("./url"); | ||
const exception_js_1 = require("@openreplay/tracker/cjs/modules/exception.js"); // TODO: export from tracker root | ||
const url_js_1 = require("./url.js"); | ||
function isAxiosResponse(r) { | ||
return typeof r === "object" && | ||
typeof r.config === "object" && | ||
typeof r.status === "number"; | ||
} | ||
function default_1(opts = {}) { | ||
@@ -75,3 +80,3 @@ const options = Object.assign({ | ||
// Why can't axios propogate the final request URL somewhere? | ||
const fullURL = url_1.buildFullPath(res.config.baseURL, options.instance.getUri(res.config)); | ||
const fullURL = (0, url_js_1.buildFullPath)(res.config.baseURL, options.instance.getUri(res.config)); | ||
app.send(tracker_1.Messages.Fetch(typeof res.config.method === 'string' ? res.config.method.toUpperCase() : 'GET', fullURL, JSON.stringify({ | ||
@@ -111,3 +116,3 @@ headers: reqHs, | ||
if (error instanceof Error) { | ||
app.send(exception_1.getExceptionMessage(error, [])); | ||
app.send((0, exception_js_1.getExceptionMessage)(error, [])); | ||
} | ||
@@ -126,4 +131,8 @@ return Promise.reject(error); | ||
else if (!axios_1.default.isCancel(error) && error instanceof Error) { | ||
app.send(exception_1.getExceptionMessage(error, [])); | ||
app.send((0, exception_js_1.getExceptionMessage)(error, [])); | ||
} | ||
// TODO: common case (selector) | ||
if (isAxiosResponse(error)) { | ||
sendFetchMessage(error); | ||
} | ||
return Promise.reject(error); | ||
@@ -130,0 +139,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
import { AxiosInstance } from 'axios'; | ||
import type { AxiosInstance } from 'axios'; | ||
import { App } from '@openreplay/tracker'; | ||
@@ -3,0 +3,0 @@ export interface Options { |
import axios from 'axios'; | ||
import { Messages } from '@openreplay/tracker'; | ||
import { getExceptionMessage } from '@openreplay/tracker/lib/modules/exception'; // TODO: export from tracker root | ||
import { buildFullPath } from './url'; | ||
import { getExceptionMessage } from '@openreplay/tracker/lib/modules/exception.js'; // TODO: export from tracker root | ||
import { buildFullPath } from './url.js'; | ||
function isAxiosResponse(r) { | ||
return typeof r === "object" && | ||
typeof r.config === "object" && | ||
typeof r.status === "number"; | ||
} | ||
export default function (opts = {}) { | ||
@@ -123,2 +128,6 @@ const options = Object.assign({ | ||
} | ||
// TODO: common case (selector) | ||
if (isAxiosResponse(error)) { | ||
sendFetchMessage(error); | ||
} | ||
return Promise.reject(error); | ||
@@ -125,0 +134,0 @@ }); |
{ | ||
"name": "@openreplay/tracker-axios", | ||
"description": "Tracker plugin for axios requests recording", | ||
"version": "3.4.1", | ||
"version": "3.4.2", | ||
"keywords": [ | ||
@@ -23,12 +23,12 @@ "axios", | ||
"peerDependencies": { | ||
"@openreplay/tracker": "^3.0.0", | ||
"@openreplay/tracker": "^3.4.8", | ||
"axios": "^0.21.2" | ||
}, | ||
"devDependencies": { | ||
"@openreplay/tracker": "^3.0.0", | ||
"@openreplay/tracker": "^3.4.9", | ||
"axios": "^0.21.2", | ||
"prettier": "^1.18.2", | ||
"replace-in-files-cli": "^1.0.0", | ||
"typescript": "^3.6.4" | ||
"typescript": "^4.6.0-dev.20211126" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
18402
345
0