Socket
Socket
Sign inDemoInstall

@vonage/js-onewebrtc-telemetry

Package Overview
Dependencies
Maintainers
36
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vonage/js-onewebrtc-telemetry - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

7

CHANGELOG.md
# CHANGELOG.md
## 1.1.1 (2023-02-09)
Features:
- Upgrade @vonage/js-workerkizer to version 1.1.1
## 1.1.0 (2023-02-01)

@@ -4,0 +11,0 @@

2

dist/js-onewebrtc-telemetry.umd.js

@@ -1,1 +0,1 @@

(function(s,r){typeof exports=="object"&&typeof module<"u"?r(exports):typeof define=="function"&&define.amd?define(["exports"],r):(s=typeof globalThis<"u"?globalThis:s||self,r(s["js-onewebrtc-telemetry"]={}))})(this,function(s){"use strict";var $=Object.defineProperty;var H=(s,r,l)=>r in s?$(s,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):s[r]=l;var A=(s,r,l)=>(H(s,typeof r!="symbol"?r+"":r,l),l);var r=(e=>(e.automation="automation",e.test="test",e.vbc="vbc",e.video="video",e.voice="voice",e))(r||{});const l="hlg.tokbox.com/prod/logging/vcp_webrtc",T="https://",U=1e4;let f;const k=new Uint8Array(16);function M(){if(!f&&(f=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!f))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return f(k)}const o=[];for(let e=0;e<256;++e)o.push((e+256).toString(16).slice(1));function N(e,t=0){return(o[e[t+0]]+o[e[t+1]]+o[e[t+2]]+o[e[t+3]]+"-"+o[e[t+4]]+o[e[t+5]]+"-"+o[e[t+6]]+o[e[t+7]]+"-"+o[e[t+8]]+o[e[t+9]]+"-"+o[e[t+10]]+o[e[t+11]]+o[e[t+12]]+o[e[t+13]]+o[e[t+14]]+o[e[t+15]]).toLowerCase()}const m={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function O(e,t,n){if(m.randomUUID&&!t&&!e)return m.randomUUID();e=e||{};const i=e.random||(e.rng||M)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){n=n||0;for(let a=0;a<16;++a)t[n+a]=i[a];return t}return N(i)}const c={};var u=(e=>(e.INIT="INIT",e.FORWARD="FORWARD",e.TERMINATE="TERMINATE",e.GLOBALS_SYNC="GLOBALS_SYNC",e))(u||{});function b(e){return[ImageBitmap,ReadableStream,WritableStream].some(n=>e instanceof n)}let C=0;function v(e,t,n,i,a){const d=C++;return e.postMessage({id:d,type:t,functionName:n,args:i},i.filter(p=>b(p))),new Promise(p=>{a==null||a.set(d,p)})}function g(e,t){const{id:n,type:i}=e,a=Array.isArray(t)?t:[t];postMessage({id:n,type:i,result:t},a.filter(d=>b(d)))}const w={};function I(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}async function E(){if(I())g({type:u.GLOBALS_SYNC},c);else{const e=[];for(const t in w){const{worker:n,resolvers:i}=w[t].workerContext;n&&e.push(v(n,u.GLOBALS_SYNC,"",[c],i))}await Promise.all(e)}}function y(e,t){if(Array.isArray(t))t.splice(0,t.length);else if(typeof t=="object")for(const n in t)delete t[n];for(const n in e)Array.isArray(e[n])?(t[n]=[],y(e[n],t[n])):typeof e[n]=="object"?(t[n]={},y(e[n],t[n])):t[n]=e[n]}async function L(e,t){const{functionName:n,args:i}=e;if(!t.instance)throw"instance not initialized";if(!n)throw"missing function name to call";if(!t.instance[n])throw`undefined function [${n}] in class ${t.instance.constructor.workerId}`;g(e,await t.instance[n](...i!=null?i:[]))}const V={};function _(e,t){if(!e.args)throw"Missing className while initializing worker";const[n,i]=e.args,a=V[n];if(a)t.instance=new a(e.args.slice(1));else throw`unknown worker class ${n}`;y(i,c),g(e,typeof t.instance!==void 0)}async function D(e,t){const{args:n}=e;if(!t.instance)throw"instance not initialized";let i;t.instance.terminate&&(i=await t.instance.terminate(...n!=null?n:[])),g(e,i)}function G(e){if(!e.args)throw"Missing globals while syncing";y(e.args[0],c),g(e,{})}function W(){const e={};onmessage=async t=>{const n=t.data;switch(n.type){case u.INIT:_(n,e);break;case u.FORWARD:L(n,e);break;case u.TERMINATE:D(n,e);break;case u.GLOBALS_SYNC:G(n);break}}}I()&&W();function j(e,t){return c[e]||(c[e]=t),[()=>c[e],async n=>{c[e]=n,await E()}]}function x(e,t){return j(e,t)}const[B,P]=x("metadata");function Y(e){P(e)}function h(){return B()}class z{constructor(t){A(this,"uuid",O());this.config=t}async send(t){var p,R,S;const{appId:n,sourceType:i}=(p=h())!=null?p:{};if(!n||!i)return"metadata missing";const a=new AbortController,d=setTimeout(()=>a.abort(),U);return await((S=(R=this.config)==null?void 0:R.fetch)!=null?S:fetch)(this.getUrl(),{method:"POST",headers:this.getHeaders(),body:JSON.stringify(this.buildReport(t)),signal:a.signal}),clearTimeout(d),"success"}getUrl(){var n;let t=(n=h().proxyUrl)!=null?n:T;return t+=(t.at(-1)==="/"?"":"/")+l,t}getHeaders(){return{"Content-Type":"application/json"}}buildReport(t){const n=h();return{guid:this.uuid,...t,applicationId:n.appId,timestamp:Date.now(),proxyUrl:n.proxyUrl,source:n.sourceType}}}s.Reporter=z,s.SourceType=r,s.getVonageMetadata=h,s.setVonageMetadata=Y,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
(function(r,s){typeof exports=="object"&&typeof module<"u"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(r=typeof globalThis<"u"?globalThis:r||self,s(r["js-onewebrtc-telemetry"]={}))})(this,function(r){"use strict";var H=Object.defineProperty;var J=(r,s,l)=>s in r?H(r,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):r[s]=l;var A=(r,s,l)=>(J(r,typeof s!="symbol"?s+"":s,l),l);var s=(e=>(e.automation="automation",e.test="test",e.vbc="vbc",e.video="video",e.voice="voice",e))(s||{});const l="hlg.tokbox.com/prod/logging/vcp_webrtc",U="https://",k=1e4;let f;const M=new Uint8Array(16);function N(){if(!f&&(f=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!f))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return f(M)}const o=[];for(let e=0;e<256;++e)o.push((e+256).toString(16).slice(1));function O(e,t=0){return(o[e[t+0]]+o[e[t+1]]+o[e[t+2]]+o[e[t+3]]+"-"+o[e[t+4]]+o[e[t+5]]+"-"+o[e[t+6]]+o[e[t+7]]+"-"+o[e[t+8]]+o[e[t+9]]+"-"+o[e[t+10]]+o[e[t+11]]+o[e[t+12]]+o[e[t+13]]+o[e[t+14]]+o[e[t+15]]).toLowerCase()}const m={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function C(e,t,n){if(m.randomUUID&&!t&&!e)return m.randomUUID();e=e||{};const i=e.random||(e.rng||N)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){n=n||0;for(let a=0;a<16;++a)t[n+a]=i[a];return t}return O(i)}function b(e,t){return globalThis[e]||(globalThis[e]=t),globalThis[e]}const c=b("globals",{});var u=(e=>(e.INIT="INIT",e.FORWARD="FORWARD",e.TERMINATE="TERMINATE",e.GLOBALS_SYNC="GLOBALS_SYNC",e))(u||{});function w(e){return[ImageBitmap,ReadableStream,WritableStream].some(n=>e instanceof n)}let v=0;function E(e,t,n,i,a){const d=v++;return e.postMessage({id:d,type:t,functionName:n,args:i},i.filter(g=>w(g))),new Promise(g=>{a==null||a.set(d,g)})}function p(e,t){const{id:n,type:i}=e,a=Array.isArray(t)?t:[t];postMessage({id:n,type:i,result:t},a.filter(d=>w(d)))}const I=b("workerized",{});function R(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}async function L(){if(R())p({type:u.GLOBALS_SYNC},c);else{const e=[];for(const t in I){const{worker:n,resolvers:i}=I[t].workerContext;n&&e.push(E(n,u.GLOBALS_SYNC,"",[c],i))}await Promise.all(e)}}function y(e,t){if(Array.isArray(t))t.splice(0,t.length);else if(typeof t=="object")for(const n in t)delete t[n];for(const n in e)Array.isArray(e[n])?(t[n]=[],y(e[n],t[n])):typeof e[n]=="object"?(t[n]={},y(e[n],t[n])):t[n]=e[n]}async function V(e,t){const{functionName:n,args:i}=e;if(!t.instance)throw"instance not initialized";if(!n)throw"missing function name to call";if(!t.instance[n])throw`undefined function [${n}] in class ${t.instance.constructor.workerId}`;p(e,await t.instance[n](...i!=null?i:[]))}const G=b("registeredWorkers",{});function _(e,t){if(!e.args)throw"Missing className while initializing worker";const[n,i]=e.args,a=G[n];if(a)t.instance=new a(e.args.slice(1));else throw`unknown worker class ${n}`;y(i,c),p(e,typeof t.instance!==void 0)}async function D(e,t){const{args:n}=e;if(!t.instance)throw"instance not initialized";let i;t.instance.terminate&&(i=await t.instance.terminate(...n!=null?n:[])),p(e,i)}function W(e){if(!e.args)throw"Missing globals while syncing";y(e.args[0],c),p(e,{})}function j(){const e={};onmessage=async t=>{const n=t.data;switch(n.type){case u.INIT:_(n,e);break;case u.FORWARD:V(n,e);break;case u.TERMINATE:D(n,e);break;case u.GLOBALS_SYNC:W(n);break}}}R()&&j();function x(e,t){return c[e]||(c[e]=t),[()=>c[e],async n=>{c[e]=n,await L()}]}function B(e,t){return x(e,t)}const[z,P]=B("metadata");function Y(e){P(e)}function h(){return z()}class F{constructor(t){A(this,"uuid",C());this.config=t}async send(t){var g,T,S;const{appId:n,sourceType:i}=(g=h())!=null?g:{};if(!n||!i)return"metadata missing";const a=new AbortController,d=setTimeout(()=>a.abort(),k);return await((S=(T=this.config)==null?void 0:T.fetch)!=null?S:fetch)(this.getUrl(),{method:"POST",headers:this.getHeaders(),body:JSON.stringify(this.buildReport(t)),signal:a.signal}),clearTimeout(d),"success"}getUrl(){var n;let t=(n=h().proxyUrl)!=null?n:U;return t+=(t.at(-1)==="/"?"":"/")+l,t}getHeaders(){return{"Content-Type":"application/json"}}buildReport(t){const n=h();return{guid:this.uuid,...t,applicationId:n.appId,timestamp:Date.now(),proxyUrl:n.proxyUrl,source:n.sourceType}}}r.Reporter=F,r.SourceType=s,r.getVonageMetadata=h,r.setVonageMetadata=Y,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
{
"name": "@vonage/js-onewebrtc-telemetry",
"version": "1.1.0",
"version": "1.1.1",
"description": "Library providing telemetry logging capabilities to Vonage monitoring servers.",

@@ -52,3 +52,3 @@ "types": "./dist/index.d.ts",

"@types/uuid": "^9.0.0",
"@vonage/js-workerizer": "^1.1.0",
"@vonage/js-workerizer": "^1.1.1",
"emittery": "^1.0.1",

@@ -55,0 +55,0 @@ "uuid": "^9.0.0"

Sorry, the diff of this file is not supported yet

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