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

vega-dataflow

Package Overview
Dependencies
Maintainers
2
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega-dataflow - npm Package Compare versions

Comparing version 5.7.3 to 5.7.4

2

build/vega-dataflow.min.js

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

var vega=function(t,e,n,r){"use strict";function s(t){const n=t||e.identity,r=[],s={};return r.add=t=>{const e=n(t);return s[e]||(s[e]=1,r.push(t)),r},r.remove=t=>{const e=n(t);if(s[e]){s[e]=0;const n=r.indexOf(t);n>=0&&r.splice(n,1)}return r},r}async function i(t,e){try{await e(t)}catch(e){t.error(e)}}const o=Symbol("vega_id");let a=1;function u(t){return t[o]}function l(t,e){return t[o]=e,t}function h(t){const e=t===Object(t)?t:{data:t};return u(e)?e:l(e,a++)}function c(t,e){for(const n in t)e[n]=t[n];return e}function d(t){return t&&t.constructor===f}function f(){const t=[],n=[],r=[],s=[],i=[];let o=null,a=!1;return{constructor:f,insert(n){const r=e.array(n),s=r.length;for(let e=0;e<s;++e)t.push(r[e]);return this},remove(t){const r=e.isFunction(t)?s:n,i=e.array(t),o=i.length;for(let t=0;t<o;++t)r.push(i[t]);return this},modify(t,n,s){const o={field:n,value:e.constant(s)};return e.isFunction(t)?(o.filter=t,i.push(o)):(o.tuple=t,r.push(o)),this},encode(t,n){return e.isFunction(t)?i.push({filter:t,field:n}):r.push({tuple:t,field:n}),this},clean(t){return o=t,this},reflow(){return a=!0,this},pulse(e,l){const c={},d={};let f,p,g,m,_,v;for(f=0,p=l.length;f<p;++f)c[u(l[f])]=1;for(f=0,p=n.length;f<p;++f)_=n[f],c[u(_)]=-1;for(f=0,p=s.length;f<p;++f)m=s[f],l.forEach(t=>{m(t)&&(c[u(t)]=-1)});for(f=0,p=t.length;f<p;++f)_=t[f],v=u(_),c[v]?c[v]=1:e.add.push(h(t[f]));for(f=0,p=l.length;f<p;++f)_=l[f],c[u(_)]<0&&e.rem.push(_);function y(t,n,r){r?t[n]=r(t):e.encode=n,a||(d[u(t)]=t)}for(f=0,p=r.length;f<p;++f)g=r[f],_=g.tuple,m=g.field,v=c[u(_)],v>0&&(y(_,m,g.value),e.modifies(m));for(f=0,p=i.length;f<p;++f)g=i[f],m=g.filter,l.forEach(t=>{m(t)&&c[u(t)]>0&&y(t,g.field,g.value)}),e.modifies(g.field);if(a)e.mod=n.length||s.length?l.filter(t=>c[u(t)]>0):l.slice();else for(v in d)e.mod.push(d[v]);return(o||null==o&&(n.length||s.length))&&e.clean(!0),e}}}const p="_:mod:_";function g(){Object.defineProperty(this,p,{writable:!0,value:{}})}g.prototype={set(t,n,r,s){const i=this,o=i[t],a=i[p];return null!=n&&n>=0?(o[n]!==r||s)&&(o[n]=r,a[n+":"+t]=-1,a[t]=-1):(o!==r||s)&&(i[t]=r,a[t]=e.isArray(r)?1+r.length:-1),i},modified(t,n){const r=this[p];if(!arguments.length){for(const t in r)if(r[t])return!0;return!1}if(e.isArray(t)){for(let e=0;e<t.length;++e)if(r[t[e]])return!0;return!1}return null!=n&&n>=0?n+1<r[t]||!!r[n+":"+t]:!!r[t]},clear(){return this[p]={},this}};let m=0;const _=new g;function v(t,e,n,r){this.id=++m,this.value=t,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,e&&(this._update=e),n&&this.parameters(n,r)}function y(t){return function(e){const n=this.flags;return 0===arguments.length?!!(n&t):(this.flags=e?n|t:n&~t,this)}}v.prototype={targets(){return this._targets||(this._targets=s(e.id))},set(t){return this.value!==t?(this.value=t,1):0},skip:y(1),modified:y(2),parameters(t,n,r){n=!1!==n;const s=this._argval=this._argval||new g,i=this._argops=this._argops||[],o=[];let a,u,l,h;const c=(t,e,r)=>{r instanceof v?(r!==this&&(n&&r.targets().add(this),o.push(r)),i.push({op:r,name:t,index:e})):s.set(t,e,r)};for(a in t)if(u=t[a],"pulse"===a)e.array(u).forEach(t=>{t instanceof v?t!==this&&(t.targets().add(this),o.push(t)):e.error("Pulse parameters must be operator instances.")}),this.source=u;else if(e.isArray(u))for(s.set(a,-1,Array(l=u.length)),h=0;h<l;++h)c(a,h,u[h]);else c(a,-1,u);return this.marshall().clear(),r&&(i.initonly=!0),o},marshall(t){const e=this._argval||_,n=this._argops;let r,s,i,o;if(n){const a=n.length;for(s=0;s<a;++s)r=n[s],i=r.op,o=i.modified()&&i.stamp===t,e.set(r.name,r.index,i.value,o);if(n.initonly){for(s=0;s<a;++s)r=n[s],r.op.targets().remove(this);this._argops=null,this._update=null}}return e},detach(){const t=this._argops;let e,n,r,s;if(t)for(e=0,n=t.length;e<n;++e)r=t[e],s=r.op,s._targets&&s._targets.remove(this)},evaluate(t){const e=this._update;if(e){const n=this.marshall(t.stamp),r=e.call(this,n,t);if(n.clear(),r!==this.value)this.value=r;else if(!this.modified())return t.StopPropagation}},run(t){if(t.stamp<this.stamp)return t.StopPropagation;let e;return this.skip()?(this.skip(!1),e=0):e=this.evaluate(t),this.pulse=e||t}};let k=0;function w(t,e,n){this.id=++k,this.value=null,n&&(this.receive=n),t&&(this._filter=t),e&&(this._apply=e)}function F(t,e,n){return new w(t,e,n)}w.prototype={_filter:e.truthy,_apply:e.identity,targets(){return this._targets||(this._targets=s(e.id))},consume(t){return arguments.length?(this._consume=!!t,this):!!this._consume},receive(t){if(this._filter(t)){const e=this.value=this._apply(t),n=this._targets,r=n?n.length:0;for(let t=0;t<r;++t)n[t].receive(e);this._consume&&(t.preventDefault(),t.stopPropagation())}},filter(t){const e=F(t);return this.targets().add(e),e},apply(t){const e=F(null,t);return this.targets().add(e),e},merge(){const t=F();this.targets().add(t);for(let e=0,n=arguments.length;e<n;++e)arguments[e].targets().add(t);return t},throttle(t){let e=-1;return this.filter(()=>{const n=Date.now();return n-e>t?(e=n,1):0})},debounce(t){const n=F();return this.targets().add(F(null,null,e.debounce(t,t=>{const e=t.dataflow;n.receive(t),e&&e.run&&e.run()}))),n},between(t,e){let n=!1;return t.targets().add(F(null,null,()=>n=!0)),e.targets().add(F(null,null,()=>n=!1)),this.filter(()=>n)},detach(){}};const A={skip:!0};function D(t,n,r,s,i,o){const a=e.extend({},o,A);let u,l;e.isFunction(r)||(r=e.constant(r)),void 0===s?u=e=>t.touch(r(e)):e.isFunction(s)?(l=new v(null,s,i,!1),u=e=>{l.evaluate(e);const n=r(e),s=l.value;d(s)?t.pulse(n,s,o):t.update(n,s,a)}):u=e=>t.update(r(e),s,a),n.apply(u)}function E(t,n,r,s,i,o){if(void 0===s)n.targets().add(r);else{const a=o||{},u=new v(null,function(t,n){return n=e.isFunction(n)?n:e.constant(n),t?function(e,r){const s=n(e,r);return t.skip()||(t.skip(s!==this.value).value=s),s}:n}(r,s),i,!1);u.modified(a.force),u.rank=n.rank,n.targets().add(u),r&&(u.skip(!0),u.value=r.value,u.targets().add(r),t.connect(r,[u]))}}const P={};function O(t,e,n){this.dataflow=t,this.stamp=null==e?-1:e,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function b(t,n){const r=[];return e.visitArray(t,n,t=>r.push(t)),r}function q(t,e){const n={};return t.visit(e,t=>{n[u(t)]=1}),t=>n[u(t)]?null:t}function M(t,e){return t?(n,r)=>t(n,r)&&e(n,r):e}function S(t,e,n,r){const s=this,i=n.length;let o=0;this.dataflow=t,this.stamp=e,this.fields=null,this.encode=r||null,this.pulses=n;for(let t=0;t<i;++t){const r=n[t];if(r.stamp===e){if(r.fields){const t=s.fields||(s.fields={});for(const e in r.fields)t[e]=1}r.changed(s.ADD)&&(o|=s.ADD),r.changed(s.REM)&&(o|=s.REM),r.changed(s.MOD)&&(o|=s.MOD)}}this.changes=o}function L(t){return t.error("Dataflow already running. Use runAsync() to chain invocations."),t}O.prototype={StopPropagation:P,ADD:1,REM:2,MOD:4,ADD_REM:3,ADD_MOD:5,ALL:7,REFLOW:8,SOURCE:16,NO_SOURCE:32,NO_FIELDS:64,fork(t){return new O(this.dataflow).init(this,t)},clone(){const t=this.fork(7);return t.add=t.add.slice(),t.rem=t.rem.slice(),t.mod=t.mod.slice(),t.source&&(t.source=t.source.slice()),t.materialize(23)},addAll(){let t=this;return!t.source||t.add===t.rem||!t.rem.length&&t.source.length===t.add.length||(t=new O(this.dataflow).init(this),t.add=t.source,t.rem=[]),t},init(t,e){const n=this;return n.stamp=t.stamp,n.encode=t.encode,!t.fields||64&e||(n.fields=t.fields),1&e?(n.addF=t.addF,n.add=t.add):(n.addF=null,n.add=[]),2&e?(n.remF=t.remF,n.rem=t.rem):(n.remF=null,n.rem=[]),4&e?(n.modF=t.modF,n.mod=t.mod):(n.modF=null,n.mod=[]),32&e?(n.srcF=null,n.source=null):(n.srcF=t.srcF,n.source=t.source,t.cleans&&(n.cleans=t.cleans)),n},runAfter(t){this.dataflow.runAfter(t)},changed(t){const e=t||7;return 1&e&&this.add.length||2&e&&this.rem.length||4&e&&this.mod.length},reflow(t){if(t)return this.fork(7).reflow();const e=this.add.length,n=this.source&&this.source.length;return n&&n!==e&&(this.mod=this.source,e&&this.filter(4,q(this,1))),this},clean(t){return arguments.length?(this.cleans=!!t,this):this.cleans},modifies(t){const n=this.fields||(this.fields={});return e.isArray(t)?t.forEach(t=>n[t]=!0):n[t]=!0,this},modified(t,n){const r=this.fields;return!(!n&&!this.mod.length||!r)&&(arguments.length?e.isArray(t)?t.some(t=>r[t]):r[t]:!!r)},filter(t,e){const n=this;return 1&t&&(n.addF=M(n.addF,e)),2&t&&(n.remF=M(n.remF,e)),4&t&&(n.modF=M(n.modF,e)),16&t&&(n.srcF=M(n.srcF,e)),n},materialize(t){const e=this;return 1&(t=t||7)&&e.addF&&(e.add=b(e.add,e.addF),e.addF=null),2&t&&e.remF&&(e.rem=b(e.rem,e.remF),e.remF=null),4&t&&e.modF&&(e.mod=b(e.mod,e.modF),e.modF=null),16&t&&e.srcF&&(e.source=e.source.filter(e.srcF),e.srcF=null),e},visit(t,n){const r=this,s=n;if(16&t)return e.visitArray(r.source,r.srcF,s),r;1&t&&e.visitArray(r.add,r.addF,s),2&t&&e.visitArray(r.rem,r.remF,s),4&t&&e.visitArray(r.mod,r.modF,s);const i=r.source;if(8&t&&i){const t=r.add.length+r.mod.length;t===i.length||(t?e.visitArray(i,q(r,5),s):e.visitArray(i,r.srcF,s))}return r}},e.inherits(S,O,{fork(t){const e=new O(this.dataflow).init(this,t&this.NO_FIELDS);return void 0!==t&&(t&e.ADD&&this.visit(e.ADD,t=>e.add.push(t)),t&e.REM&&this.visit(e.REM,t=>e.rem.push(t)),t&e.MOD&&this.visit(e.MOD,t=>e.mod.push(t))),e},changed(t){return this.changes&t},modified(t){const n=this,r=n.fields;return r&&n.changes&n.MOD?e.isArray(t)?t.some(t=>r[t]):r[t]:0},filter(){e.error("MultiPulse does not support filtering.")},materialize(){e.error("MultiPulse does not support materialization.")},visit(t,e){const n=this,r=n.pulses,s=r.length;let i=0;if(t&n.SOURCE)for(;i<s;++i)r[i].visit(t,e);else for(;i<s;++i)r[i].stamp===n.stamp&&r[i].visit(t,e);return n}});const R={skip:!1,force:!1};function C(t){let e=[];return{clear:()=>e=[],size:()=>e.length,peek:()=>e[0],push:n=>(e.push(n),z(e,0,e.length-1,t)),pop:()=>{const n=e.pop();let r;return e.length?(r=e[0],e[0]=n,function(t,e,n){const r=e,s=t.length,i=t[e];let o,a=1+(e<<1);for(;a<s;)o=a+1,o<s&&n(t[a],t[o])>=0&&(a=o),t[e]=t[a],a=1+((e=a)<<1);t[e]=i,z(t,r,e,n)}(e,0,t)):r=n,r}}}function z(t,e,n,r){let s,i;const o=t[n];for(;n>e&&(i=n-1>>1,s=t[i],r(o,s)<0);)t[n]=s,n=i;return t[n]=o}function x(){this.logger(e.logger()),this.logLevel(e.Error),this._clock=0,this._rank=0,this._locale=r.defaultLocale();try{this._loader=n.loader()}catch(t){}this._touched=s(e.id),this._input={},this._pulse=null,this._heap=C((t,e)=>t.qrank-e.qrank),this._postrun=[]}function U(t){return function(){return this._log[t].apply(this,arguments)}}function T(t,e){v.call(this,t,null,e)}x.prototype={stamp(){return this._clock},loader(t){return arguments.length?(this._loader=t,this):this._loader},locale(t){return arguments.length?(this._locale=t,this):this._locale},logger(t){return arguments.length?(this._log=t,this):this._log},error:U("error"),warn:U("warn"),info:U("info"),debug:U("debug"),logLevel:U("level"),cleanThreshold:1e4,add:function(t,n,r,s){let i,o=1;return t instanceof v?i=t:t&&t.prototype instanceof v?i=new t:e.isFunction(t)?i=new v(null,t):(o=0,i=new v(t,n)),this.rank(i),o&&(s=r,r=n),r&&this.connect(i,i.parameters(r,s)),this.touch(i),i},connect:function(t,e){const n=t.rank,r=e.length;for(let s=0;s<r;++s)if(n<e[s].rank)return void this.rerank(t)},rank:function(t){t.rank=++this._rank},rerank:function(t){const n=[t];let r,s,i;for(;n.length;)if(this.rank(r=n.pop()),s=r._targets)for(i=s.length;--i>=0;)n.push(r=s[i]),r===t&&e.error("Cycle detected in dataflow graph.")},pulse:function(t,e,n){this.touch(t,n||R);const r=new O(this,this._clock+(this._pulse?0:1)),s=t.pulse&&t.pulse.source||[];return r.target=t,this._input[t.id]=e.pulse(r,s),this},touch:function(t,e){const n=e||R;return this._pulse?this._enqueue(t):this._touched.add(t),n.skip&&t.skip(!0),this},update:function(t,e,n){const r=n||R;return(t.set(e)||r.force)&&this.touch(t,r),this},changeset:f,ingest:function(t,e,n){return e=this.parse(e,n),this.pulse(t,this.changeset().insert(e))},parse:function(t,e){const r=this.locale();return n.read(t,e,r.timeParse,r.utcParse)},preload:async function(t,n,r){const s=this,i=s._pending||function(t){let e;const n=new Promise(t=>e=t);return n.requests=0,n.done=()=>{0==--n.requests&&(t._pending=null,e(t))},t._pending=n}(s);i.requests+=1;const o=await s.request(n,r);return s.pulse(t,s.changeset().remove(e.truthy).insert(o.data||[])),i.done(),o},request:async function(t,e){const r=this;let s,i=0;try{s=await r.loader().load(t,{context:"dataflow",response:n.responseType(e&&e.type)});try{s=r.parse(s,e)}catch(e){i=-2,r.warn("Data ingestion failed",t,e)}}catch(e){i=-1,r.warn("Loading failed",t,e)}return{data:s,status:i}},events:function(t,n,r,s){const i=this,o=F(r,s),a=function(t){t.dataflow=i;try{o.receive(t)}catch(t){i.error(t)}finally{i.run()}};let u;u="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):e.array(t);const l=u.length;for(let t=0;t<l;++t)u[t].addEventListener(n,a);return o},on:function(t,e,n,r,s){return(t instanceof v?E:D)(this,t,e,n,r,s),this},evaluate:async function(t,n,r){const o=this,a=[];if(o._pulse)return L(o);if(o._pending&&await o._pending,n&&await i(o,n),!o._touched.length)return o.debug("Dataflow invoked, but nothing to do."),o;const u=++o._clock;o._pulse=new O(o,u,t),o._touched.forEach(t=>o._enqueue(t,!0)),o._touched=s(e.id);let l,h,c,d=0;try{for(;o._heap.size()>0;)l=o._heap.pop(),l.rank===l.qrank?(h=l.run(o._getPulse(l,t)),h.then?h=await h:h.async&&(a.push(h.async),h=P),h!==P&&l._targets&&l._targets.forEach(t=>o._enqueue(t)),++d):o._enqueue(l,!0)}catch(t){o._heap.clear(),c=t}if(o._input={},o._pulse=null,o.debug("Pulse ".concat(u,": ").concat(d," operators")),c&&(o._postrun=[],o.error(c)),o._postrun.length){const t=o._postrun.sort((t,e)=>e.priority-t.priority);o._postrun=[];for(let e=0;e<t.length;++e)await i(o,t[e].callback)}return r&&await i(o,r),a.length&&Promise.all(a).then(t=>o.runAsync(null,()=>{t.forEach(t=>{try{t(o)}catch(t){o.error(t)}})})),o},run:function(t,e,n){return this._pulse?L(this):(this.evaluate(t,e,n),this)},runAsync:async function(t,e,n){for(;this._running;)await this._running;const r=()=>this._running=null;return(this._running=this.evaluate(t,e,n)).then(r,r),this._running},runAfter:function(t,e,n){if(this._pulse||e)this._postrun.push({priority:n||0,callback:t});else try{t(this)}catch(t){this.error(t)}},_enqueue:function(t,e){const n=t.stamp<this._clock;n&&(t.stamp=this._clock),(n||e)&&(t.qrank=t.rank,this._heap.push(t))},_getPulse:function(t,n){const r=t.source,s=this._clock;return r&&e.isArray(r)?new S(this,s,r.map(t=>t.pulse),n):this._input[t.id]||function(t,e){if(e&&e.stamp===t.stamp)return e;t=t.fork(),e&&e!==P&&(t.source=e.source);return t}(this._pulse,r&&r.pulse)}},e.inherits(T,v,{run(t){if(t.stamp<this.stamp)return t.StopPropagation;let e;return this.skip()?this.skip(!1):e=this.evaluate(t),e=e||t,e.then?e=e.then(t=>this.pulse=t):e!==t.StopPropagation&&(this.pulse=e),e},evaluate(t){const e=this.marshall(t.stamp),n=this.transform(e,t);return e.clear(),n},transform(){}});const N={};function j(t){return t=t&&t.toLowerCase(),e.hasOwnProperty(N,t)?N[t]:null}return t.Dataflow=x,t.EventStream=w,t.MultiPulse=S,t.Operator=v,t.Parameters=g,t.Pulse=O,t.Transform=T,t.UniqueList=s,t.asyncCallback=i,t.changeset=f,t.definition=function(t){const e=j(t);return e&&e.Definition||null},t.derive=function(t){return c(t,h({}))},t.ingest=h,t.isChangeSet=d,t.isTuple=function(t){return!(!t||!u(t))},t.rederive=c,t.replace=function(t,e){return l(e,u(t))},t.stableCompare=function(t,e){return t?e?(n,r)=>t(n,r)||u(e(n))-u(e(r)):(e,n)=>t(e,n)||u(e)-u(n):null},t.transform=j,t.transforms=N,t.tupleid=u,t}({},vega,vega,vega);
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vega-util"),require("vega-loader"),require("vega-format")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-loader","vega-format"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).vega={},t.vega,t.vega,t.vega)}(this,(function(t,e,n,r){"use strict";function s(t){const n=t||e.identity,r=[],s={};return r.add=t=>{const e=n(t);return s[e]||(s[e]=1,r.push(t)),r},r.remove=t=>{const e=n(t);if(s[e]){s[e]=0;const n=r.indexOf(t);n>=0&&r.splice(n,1)}return r},r}async function i(t,e){try{await e(t)}catch(e){t.error(e)}}const o=Symbol("vega_id");let a=1;function l(t){return t[o]}function u(t,e){return t[o]=e,t}function h(t){const e=t===Object(t)?t:{data:t};return l(e)?e:u(e,a++)}function c(t,e){for(const n in t)e[n]=t[n];return e}function d(t){return t&&t.constructor===f}function f(){const t=[],n=[],r=[],s=[],i=[];let o=null,a=!1;return{constructor:f,insert(n){const r=e.array(n),s=r.length;for(let e=0;e<s;++e)t.push(r[e]);return this},remove(t){const r=e.isFunction(t)?s:n,i=e.array(t),o=i.length;for(let t=0;t<o;++t)r.push(i[t]);return this},modify(t,n,s){const o={field:n,value:e.constant(s)};return e.isFunction(t)?(o.filter=t,i.push(o)):(o.tuple=t,r.push(o)),this},encode(t,n){return e.isFunction(t)?i.push({filter:t,field:n}):r.push({tuple:t,field:n}),this},clean(t){return o=t,this},reflow(){return a=!0,this},pulse(e,u){const c={},d={};let f,p,g,m,_,v;for(f=0,p=u.length;f<p;++f)c[l(u[f])]=1;for(f=0,p=n.length;f<p;++f)_=n[f],c[l(_)]=-1;for(f=0,p=s.length;f<p;++f)m=s[f],u.forEach((t=>{m(t)&&(c[l(t)]=-1)}));for(f=0,p=t.length;f<p;++f)_=t[f],v=l(_),c[v]?c[v]=1:e.add.push(h(t[f]));for(f=0,p=u.length;f<p;++f)_=u[f],c[l(_)]<0&&e.rem.push(_);function y(t,n,r){r?t[n]=r(t):e.encode=n,a||(d[l(t)]=t)}for(f=0,p=r.length;f<p;++f)g=r[f],_=g.tuple,m=g.field,v=c[l(_)],v>0&&(y(_,m,g.value),e.modifies(m));for(f=0,p=i.length;f<p;++f)g=i[f],m=g.filter,u.forEach((t=>{m(t)&&c[l(t)]>0&&y(t,g.field,g.value)})),e.modifies(g.field);if(a)e.mod=n.length||s.length?u.filter((t=>c[l(t)]>0)):u.slice();else for(v in d)e.mod.push(d[v]);return(o||null==o&&(n.length||s.length))&&e.clean(!0),e}}}const p="_:mod:_";function g(){Object.defineProperty(this,p,{writable:!0,value:{}})}g.prototype={set(t,n,r,s){const i=this,o=i[t],a=i[p];return null!=n&&n>=0?(o[n]!==r||s)&&(o[n]=r,a[n+":"+t]=-1,a[t]=-1):(o!==r||s)&&(i[t]=r,a[t]=e.isArray(r)?1+r.length:-1),i},modified(t,n){const r=this[p];if(!arguments.length){for(const t in r)if(r[t])return!0;return!1}if(e.isArray(t)){for(let e=0;e<t.length;++e)if(r[t[e]])return!0;return!1}return null!=n&&n>=0?n+1<r[t]||!!r[n+":"+t]:!!r[t]},clear(){return this[p]={},this}};let m=0;const _=new g;function v(t,e,n,r){this.id=++m,this.value=t,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,e&&(this._update=e),n&&this.parameters(n,r)}function y(t){return function(e){const n=this.flags;return 0===arguments.length?!!(n&t):(this.flags=e?n|t:n&~t,this)}}v.prototype={targets(){return this._targets||(this._targets=s(e.id))},set(t){return this.value!==t?(this.value=t,1):0},skip:y(1),modified:y(2),parameters(t,n,r){n=!1!==n;const s=this._argval=this._argval||new g,i=this._argops=this._argops||[],o=[];let a,l,u,h;const c=(t,e,r)=>{r instanceof v?(r!==this&&(n&&r.targets().add(this),o.push(r)),i.push({op:r,name:t,index:e})):s.set(t,e,r)};for(a in t)if(l=t[a],"pulse"===a)e.array(l).forEach((t=>{t instanceof v?t!==this&&(t.targets().add(this),o.push(t)):e.error("Pulse parameters must be operator instances.")})),this.source=l;else if(e.isArray(l))for(s.set(a,-1,Array(u=l.length)),h=0;h<u;++h)c(a,h,l[h]);else c(a,-1,l);return this.marshall().clear(),r&&(i.initonly=!0),o},marshall(t){const e=this._argval||_,n=this._argops;let r,s,i,o;if(n){const a=n.length;for(s=0;s<a;++s)r=n[s],i=r.op,o=i.modified()&&i.stamp===t,e.set(r.name,r.index,i.value,o);if(n.initonly){for(s=0;s<a;++s)r=n[s],r.op.targets().remove(this);this._argops=null,this._update=null}}return e},detach(){const t=this._argops;let e,n,r,s;if(t)for(e=0,n=t.length;e<n;++e)r=t[e],s=r.op,s._targets&&s._targets.remove(this);this.pulse=null,this.source=null},evaluate(t){const e=this._update;if(e){const n=this.marshall(t.stamp),r=e.call(this,n,t);if(n.clear(),r!==this.value)this.value=r;else if(!this.modified())return t.StopPropagation}},run(t){if(t.stamp<this.stamp)return t.StopPropagation;let e;return this.skip()?(this.skip(!1),e=0):e=this.evaluate(t),this.pulse=e||t}};let k=0;function w(t,e,n){this.id=++k,this.value=null,n&&(this.receive=n),t&&(this._filter=t),e&&(this._apply=e)}function F(t,e,n){return new w(t,e,n)}w.prototype={_filter:e.truthy,_apply:e.identity,targets(){return this._targets||(this._targets=s(e.id))},consume(t){return arguments.length?(this._consume=!!t,this):!!this._consume},receive(t){if(this._filter(t)){const e=this.value=this._apply(t),n=this._targets,r=n?n.length:0;for(let t=0;t<r;++t)n[t].receive(e);this._consume&&(t.preventDefault(),t.stopPropagation())}},filter(t){const e=F(t);return this.targets().add(e),e},apply(t){const e=F(null,t);return this.targets().add(e),e},merge(){const t=F();this.targets().add(t);for(let e=0,n=arguments.length;e<n;++e)arguments[e].targets().add(t);return t},throttle(t){let e=-1;return this.filter((()=>{const n=Date.now();return n-e>t?(e=n,1):0}))},debounce(t){const n=F();return this.targets().add(F(null,null,e.debounce(t,(t=>{const e=t.dataflow;n.receive(t),e&&e.run&&e.run()})))),n},between(t,e){let n=!1;return t.targets().add(F(null,null,(()=>n=!0))),e.targets().add(F(null,null,(()=>n=!1))),this.filter((()=>n))},detach(){this._filter=e.truthy,this._targets=null}};const A={skip:!0};function D(t,n,r,s,i,o){const a=e.extend({},o,A);let l,u;e.isFunction(r)||(r=e.constant(r)),void 0===s?l=e=>t.touch(r(e)):e.isFunction(s)?(u=new v(null,s,i,!1),l=e=>{u.evaluate(e);const n=r(e),s=u.value;d(s)?t.pulse(n,s,o):t.update(n,s,a)}):l=e=>t.update(r(e),s,a),n.apply(l)}function E(t,n,r,s,i,o){if(void 0===s)n.targets().add(r);else{const a=o||{},l=new v(null,function(t,n){return n=e.isFunction(n)?n:e.constant(n),t?function(e,r){const s=n(e,r);return t.skip()||(t.skip(s!==this.value).value=s),s}:n}(r,s),i,!1);l.modified(a.force),l.rank=n.rank,n.targets().add(l),r&&(l.skip(!0),l.value=r.value,l.targets().add(r),t.connect(r,[l]))}}const P={};function b(t,e,n){this.dataflow=t,this.stamp=null==e?-1:e,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function q(t,n){const r=[];return e.visitArray(t,n,(t=>r.push(t))),r}function O(t,e){const n={};return t.visit(e,(t=>{n[l(t)]=1})),t=>n[l(t)]?null:t}function M(t,e){return t?(n,r)=>t(n,r)&&e(n,r):e}function S(t,e,n,r){const s=this,i=n.length;let o=0;this.dataflow=t,this.stamp=e,this.fields=null,this.encode=r||null,this.pulses=n;for(let t=0;t<i;++t){const r=n[t];if(r.stamp===e){if(r.fields){const t=s.fields||(s.fields={});for(const e in r.fields)t[e]=1}r.changed(s.ADD)&&(o|=s.ADD),r.changed(s.REM)&&(o|=s.REM),r.changed(s.MOD)&&(o|=s.MOD)}}this.changes=o}function L(t){return t.error("Dataflow already running. Use runAsync() to chain invocations."),t}b.prototype={StopPropagation:P,ADD:1,REM:2,MOD:4,ADD_REM:3,ADD_MOD:5,ALL:7,REFLOW:8,SOURCE:16,NO_SOURCE:32,NO_FIELDS:64,fork(t){return new b(this.dataflow).init(this,t)},clone(){const t=this.fork(7);return t.add=t.add.slice(),t.rem=t.rem.slice(),t.mod=t.mod.slice(),t.source&&(t.source=t.source.slice()),t.materialize(23)},addAll(){let t=this;return!t.source||t.add===t.rem||!t.rem.length&&t.source.length===t.add.length||(t=new b(this.dataflow).init(this),t.add=t.source,t.rem=[]),t},init(t,e){const n=this;return n.stamp=t.stamp,n.encode=t.encode,!t.fields||64&e||(n.fields=t.fields),1&e?(n.addF=t.addF,n.add=t.add):(n.addF=null,n.add=[]),2&e?(n.remF=t.remF,n.rem=t.rem):(n.remF=null,n.rem=[]),4&e?(n.modF=t.modF,n.mod=t.mod):(n.modF=null,n.mod=[]),32&e?(n.srcF=null,n.source=null):(n.srcF=t.srcF,n.source=t.source,t.cleans&&(n.cleans=t.cleans)),n},runAfter(t){this.dataflow.runAfter(t)},changed(t){const e=t||7;return 1&e&&this.add.length||2&e&&this.rem.length||4&e&&this.mod.length},reflow(t){if(t)return this.fork(7).reflow();const e=this.add.length,n=this.source&&this.source.length;return n&&n!==e&&(this.mod=this.source,e&&this.filter(4,O(this,1))),this},clean(t){return arguments.length?(this.cleans=!!t,this):this.cleans},modifies(t){const n=this.fields||(this.fields={});return e.isArray(t)?t.forEach((t=>n[t]=!0)):n[t]=!0,this},modified(t,n){const r=this.fields;return!(!n&&!this.mod.length||!r)&&(arguments.length?e.isArray(t)?t.some((t=>r[t])):r[t]:!!r)},filter(t,e){const n=this;return 1&t&&(n.addF=M(n.addF,e)),2&t&&(n.remF=M(n.remF,e)),4&t&&(n.modF=M(n.modF,e)),16&t&&(n.srcF=M(n.srcF,e)),n},materialize(t){const e=this;return 1&(t=t||7)&&e.addF&&(e.add=q(e.add,e.addF),e.addF=null),2&t&&e.remF&&(e.rem=q(e.rem,e.remF),e.remF=null),4&t&&e.modF&&(e.mod=q(e.mod,e.modF),e.modF=null),16&t&&e.srcF&&(e.source=e.source.filter(e.srcF),e.srcF=null),e},visit(t,n){const r=this,s=n;if(16&t)return e.visitArray(r.source,r.srcF,s),r;1&t&&e.visitArray(r.add,r.addF,s),2&t&&e.visitArray(r.rem,r.remF,s),4&t&&e.visitArray(r.mod,r.modF,s);const i=r.source;if(8&t&&i){const t=r.add.length+r.mod.length;t===i.length||(t?e.visitArray(i,O(r,5),s):e.visitArray(i,r.srcF,s))}return r}},e.inherits(S,b,{fork(t){const e=new b(this.dataflow).init(this,t&this.NO_FIELDS);return void 0!==t&&(t&e.ADD&&this.visit(e.ADD,(t=>e.add.push(t))),t&e.REM&&this.visit(e.REM,(t=>e.rem.push(t))),t&e.MOD&&this.visit(e.MOD,(t=>e.mod.push(t)))),e},changed(t){return this.changes&t},modified(t){const n=this,r=n.fields;return r&&n.changes&n.MOD?e.isArray(t)?t.some((t=>r[t])):r[t]:0},filter(){e.error("MultiPulse does not support filtering.")},materialize(){e.error("MultiPulse does not support materialization.")},visit(t,e){const n=this,r=n.pulses,s=r.length;let i=0;if(t&n.SOURCE)for(;i<s;++i)r[i].visit(t,e);else for(;i<s;++i)r[i].stamp===n.stamp&&r[i].visit(t,e);return n}});const R={skip:!1,force:!1};function x(t){let e=[];return{clear:()=>e=[],size:()=>e.length,peek:()=>e[0],push:n=>(e.push(n),C(e,0,e.length-1,t)),pop:()=>{const n=e.pop();let r;return e.length?(r=e[0],e[0]=n,function(t,e,n){const r=e,s=t.length,i=t[e];let o,a=1+(e<<1);for(;a<s;)o=a+1,o<s&&n(t[a],t[o])>=0&&(a=o),t[e]=t[a],a=1+((e=a)<<1);t[e]=i,C(t,r,e,n)}(e,0,t)):r=n,r}}}function C(t,e,n,r){let s,i;const o=t[n];for(;n>e&&(i=n-1>>1,s=t[i],r(o,s)<0);)t[n]=s,n=i;return t[n]=o}function z(){this.logger(e.logger()),this.logLevel(e.Error),this._clock=0,this._rank=0,this._locale=r.defaultLocale();try{this._loader=n.loader()}catch(t){}this._touched=s(e.id),this._input={},this._pulse=null,this._heap=x(((t,e)=>t.qrank-e.qrank)),this._postrun=[]}function T(t){return function(){return this._log[t].apply(this,arguments)}}function U(t,e){v.call(this,t,null,e)}z.prototype={stamp(){return this._clock},loader(t){return arguments.length?(this._loader=t,this):this._loader},locale(t){return arguments.length?(this._locale=t,this):this._locale},logger(t){return arguments.length?(this._log=t,this):this._log},error:T("error"),warn:T("warn"),info:T("info"),debug:T("debug"),logLevel:T("level"),cleanThreshold:1e4,add:function(t,n,r,s){let i,o=1;return t instanceof v?i=t:t&&t.prototype instanceof v?i=new t:e.isFunction(t)?i=new v(null,t):(o=0,i=new v(t,n)),this.rank(i),o&&(s=r,r=n),r&&this.connect(i,i.parameters(r,s)),this.touch(i),i},connect:function(t,e){const n=t.rank,r=e.length;for(let s=0;s<r;++s)if(n<e[s].rank)return void this.rerank(t)},rank:function(t){t.rank=++this._rank},rerank:function(t){const n=[t];let r,s,i;for(;n.length;)if(this.rank(r=n.pop()),s=r._targets)for(i=s.length;--i>=0;)n.push(r=s[i]),r===t&&e.error("Cycle detected in dataflow graph.")},pulse:function(t,e,n){this.touch(t,n||R);const r=new b(this,this._clock+(this._pulse?0:1)),s=t.pulse&&t.pulse.source||[];return r.target=t,this._input[t.id]=e.pulse(r,s),this},touch:function(t,e){const n=e||R;return this._pulse?this._enqueue(t):this._touched.add(t),n.skip&&t.skip(!0),this},update:function(t,e,n){const r=n||R;return(t.set(e)||r.force)&&this.touch(t,r),this},changeset:f,ingest:function(t,e,n){return e=this.parse(e,n),this.pulse(t,this.changeset().insert(e))},parse:function(t,e){const r=this.locale();return n.read(t,e,r.timeParse,r.utcParse)},preload:async function(t,n,r){const s=this,i=s._pending||function(t){let e;const n=new Promise((t=>e=t));return n.requests=0,n.done=()=>{0==--n.requests&&(t._pending=null,e(t))},t._pending=n}(s);i.requests+=1;const o=await s.request(n,r);return s.pulse(t,s.changeset().remove(e.truthy).insert(o.data||[])),i.done(),o},request:async function(t,e){const r=this;let s,i=0;try{s=await r.loader().load(t,{context:"dataflow",response:n.responseType(e&&e.type)});try{s=r.parse(s,e)}catch(e){i=-2,r.warn("Data ingestion failed",t,e)}}catch(e){i=-1,r.warn("Loading failed",t,e)}return{data:s,status:i}},events:function(t,n,r,s){const i=this,o=F(r,s),a=function(t){t.dataflow=i;try{o.receive(t)}catch(t){i.error(t)}finally{i.run()}};let l;l="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):e.array(t);const u=l.length;for(let t=0;t<u;++t)l[t].addEventListener(n,a);return o},on:function(t,e,n,r,s){return(t instanceof v?E:D)(this,t,e,n,r,s),this},evaluate:async function(t,n,r){const o=this,a=[];if(o._pulse)return L(o);if(o._pending&&await o._pending,n&&await i(o,n),!o._touched.length)return o.debug("Dataflow invoked, but nothing to do."),o;const l=++o._clock;o._pulse=new b(o,l,t),o._touched.forEach((t=>o._enqueue(t,!0))),o._touched=s(e.id);let u,h,c,d=0;try{for(;o._heap.size()>0;)u=o._heap.pop(),u.rank===u.qrank?(h=u.run(o._getPulse(u,t)),h.then?h=await h:h.async&&(a.push(h.async),h=P),h!==P&&u._targets&&u._targets.forEach((t=>o._enqueue(t))),++d):o._enqueue(u,!0)}catch(t){o._heap.clear(),c=t}if(o._input={},o._pulse=null,o.debug(`Pulse ${l}: ${d} operators`),c&&(o._postrun=[],o.error(c)),o._postrun.length){const t=o._postrun.sort(((t,e)=>e.priority-t.priority));o._postrun=[];for(let e=0;e<t.length;++e)await i(o,t[e].callback)}return r&&await i(o,r),a.length&&Promise.all(a).then((t=>o.runAsync(null,(()=>{t.forEach((t=>{try{t(o)}catch(t){o.error(t)}}))})))),o},run:function(t,e,n){return this._pulse?L(this):(this.evaluate(t,e,n),this)},runAsync:async function(t,e,n){for(;this._running;)await this._running;const r=()=>this._running=null;return(this._running=this.evaluate(t,e,n)).then(r,r),this._running},runAfter:function(t,e,n){if(this._pulse||e)this._postrun.push({priority:n||0,callback:t});else try{t(this)}catch(t){this.error(t)}},_enqueue:function(t,e){const n=t.stamp<this._clock;n&&(t.stamp=this._clock),(n||e)&&(t.qrank=t.rank,this._heap.push(t))},_getPulse:function(t,n){const r=t.source,s=this._clock;return r&&e.isArray(r)?new S(this,s,r.map((t=>t.pulse)),n):this._input[t.id]||function(t,e){if(e&&e.stamp===t.stamp)return e;t=t.fork(),e&&e!==P&&(t.source=e.source);return t}(this._pulse,r&&r.pulse)}},e.inherits(U,v,{run(t){if(t.stamp<this.stamp)return t.StopPropagation;let e;return this.skip()?this.skip(!1):e=this.evaluate(t),e=e||t,e.then?e=e.then((t=>this.pulse=t)):e!==t.StopPropagation&&(this.pulse=e),e},evaluate(t){const e=this.marshall(t.stamp),n=this.transform(e,t);return e.clear(),n},transform(){}});const j={};function N(t){return t=t&&t.toLowerCase(),e.hasOwnProperty(j,t)?j[t]:null}t.Dataflow=z,t.EventStream=w,t.MultiPulse=S,t.Operator=v,t.Parameters=g,t.Pulse=b,t.Transform=U,t.UniqueList=s,t.asyncCallback=i,t.changeset=f,t.definition=function(t){const e=N(t);return e&&e.Definition||null},t.derive=function(t){return c(t,h({}))},t.ingest=h,t.isChangeSet=d,t.isTuple=function(t){return!(!t||!l(t))},t.rederive=c,t.replace=function(t,e){return u(e,l(t))},t.stableCompare=function(t,e){return t?e?(n,r)=>t(n,r)||l(e(n))-l(e(r)):(e,n)=>t(e,n)||l(e)-l(n):null},t.transform=N,t.transforms=j,t.tupleid=l,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=vega-dataflow.min.js.map
{
"name": "vega-dataflow",
"version": "5.7.3",
"version": "5.7.4",
"description": "Reactive dataflow processing.",

@@ -28,5 +28,5 @@ "keywords": [

"vega-loader": "^4.3.2",
"vega-util": "^1.15.2"
"vega-util": "^1.16.1"
},
"gitHead": "4affcbedb9d14815dbb6d3b250ed231b54fc95c0"
"gitHead": "fa2028c00b859c4485cac836c5a314fd37b7f109"
}

@@ -125,5 +125,8 @@ import UniqueList from './util/UniqueList';

detach() {
// no-op for handling detach requests
// ensures compatibility with operators (#2753)
// remove references to other streams and filter functions that may
// be bound to subcontexts that need to be garbage collected.
this._filter = truthy;
this._targets = null;
}
};

@@ -209,2 +209,7 @@ import Parameters from './Parameters';

}
// remove references to the source and pulse object,
// if present, to prevent memory leaks of old data.
this.pulse = null;
this.source = null;
},

@@ -211,0 +216,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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