@aspecto/core
Advanced tools
Comparing version 1.1.17 to 1.1.18
export declare const WebSocketHost = "wss://ws.topsight.io"; | ||
export declare const AuthHost = "https://auth.topsight.io"; | ||
export declare const ConfigHost: string; | ||
export declare const isNode: boolean; | ||
export { isNode } from './isNode'; | ||
export declare const isValidUrl: (url: string) => boolean; | ||
export declare const getCollectorEndpoint: (sendTrafficTo: string) => string; |
@@ -6,3 +6,4 @@ "use strict"; | ||
exports.ConfigHost = process.env.NODE_ENV !== 'aspc_dev' ? 'https://config.aspecto.io' : 'http://localhost:8085/'; | ||
exports.isNode = !(typeof window != 'undefined' && window.document); | ||
var isNode_1 = require("./isNode"); | ||
exports.isNode = isNode_1.isNode; | ||
exports.isValidUrl = (url) => { | ||
@@ -9,0 +10,0 @@ try { |
@@ -38,8 +38,8 @@ "use strict"; | ||
} | ||
const collectors = []; | ||
const reporters = []; | ||
if (config_1.isNode) { | ||
collectors.push(new HttpReporter_1.default()); | ||
collectors.push(new ErrorReporter_1.default()); | ||
reporters.push(new HttpReporter_1.default()); | ||
reporters.push(new ErrorReporter_1.default()); | ||
if (((_c = options) === null || _c === void 0 ? void 0 : _c.outgoing) !== false) { | ||
collectors.push(new NodeHttpReporter_1.default()); | ||
reporters.push(new NodeHttpReporter_1.default()); | ||
} | ||
@@ -49,3 +49,3 @@ } | ||
if (((_d = options) === null || _d === void 0 ? void 0 : _d.outgoing) !== false) { | ||
collectors.push(new XMLHttpReporter_1.default()); | ||
reporters.push(new XMLHttpReporter_1.default()); | ||
} | ||
@@ -57,3 +57,3 @@ } | ||
let ws = new ws_1.default(config_1.getCollectorEndpoint(((_e = options) === null || _e === void 0 ? void 0 : _e.sendTrafficTo) || config.collectorUrl)); | ||
collectors.forEach((c) => c.set(ws, auth)); | ||
reporters.forEach((c) => c.set(ws, auth)); | ||
const allowed = yield ws.auth(auth); | ||
@@ -60,0 +60,0 @@ if (!allowed) { |
@@ -52,2 +52,3 @@ "use strict"; | ||
const fullUrl = `${protocol}://${host}${port ? `:${port}` : ``}${options.path}`; | ||
const URL = dynamic_require_1.url().URL; | ||
const url = new URL(fullUrl); | ||
@@ -54,0 +55,0 @@ const patterns = url_patterns_1.findPatterns(url.pathname); |
@@ -6,4 +6,5 @@ export declare const fs: () => any; | ||
export declare const https: () => any; | ||
export declare const url: () => any; | ||
export declare const stream: () => any; | ||
export declare const mimic_response: () => any; | ||
export declare const getDynamicModule: (name: string, supportDevMode?: boolean) => any; |
@@ -12,2 +12,3 @@ "use strict"; | ||
exports.https = () => exports.getDynamicModule('https', true); | ||
exports.url = () => exports.getDynamicModule('url', true); | ||
exports.stream = () => exports.getDynamicModule('stream'); | ||
@@ -14,0 +15,0 @@ exports.mimic_response = () => exports.getDynamicModule('mimic-response'); |
{ | ||
"name": "@aspecto/core", | ||
"version": "1.1.17", | ||
"version": "1.1.18", | ||
"description": "Aspecto metric collector", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
94360
85
1450
12