Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@opentelemetry/web

Package Overview
Dependencies
Maintainers
5
Versions
150
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/web - npm Package Compare versions

Comparing version 0.3.3 to 0.4.0

build/src/WebTracerProvider.d.ts

2

build/src/index.d.ts

@@ -16,3 +16,3 @@ /*!

*/
export * from './WebTracerRegistry';
export * from './WebTracerProvider';
export * from './StackScopeManager';

@@ -19,0 +19,0 @@ export * from './enums/PerformanceTimingNames';

@@ -21,3 +21,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./WebTracerRegistry"));
__export(require("./WebTracerProvider"));
__export(require("./StackScopeManager"));

@@ -24,0 +24,0 @@ __export(require("./enums/PerformanceTimingNames"));

@@ -17,3 +17,3 @@ /*!

import { PerformanceEntries, PerformanceResourceTimingInfo } from './types';
import * as types from '@opentelemetry/types';
import * as types from '@opentelemetry/api';
/**

@@ -52,1 +52,8 @@ * Helper function to be able to use enum as typed key in type and in interface when using forEach

export declare function parseUrl(url: string): HTMLAnchorElement;
/**
* Get element XPath
* @param target - target element
* @param optimised - when id attribute of element is present the xpath can be
* simplified to contain id
*/
export declare function getElementXPath(target: any, optimised?: boolean): string;

@@ -173,2 +173,80 @@ "use strict";

exports.parseUrl = parseUrl;
/**
* Get element XPath
* @param target - target element
* @param optimised - when id attribute of element is present the xpath can be
* simplified to contain id
*/
function getElementXPath(target, optimised) {
if (target.nodeType === Node.DOCUMENT_NODE) {
return '/';
}
const targetValue = getNodeValue(target, optimised);
if (optimised && targetValue.indexOf('@id') > 0) {
return targetValue;
}
let xpath = '';
if (target.parentNode) {
xpath += getElementXPath(target.parentNode, false);
}
xpath += targetValue;
return xpath;
}
exports.getElementXPath = getElementXPath;
/**
* get node index within the siblings
* @param target
*/
function getNodeIndex(target) {
if (!target.parentNode) {
return 0;
}
const allowedTypes = [target.nodeType];
if (target.nodeType === Node.CDATA_SECTION_NODE) {
allowedTypes.push(Node.TEXT_NODE);
}
let elements = Array.from(target.parentNode.childNodes);
elements = elements.filter((element) => {
const localName = element.localName;
return (allowedTypes.indexOf(element.nodeType) >= 0 &&
localName === target.localName);
});
if (elements.length >= 1) {
return elements.indexOf(target) + 1; // xpath starts from 1
}
// if there are no other similar child xpath doesn't need index
return 0;
}
/**
* get node value for xpath
* @param target
* @param optimised
*/
function getNodeValue(target, optimised) {
const nodeType = target.nodeType;
const index = getNodeIndex(target);
let nodeValue = '';
if (nodeType === Node.ELEMENT_NODE) {
const id = target.getAttribute('id');
if (optimised && id) {
return `//*[@id="${id}"]`;
}
nodeValue = target.localName;
}
else if (nodeType === Node.TEXT_NODE ||
nodeType === Node.CDATA_SECTION_NODE) {
nodeValue = 'text()';
}
else if (nodeType === Node.COMMENT_NODE) {
nodeValue = 'comment()';
}
else {
return '';
}
// if index is 1 it can be omitted in xpath
if (nodeValue && index > 1) {
return `/${nodeValue}[${index}]`;
}
return `/${nodeValue}`;
}
//# sourceMappingURL=utils.js.map

@@ -16,2 +16,2 @@ /*!

*/
export declare const VERSION = "0.3.3";
export declare const VERSION = "0.4.0";

@@ -19,3 +19,3 @@ "use strict";

// this is autogenerated file, see scripts/version-update.js
exports.VERSION = '0.3.3';
exports.VERSION = '0.4.0';
//# sourceMappingURL=version.js.map
{
"name": "@opentelemetry/web",
"version": "0.3.3",
"version": "0.4.0",
"description": "OpenTelemetry Web Tracer",

@@ -46,3 +46,4 @@ "main": "build/src/index.js",

"@babel/core": "^7.6.0",
"@opentelemetry/scope-zone": "^0.3.3",
"@opentelemetry/scope-zone": "^0.4.0",
"@types/jquery": "^3.3.31",
"@types/mocha": "^5.2.5",

@@ -59,2 +60,3 @@ "@types/node": "^12.6.8",

"karma-coverage-istanbul-reporter": "^2.1.0",
"karma-jquery": "^0.2.4",
"karma-mocha": "^1.3.0",

@@ -78,7 +80,7 @@ "karma-spec-reporter": "^0.0.32",

"dependencies": {
"@opentelemetry/core": "^0.3.3",
"@opentelemetry/scope-base": "^0.3.3",
"@opentelemetry/tracing": "^0.3.3",
"@opentelemetry/types": "^0.3.3"
"@opentelemetry/api": "^0.4.0",
"@opentelemetry/core": "^0.4.0",
"@opentelemetry/scope-base": "^0.4.0",
"@opentelemetry/tracing": "^0.4.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc