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

@vizabi/core

Package Overview
Dependencies
Maintainers
4
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vizabi/core - npm Package Compare versions

Comparing version 1.24.1 to 1.25.0

4

dist/Dataframe.js

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

// http://vizabi.org v1.24.1 Copyright 2022 Jasper Heeffer and others at Gapminder Foundation
// http://vizabi.org v1.25.0 Copyright 2022 Jasper Heeffer and others at Gapminder Foundation
(function (global, factory) {

@@ -1359,3 +1359,3 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('mobx')) :

const newMember = member.filterGroups(filterFn, inplace);
const filterApplies = filterFn(newMember);
const filterApplies = filterFn(newMember, key);
if (!inplace && filterApplies)

@@ -1362,0 +1362,0 @@ result.set(keyObj, newMember);

{
"name": "@vizabi/core",
"version": "1.24.1",
"version": "1.25.0",
"description": "Vizabi core (data layer)",

@@ -5,0 +5,0 @@ "main": "dist/Vizabi.js",

import { fromPromise } from 'mobx-utils'
import { assign, applyDefaults, deepclone, stableStringifyObject, concatUnique, sleep, lazyAsync, combineStates, createModel } from "../utils";
import { configurable } from '../configurable';
import { trace, observable, toJS } from 'mobx';
import { trace, observable, toJS, reaction } from 'mobx';
import { dotToJoin, addExplicitAnd } from '../ddfquerytransform';

@@ -262,2 +262,106 @@ import { DataFrame } from '../../dataframe/dataFrame';

},
_getDrillupCatalog(concepts = this.concepts) {
const promises = [];
const result = {};
const drillup = "drill_up";
for (const conceptId of this.availability.keyValueLookup.keys()) {
if (this.isEntityConcept(conceptId)) {
const concept = concepts.get(conceptId);
if (concept[drillup]) {
const dim = concept["domain"] || conceptId;
if (!result[dim]) result[dim] = {};
const drillups = JSON.parse(concept[drillup]);
const entityQuery = {
select: {
key: [conceptId],
value: [...drillups]
},
from: "entities",
locale: this.locale,
};
promises.push(this.query(entityQuery).then(response => {
result[dim][conceptId] = [];
const res = response.forQueryKey();
result[dim][conceptId].push([Symbol.for(drillup), res]);
drillups.forEach(drillup => {
result[dim][conceptId].push(...res.groupByWithMultiGroupMembership(drillup).filterGroups(( _, k) => {
return k !== "";
}, true).entries());
});
result[dim][conceptId] = new Map(result[dim][conceptId]);
}));
}
}
}
return fromPromise(Promise.all(promises).then(() => result));
},
enableDrillup: false,
get drillupCatalog() {
if (this.enableDrillup) {
return this._getDrillupCatalog();
} else {
return fromPromise.resolve({});
}
},
//.drilldown({dim: "geo", entity: "asia"}) // =>{country: ["chn", "ind", "idn" ..... ]}
//.drilldown({dim: "geo", entity: "usa"}) // => {country: ["usa"]}
//.drilldown({dim: "geo", entity: ["landlocked"]}) // => {country: ["afg", "rwa", .... ]}
//.drilldown({dim: "geo", entity: ["usa", "landlocked"]}) // => {country: ["afg", "rwa", ...., "usa"]} (same plus USA)
//.drilldown({dim: "geo", entity: ["asia", "landlocked"]}) // => {country: [chn", "ind", "afg", "rwa", .... ] }
drilldown(obj) {
this.enableDrillup = true;
const entities = Array.isArray(obj.entity) ? obj.entity : [obj.entity];
const concept = this.concepts.get(obj.dim);
const dim = concept.domain ? concept.domain : obj.dim;
return this.drillupCatalog.then(c => {
const result = {};
for (const entitySet in c[dim]) {
const founded = [];
entities.forEach(e => {
if (c[dim][entitySet].has(e)) {
founded.push(...[...c[dim][entitySet].get(e).values()].map(v => v[entitySet]));
} else if (c[dim][entitySet].get(Symbol.for("drill_up")).has(e)){
founded.push(e);
}
})
if (founded.length) {
result[entitySet] = [...new Set(founded)].sort();
}
};
return Object.keys(result).length ? result : null;
});
},
//.drillup({dim: "geo", entity: "usa"}) // => {world_4region: americas, landlocked: coastline, religion: christian ...}
drillup(obj) {
this.enableDrillup = true;
const concept = this.concepts.get(obj.dim);
const dim = concept.domain ? concept.domain : obj.dim;
const drillup = "drill_up";
const result = {};
return this.drillupCatalog.then(c => {
for (const entitySet in c[dim]) {
const drillupValue = c[dim][entitySet].get(Symbol.for(drillup)).get(obj.entity);
Object.assign(result, drillupValue);
delete result[entitySet];
delete result[Symbol.for("key")];
};
return result;
});
},
calcCombineId(query) {

@@ -269,3 +373,7 @@ const clone = deepclone(query);

disposers: [],
onCreate() { },
onCreate() {
this.disposers.push(
reaction(() => this.state == 'fulfilled' ? this.drillupCatalog : {}, ()=>{})
);
},
dispose() {

@@ -272,0 +380,0 @@ let dispose;

@@ -128,3 +128,3 @@ import { DataFrame } from "./dataFrame";

const newMember = member.filterGroups(filterFn, inplace);
const filterApplies = filterFn(newMember);
const filterApplies = filterFn(newMember, key);
if (!inplace && filterApplies)

@@ -131,0 +131,0 @@ result.set(keyObj, newMember);

Sorry, the diff of this file is not supported yet

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

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