@milaboratories/graph-maker 1.1.140 → 1.1.142
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/GraphMaker/components/LassoControls/index.vue.js +1 -1
- package/dist/GraphMaker/constantsCommon.d.ts +8 -0
- package/dist/GraphMaker/constantsCommon.d.ts.map +1 -1
- package/dist/GraphMaker/constantsCommon.js +94 -83
- package/dist/GraphMaker/constantsCommon.js.map +1 -1
- package/dist/GraphMaker/forms/LayersForm/Layer/discrete/StackedArea.vue.d.ts +3 -0
- package/dist/GraphMaker/forms/LayersForm/Layer/discrete/StackedArea.vue.d.ts.map +1 -0
- package/dist/GraphMaker/forms/LayersForm/Layer/discrete/StackedArea.vue.js +90 -0
- package/dist/GraphMaker/forms/LayersForm/Layer/discrete/StackedArea.vue.js.map +1 -0
- package/dist/GraphMaker/forms/LayersForm/Layer/discrete/StackedArea.vue2.js +5 -0
- package/dist/GraphMaker/forms/LayersForm/Layer/discrete/StackedArea.vue2.js.map +1 -0
- package/dist/GraphMaker/forms/LayersForm/index.vue.d.ts.map +1 -1
- package/dist/GraphMaker/forms/LayersForm/index.vue.js +45 -43
- package/dist/GraphMaker/forms/LayersForm/index.vue.js.map +1 -1
- package/dist/GraphMaker/index.vue.d.ts.map +1 -1
- package/dist/GraphMaker/index.vue.js +24 -24
- package/dist/GraphMaker/index.vue.js.map +1 -1
- package/dist/GraphMaker/store.js +9 -9
- package/dist/GraphMaker/types.d.ts +1 -1
- package/dist/GraphMaker/types.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts +16 -0
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js +54 -52
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/getLayersDataFromForms.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/getLayersDataFromForms.js +84 -70
- package/dist/GraphMaker/utils/createChartSettingsForRender/getLayersDataFromForms.js.map +1 -1
- package/dist/GraphMaker/utils/loadDefaultSources.js +4 -3
- package/dist/GraphMaker/utils/loadDefaultSources.js.map +1 -1
- package/dist/_virtual/_commonjsHelpers.js +3 -5
- package/dist/_virtual/_commonjsHelpers.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/MiPlots.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/DiscreteSettingsImpl.js +185 -164
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/DiscreteSettingsImpl.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/Chart.js +120 -103
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/Chart.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/ChartsGroup.js +4 -4
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/layers/StackedAreaElement.js +105 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/layers/StackedAreaElement.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/layers/StackedBarElement.js +66 -59
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/layers/StackedBarElement.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js +57 -54
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/stackedArea.js +17 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/stackedArea.js.map +1 -0
- package/dist/node_modules/@milaboratories/miplots4/dist/types/discrete.js +24 -9
- package/dist/node_modules/@milaboratories/miplots4/dist/types/discrete.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/_commonjsHelpers.js +9 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/canonicalize.js +8 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/canonicalize.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/lodash.js +8 -0
- package/dist/{_virtual → node_modules/@milaboratories/pf-plots/dist/_virtual}/lodash.js.map +1 -1
- package/dist/{_virtual/lodash.js → node_modules/@milaboratories/pf-plots/dist/_virtual/lodash2.js} +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/lodash2.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/stringify.js +3 -0
- package/dist/{_virtual → node_modules/@milaboratories/pf-plots/dist/_virtual}/stringify.js.map +1 -1
- package/dist/{_virtual/stringify.js → node_modules/@milaboratories/pf-plots/dist/_virtual/stringify2.js} +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/stringify2.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/constants.js +15 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/constants.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js +198 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js +342 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/bubble.js +278 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/bubble.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/dendro.js +453 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/dendro.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/discrete.js +203 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/discrete.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/heatmap.js +432 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/heatmap.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/histogram.js +170 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/histogram.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot-umap.js +315 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot-umap.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js +323 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/demoStore.js +11 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/demoStore.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/index.js +36 -3426
- package/dist/node_modules/@milaboratories/pf-plots/dist/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/{pl-error-like → pf-plots/dist/node_modules/@milaboratories/pl-error-like}/dist/index.js +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-error-like/dist/index.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/index.js +979 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/index.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/index.js +1599 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/index.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/canonicalize/lib/canonicalize.js +19 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/canonicalize/lib/canonicalize.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/json-stringify-safe/stringify.js +26 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/json-stringify-safe/stringify.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/lodash/lodash.js +3678 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/lodash/lodash.js.map +1 -0
- package/dist/node_modules/{zod → @milaboratories/pf-plots/dist/node_modules/zod}/lib/index.js +1141 -1141
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/zod/lib/index.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js +247 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/spec.js +62 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/spec.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js +286 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js.map +1 -0
- package/package.json +3 -3
- package/dist/node_modules/@milaboratories/pl-error-like/dist/index.js.map +0 -1
- package/dist/node_modules/@milaboratories/pl-model-common/dist/index.js +0 -584
- package/dist/node_modules/@milaboratories/pl-model-common/dist/index.js.map +0 -1
- package/dist/node_modules/@platforma-sdk/model/dist/index.js +0 -1559
- package/dist/node_modules/@platforma-sdk/model/dist/index.js.map +0 -1
- package/dist/node_modules/json-stringify-safe/stringify.js +0 -20
- package/dist/node_modules/json-stringify-safe/stringify.js.map +0 -1
- package/dist/node_modules/lodash/lodash.js +0 -3678
- package/dist/node_modules/lodash/lodash.js.map +0 -1
- package/dist/node_modules/zod/lib/index.js.map +0 -1
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { AxisId as w, isColumnId as v, ColumnId as C } from "../spec.js";
|
|
2
|
+
import S from "../_virtual/lodash.js";
|
|
3
|
+
import { pTableValue as F } from "../node_modules/@milaboratories/pl-model-common/dist/index.js";
|
|
4
|
+
var b = Object.defineProperty, P = (y, e, t) => e in y ? b(y, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : y[e] = t, D = (y, e, t) => P(y, typeof e != "symbol" ? e + "" : e, t);
|
|
5
|
+
const I = 1e6;
|
|
6
|
+
function x(y, e) {
|
|
7
|
+
if (y === "String")
|
|
8
|
+
return e.data;
|
|
9
|
+
const t = new Array(e.data.length);
|
|
10
|
+
for (let a = 0; a < e.data.length; a++)
|
|
11
|
+
t[a] = F(e, a, { absent: null, na: null });
|
|
12
|
+
return t;
|
|
13
|
+
}
|
|
14
|
+
class V {
|
|
15
|
+
constructor(e, t) {
|
|
16
|
+
D(this, "pframeHandle"), D(this, "pframeDriver"), this.pframeHandle = e, this.pframeDriver = t;
|
|
17
|
+
}
|
|
18
|
+
async isColumnExisted(e) {
|
|
19
|
+
return !!await this.getColumnSpecById(e);
|
|
20
|
+
}
|
|
21
|
+
async getSingleColumnData(e, t = []) {
|
|
22
|
+
if (!await this.isColumnExisted(e))
|
|
23
|
+
return {
|
|
24
|
+
axesData: {},
|
|
25
|
+
data: []
|
|
26
|
+
};
|
|
27
|
+
try {
|
|
28
|
+
const a = Date.now(), s = await this.pframeDriver.calculateTableData(this.pframeHandle, {
|
|
29
|
+
src: {
|
|
30
|
+
type: "column",
|
|
31
|
+
column: e.name
|
|
32
|
+
},
|
|
33
|
+
filters: t,
|
|
34
|
+
sorting: []
|
|
35
|
+
}), r = s.filter((i) => i.spec.type === "axis"), o = s.filter((i) => i.spec.type === "column");
|
|
36
|
+
return {
|
|
37
|
+
axesData: r.reduce((i, m) => {
|
|
38
|
+
const c = w.fromAxisSpec(m.spec.spec);
|
|
39
|
+
return i[c.toCanonicalString()] = x(c.type, m.data), i;
|
|
40
|
+
}, {}),
|
|
41
|
+
data: o.length ? x(e.type, o[0].data) : []
|
|
42
|
+
};
|
|
43
|
+
} catch (a) {
|
|
44
|
+
throw console.error("PFrame: calculateTableData error"), a;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async getColumnUniqueValues(e, t = I, a = []) {
|
|
48
|
+
if (!await this.isColumnExisted(e))
|
|
49
|
+
return { values: [], overflow: !1 };
|
|
50
|
+
const s = {
|
|
51
|
+
columnId: e.name,
|
|
52
|
+
filters: a,
|
|
53
|
+
limit: t
|
|
54
|
+
};
|
|
55
|
+
try {
|
|
56
|
+
const r = Date.now(), o = await this.pframeDriver.getUniqueValues(this.pframeHandle, s);
|
|
57
|
+
let i = !1;
|
|
58
|
+
return o.overflow && (i = !0, console.warn(`More than ${t} values for ${e.name} column`)), {
|
|
59
|
+
values: Array.from(o.values.data).map(String),
|
|
60
|
+
overflow: i
|
|
61
|
+
};
|
|
62
|
+
} catch (r) {
|
|
63
|
+
throw console.error("PFrame: getUniqueValues for column error"), r;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async getAxisUniqueValues(e, t, a = I, s = []) {
|
|
67
|
+
const r = t.filter(v), o = await Promise.all(r.map((c) => this.getColumnSpecById(c))), i = e.toCanonicalString(), m = r.filter((c, l) => {
|
|
68
|
+
const p = o[l];
|
|
69
|
+
return p !== null && p.axesSpec.some((u) => w.fromAxisSpec(u).toCanonicalString() === i);
|
|
70
|
+
});
|
|
71
|
+
if (m.length === 0)
|
|
72
|
+
return { values: [], overflow: !1 };
|
|
73
|
+
try {
|
|
74
|
+
const c = Date.now(), l = await Promise.all(
|
|
75
|
+
m.map(
|
|
76
|
+
(u) => this.pframeDriver.getUniqueValues(this.pframeHandle, {
|
|
77
|
+
columnId: u.name,
|
|
78
|
+
axis: e.toPFrameId(),
|
|
79
|
+
filters: s,
|
|
80
|
+
limit: a
|
|
81
|
+
})
|
|
82
|
+
)
|
|
83
|
+
);
|
|
84
|
+
let p = !1;
|
|
85
|
+
return l.forEach((u, f) => {
|
|
86
|
+
u.overflow && (p = !0, console.warn(`More than ${a} values for ${m[f].name} column`));
|
|
87
|
+
}), {
|
|
88
|
+
values: S.uniq(
|
|
89
|
+
S.flatten(l.map((u) => Array.from(u.values.data).map(String)))
|
|
90
|
+
),
|
|
91
|
+
overflow: p
|
|
92
|
+
};
|
|
93
|
+
} catch (c) {
|
|
94
|
+
return console.error("PFrame: getUniqueValues for axis error", c), { values: [], overflow: !1 };
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async getTableOuterJoin(e, t, a = [], s = !0, r = [], o = []) {
|
|
98
|
+
const i = e.filter(v), m = t.filter(v), c = {
|
|
99
|
+
src: {
|
|
100
|
+
type: "outer",
|
|
101
|
+
primary: {
|
|
102
|
+
type: s ? "inner" : "full",
|
|
103
|
+
entries: i.map((l, p) => {
|
|
104
|
+
var u;
|
|
105
|
+
const f = (u = r[p]) == null ? void 0 : u.map((n) => ({
|
|
106
|
+
type: "constant",
|
|
107
|
+
axisIndex: n.idx,
|
|
108
|
+
constant: n.value
|
|
109
|
+
})).filter((n) => n.constant !== void 0);
|
|
110
|
+
return f != null && f.length ? {
|
|
111
|
+
type: "slicedColumn",
|
|
112
|
+
newId: l.name,
|
|
113
|
+
column: l.name,
|
|
114
|
+
axisFilters: f
|
|
115
|
+
} : {
|
|
116
|
+
type: "column",
|
|
117
|
+
column: l.name
|
|
118
|
+
};
|
|
119
|
+
})
|
|
120
|
+
},
|
|
121
|
+
secondary: m.map((l, p) => {
|
|
122
|
+
var u;
|
|
123
|
+
const f = (u = o[p]) == null ? void 0 : u.map((n) => ({
|
|
124
|
+
type: "constant",
|
|
125
|
+
axisIndex: n.idx,
|
|
126
|
+
constant: n.value
|
|
127
|
+
})).filter((n) => n.constant !== void 0);
|
|
128
|
+
return f != null && f.length ? {
|
|
129
|
+
type: "slicedColumn",
|
|
130
|
+
newId: l.name,
|
|
131
|
+
column: l.name,
|
|
132
|
+
axisFilters: f
|
|
133
|
+
} : {
|
|
134
|
+
type: "column",
|
|
135
|
+
column: l.name
|
|
136
|
+
};
|
|
137
|
+
})
|
|
138
|
+
},
|
|
139
|
+
filters: a,
|
|
140
|
+
sorting: []
|
|
141
|
+
};
|
|
142
|
+
try {
|
|
143
|
+
const l = Date.now(), p = await this.pframeDriver.calculateTableData(this.pframeHandle, c), u = p.filter((n) => n.spec.type === "axis"), f = p.filter((n) => n.spec.type === "column");
|
|
144
|
+
return {
|
|
145
|
+
axesData: u.reduce((n, d) => {
|
|
146
|
+
const h = w.fromAxisSpec(d.spec.spec);
|
|
147
|
+
return n[h.toCanonicalString()] = x(h.type, d.data), n;
|
|
148
|
+
}, {}),
|
|
149
|
+
columnsData: f.reduce((n, d) => {
|
|
150
|
+
const h = d.spec.spec, g = new C({
|
|
151
|
+
name: d.spec.id,
|
|
152
|
+
type: h.valueType
|
|
153
|
+
});
|
|
154
|
+
return n[g.toCanonicalString()] = x(g.type, d.data), n;
|
|
155
|
+
}, {}),
|
|
156
|
+
columnSpecs: f.reduce((n, d) => {
|
|
157
|
+
const h = d.spec.spec, g = new C({
|
|
158
|
+
name: d.spec.id,
|
|
159
|
+
type: h.valueType
|
|
160
|
+
});
|
|
161
|
+
return n[g.toCanonicalString()] = h, n;
|
|
162
|
+
}, {}),
|
|
163
|
+
axesSpecs: u.reduce((n, d) => {
|
|
164
|
+
const h = d.spec.spec, g = w.fromAxisSpec(h);
|
|
165
|
+
return n[g.toCanonicalString()] = h, n;
|
|
166
|
+
}, {})
|
|
167
|
+
};
|
|
168
|
+
} catch (l) {
|
|
169
|
+
throw console.error("PFrame: table outer join error"), console.info("error with request: ", c), l;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
async getColumnSpecById(e) {
|
|
173
|
+
try {
|
|
174
|
+
const t = Date.now();
|
|
175
|
+
return await this.pframeDriver.getColumnSpec(this.pframeHandle, e.name) ?? null;
|
|
176
|
+
} catch {
|
|
177
|
+
return console.error("PFrame: get single column error"), null;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
async getColumnAxesIds(e) {
|
|
181
|
+
var t;
|
|
182
|
+
return ((t = await this.getColumnSpecById(e)) == null ? void 0 : t.axesSpec.map((a) => w.fromAxisSpec(a))) ?? [];
|
|
183
|
+
}
|
|
184
|
+
async getRequestColumnsFromSelectedSources(e) {
|
|
185
|
+
var t;
|
|
186
|
+
const a = [];
|
|
187
|
+
for (const s of e)
|
|
188
|
+
if (v(s)) {
|
|
189
|
+
const r = ((t = await this.getColumnSpecById(s)) == null ? void 0 : t.axesSpec) ?? [];
|
|
190
|
+
a.push(...r.map((o) => w.fromAxisSpec(o).toPFrameId()));
|
|
191
|
+
}
|
|
192
|
+
return a;
|
|
193
|
+
}
|
|
194
|
+
async getColumnsList() {
|
|
195
|
+
return this.pframeDriver.listColumns(this.pframeHandle);
|
|
196
|
+
}
|
|
197
|
+
async getColumnsFull(e, t, a, s, r) {
|
|
198
|
+
try {
|
|
199
|
+
const o = {
|
|
200
|
+
columnFilter: {
|
|
201
|
+
type: a,
|
|
202
|
+
name: s,
|
|
203
|
+
annotationValue: r
|
|
204
|
+
},
|
|
205
|
+
compatibleWith: await this.getRequestColumnsFromSelectedSources(e),
|
|
206
|
+
strictlyCompatible: t
|
|
207
|
+
// should be true if we want to get meta and false if X/Y
|
|
208
|
+
}, i = Date.now(), m = await this.pframeDriver.findColumns(this.pframeHandle, o), c = [];
|
|
209
|
+
return m.hits.forEach((l) => {
|
|
210
|
+
c.push(l);
|
|
211
|
+
}), c;
|
|
212
|
+
} catch (o) {
|
|
213
|
+
throw console.error("PFrame: findColumns error"), o;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
async getColumns(e, t, a, s, r) {
|
|
217
|
+
return (await this.getColumnsFull(e, t, a, s, r)).map(
|
|
218
|
+
(o) => new C({
|
|
219
|
+
name: o.columnId,
|
|
220
|
+
type: o.spec.valueType
|
|
221
|
+
})
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
async findColumnBy(e, t, a, s) {
|
|
225
|
+
try {
|
|
226
|
+
const r = {
|
|
227
|
+
columnFilter: {
|
|
228
|
+
name: [e],
|
|
229
|
+
...t ? { type: [t] } : {},
|
|
230
|
+
...a ? { annotationValue: a } : {},
|
|
231
|
+
...s ? { domainValue: s } : {}
|
|
232
|
+
},
|
|
233
|
+
compatibleWith: [],
|
|
234
|
+
strictlyCompatible: !1
|
|
235
|
+
}, o = Date.now(), i = await this.pframeDriver.findColumns(this.pframeHandle, r), m = [];
|
|
236
|
+
return i.hits.forEach(({ columnId: c, spec: l }) => {
|
|
237
|
+
m.push(new C({ name: c, type: l.valueType }));
|
|
238
|
+
}), m.length > 1 && console.warn(`More than 1 column found for ${e}}`), m.length === 0 ? (console.warn(`No columns found for ${e}}`), null) : m[0];
|
|
239
|
+
} catch (r) {
|
|
240
|
+
throw console.error("PFrame: findColumns error"), r;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
export {
|
|
245
|
+
V as ColumnsProvider
|
|
246
|
+
};
|
|
247
|
+
//# sourceMappingURL=ColumnsProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColumnsProvider.js","sources":["../../../../../../node_modules/@milaboratories/pf-plots/src/pframe/ColumnsProvider.ts"],"sourcesContent":["import {AxisId, ColumnId, isColumnId} from '../spec';\nimport type {PValue} from '../store';\nimport lodash from 'lodash';\nimport type {\n AxisSpec,\n CalculateTableDataRequest,\n FindColumnsRequest,\n FindColumnsResponse,\n PColumnSpec,\n AxisId as PFrameAxisId,\n PFrameDriver,\n PFrameHandle,\n PObjectId,\n PTableRecordSingleValueFilterV2,\n PTableVector,\n UniqueValuesRequest,\n ValueType,\n FullPTableColumnData,\n PColumnIdAndSpec,\n} from '@milaboratories/pl-model-common';\nimport {pTableValue} from '@milaboratories/pl-model-common';\n\nexport type TableOuterJoinResult = {\n axesData: Record<string, PValue[]>;\n columnsData: Record<string, PValue[]>;\n columnSpecs: Record<string, PColumnSpec>;\n axesSpecs: Record<string, AxisSpec>;\n}\nconst UNIQUE_VALUES_LIMIT = 1000000;\n\nfunction convertColumnData(type: ValueType, response: PTableVector): PValue[] {\n if (type === 'String') {\n return response.data as PValue[];\n }\n const res:PValue[] = new Array(response.data.length);\n for (let i = 0; i < response.data.length; i++) {\n res[i] = pTableValue(response, i, {absent: null, na: null}) as PValue;\n }\n return res;\n}\n\nconst debug = false;\nconst LONG_REQUEST = 100;\n\nif (debug) {\n console.log('debug!');\n}\n\nexport class ColumnsProvider {\n pframeHandle: PFrameHandle;\n pframeDriver: PFrameDriver;\n\n constructor(pframeHandle: PFrameHandle, pframeDriver: PFrameDriver) {\n this.pframeHandle = pframeHandle;\n this.pframeDriver = pframeDriver;\n }\n\n async isColumnExisted(id: ColumnId) {\n const spec = await this.getColumnSpecById(id);\n return spec ? true : false;\n }\n\n async getSingleColumnData(id: ColumnId, filters: PTableRecordSingleValueFilterV2[] = []) {\n if (!(await this.isColumnExisted(id))) {\n return {\n axesData: {},\n data: [],\n };\n }\n try {\n const start = Date.now();\n const response: FullPTableColumnData[] = await this.pframeDriver.calculateTableData(this.pframeHandle, {\n src: {\n type: 'column',\n column: id.name as PObjectId,\n },\n filters,\n sorting: [],\n } as CalculateTableDataRequest<PObjectId>);\n if (debug) {\n const time = Date.now() - start;\n if (time > LONG_REQUEST) console.log('getSingleColumnData', time);\n }\n const axes = response.filter(item => item.spec.type === 'axis');\n const columns = response.filter(item => item.spec.type === 'column');\n return {\n axesData: axes.reduce((res: Record<string, PValue[]>, item) => {\n const id = AxisId.fromAxisSpec(item.spec.spec as AxisSpec);\n res[id.toCanonicalString()] = convertColumnData(id.type, item.data);\n return res;\n }, {}),\n data: columns.length ? convertColumnData(id.type, columns[0].data) : [],\n };\n } catch (err) {\n console.error('PFrame: calculateTableData error');\n throw err;\n }\n }\n\n async getColumnUniqueValues(\n id: ColumnId,\n limit = UNIQUE_VALUES_LIMIT,\n filters: PTableRecordSingleValueFilterV2[] = []\n ) {\n if (!(await this.isColumnExisted(id))) {\n return {values: [], overflow: false};\n }\n const request: UniqueValuesRequest = {\n columnId: id.name as PObjectId,\n filters,\n limit,\n };\n try {\n const start = Date.now();\n const response = await this.pframeDriver.getUniqueValues(this.pframeHandle, request);\n let overflow = false;\n if (response.overflow) {\n overflow = true;\n console.warn(`More than ${limit} values for ${id.name} column`);\n }\n if (debug) {\n const time = Date.now() - start;\n if (time > LONG_REQUEST)\n console.log('getColumnUniqueValues', time, id.type, `${response.values.data.length} items`);\n }\n return {\n values: Array.from(response.values.data as ArrayLike<unknown>).map(String),\n overflow\n };\n } catch (err) {\n console.error('PFrame: getUniqueValues for column error');\n throw err;\n }\n }\n\n async getAxisUniqueValues(\n axisId: AxisId,\n parents: ColumnId[],\n limit = UNIQUE_VALUES_LIMIT,\n filters: PTableRecordSingleValueFilterV2[] = []\n ) {\n const columnParents = parents.filter(isColumnId);\n\n const specs: (PColumnSpec | null)[] = await Promise.all(columnParents.map(c => this.getColumnSpecById(c)));\n const axisIdStr = axisId.toCanonicalString();\n // realParents - parent columns that has axisId in its spec\n const realParents = columnParents.filter((c, idx) => {\n const columnSpec = specs[idx];\n return (\n columnSpec !== null &&\n columnSpec.axesSpec.some(axisSpec => AxisId.fromAxisSpec(axisSpec).toCanonicalString() === axisIdStr)\n );\n });\n if (realParents.length === 0) {\n return {values: [], overflow: false};\n }\n try {\n const start = Date.now();\n const responses = await Promise.all(\n realParents.map(p =>\n this.pframeDriver.getUniqueValues(this.pframeHandle, {\n columnId: p.name as PObjectId,\n axis: axisId.toPFrameId(),\n filters,\n limit,\n })\n )\n );\n let overflow = false;\n responses.forEach((response, idx) => {\n if (response.overflow) {\n overflow = true;\n console.warn(`More than ${limit} values for ${realParents[idx].name} column`);\n }\n })\n if (debug) {\n const time = Date.now() - start;\n if (time > LONG_REQUEST) console.log('getAxisUniqueValues', time);\n }\n return {\n values: lodash.uniq(\n lodash.flatten(responses.map(r => {\n return Array.from(r.values.data as ArrayLike<unknown>).map(String);\n })) as string[]\n ),\n overflow\n };\n } catch (err) {\n console.error('PFrame: getUniqueValues for axis error', err);\n return {values: [], overflow: false};\n }\n }\n\n async getTableOuterJoin(\n primaryIds: (ColumnId | AxisId)[],\n secondaryIds: (ColumnId | AxisId)[],\n filters: PTableRecordSingleValueFilterV2[] = [],\n primaryInnerJoin = true,\n primarySourcesFixedAxes:{idx:number, value:PValue}[][] = [],\n secondarySourcesFixedAxes:{idx:number, value:PValue}[][] = []\n ): Promise<TableOuterJoinResult> {\n const primaryColumns = primaryIds.filter(isColumnId);\n const secondaryColumns = secondaryIds.filter(isColumnId);\n const request = {\n src: {\n type: 'outer',\n primary: {\n type: primaryInnerJoin ? 'inner' : 'full',\n entries: primaryColumns.map((item, idx) => {\n const axisFilters = primarySourcesFixedAxes[idx]?.map(v => ({\n type: 'constant',\n axisIndex: v.idx,\n constant: v.value\n })).filter((v) => v.constant !== undefined);\n return axisFilters?.length\n ? {\n type: 'slicedColumn',\n newId: item.name,\n column: item.name as PObjectId,\n axisFilters\n } : {\n type: 'column',\n column: item.name as PObjectId,\n }\n })\n },\n secondary: secondaryColumns.map((item, idx) => {\n const axisFilters = secondarySourcesFixedAxes[idx]?.map(v => ({\n type: 'constant',\n axisIndex: v.idx,\n constant: v.value\n })).filter((v) => v.constant !== undefined);\n return axisFilters?.length\n ? {\n type: 'slicedColumn',\n newId: item.name,\n column: item.name as PObjectId,\n axisFilters\n } : {\n type: 'column',\n column: item.name as PObjectId,\n }\n }),\n },\n filters,\n sorting: [],\n } as CalculateTableDataRequest<PObjectId>;\n try {\n const start = Date.now();\n const response = await this.pframeDriver.calculateTableData(this.pframeHandle, request);\n if (debug) {\n const time = Date.now() - start;\n if (time > LONG_REQUEST) console.log('getTableOuterJoin', time);\n }\n\n const axes = response.filter(item => item.spec.type === 'axis');\n const columns = response.filter(item => item.spec.type === 'column');\n if (debug) {\n console.log('getTableOuterJoin', `${response[0].data.data.length} items`);\n }\n\n return {\n axesData: axes.reduce((res: Record<string, PValue[]>, item) => {\n const id = AxisId.fromAxisSpec(item.spec.spec as AxisSpec);\n res[id.toCanonicalString()] = convertColumnData(id.type, item.data);\n return res;\n }, {}),\n columnsData: columns.reduce((res: Record<string, PValue[]>, item) => {\n const spec = item.spec.spec as PColumnSpec;\n const id = new ColumnId({\n name: item.spec.id as PObjectId,\n type: spec.valueType,\n });\n res[id.toCanonicalString()] = convertColumnData(id.type, item.data);\n return res;\n }, {}),\n columnSpecs: columns.reduce((res: Record<string, PColumnSpec>, item) => {\n const spec = item.spec.spec as PColumnSpec;\n const id = new ColumnId({\n name: item.spec.id as PObjectId,\n type: spec.valueType,\n });\n res[id.toCanonicalString()] = spec;\n return res;\n }, {}),\n axesSpecs: axes.reduce((res: Record<string, AxisSpec>, item) => {\n const spec = item.spec.spec as AxisSpec;\n const id = AxisId.fromAxisSpec(spec);\n res[id.toCanonicalString()] = spec;\n return res;\n }, {}),\n };\n } catch (err) {\n console.error('PFrame: table outer join error');\n console.info('error with request: ', request);\n throw err;\n }\n }\n\n async getColumnSpecById(id: ColumnId): Promise<PColumnSpec | null> {\n try {\n const start = Date.now();\n const response = await this.pframeDriver.getColumnSpec(this.pframeHandle, id.name as PObjectId);\n if (debug) {\n const time = Date.now() - start;\n if (time > LONG_REQUEST) console.log('getColumnSpecById', time, response);\n }\n return response ?? null;\n } catch (err) {\n console.error('PFrame: get single column error');\n return null;\n }\n }\n\n async getColumnAxesIds(id: ColumnId): Promise<AxisId[]> {\n return (await this.getColumnSpecById(id))?.axesSpec.map(axisSpec => AxisId.fromAxisSpec(axisSpec)) ?? [];\n }\n\n async getRequestColumnsFromSelectedSources(sources: (ColumnId | AxisId)[]): Promise<PFrameAxisId[]> {\n const result: PFrameAxisId[] = [];\n //NB: we don't need to add axes in request because axes are already in columns\n for (const item of sources) {\n if (isColumnId(item)) {\n const axesSpec = (await this.getColumnSpecById(item))?.axesSpec ?? [];\n result.push(...axesSpec.map(spec => AxisId.fromAxisSpec(spec).toPFrameId()));\n }\n }\n return result;\n }\n\n async getColumnsList() {\n return this.pframeDriver.listColumns(this.pframeHandle);\n }\n\n async getColumnsFull(\n selectedSources: (ColumnId | AxisId)[],\n strictlyCompatible: boolean,\n types?: ValueType[],\n names?: string[],\n annotations?: FindColumnsRequest['columnFilter']['annotationValue'],\n ): Promise<PColumnIdAndSpec[]> {\n try {\n const request: FindColumnsRequest = {\n columnFilter: {\n type: types,\n name: names,\n annotationValue: annotations,\n },\n compatibleWith: await this.getRequestColumnsFromSelectedSources(selectedSources),\n strictlyCompatible, // should be true if we want to get meta and false if X/Y\n };\n const start = Date.now();\n const response: FindColumnsResponse = await this.pframeDriver.findColumns(this.pframeHandle, request);\n if (debug) {\n const time = Date.now() - start;\n if (time > LONG_REQUEST) console.log('getColumnsFull', time);\n }\n const result: PColumnIdAndSpec[] = [];\n response.hits.forEach(item => {\n // ***\n // consider mapping variants in qualifications\n // ***\n\n result.push(item);\n });\n return result;\n } catch (err) {\n console.error('PFrame: findColumns error');\n throw err;\n }\n }\n\n async getColumns(\n selectedSources: (ColumnId | AxisId)[],\n strictlyCompatible: boolean,\n types?: ValueType[],\n names?: string[],\n annotations?: FindColumnsRequest['columnFilter']['annotationValue'],\n ): Promise<ColumnId[]> {\n return (await this.getColumnsFull(selectedSources, strictlyCompatible, types, names, annotations)).map(\n item =>\n new ColumnId({\n name: item.columnId,\n type: item.spec.valueType,\n })\n );\n }\n\n async findColumnBy(\n name: string,\n type?: ValueType,\n annotationValue?: FindColumnsRequest['columnFilter']['annotationValue'],\n domainValue?: FindColumnsRequest['columnFilter']['domainValue']\n ): Promise<ColumnId | null> {\n try {\n const request: FindColumnsRequest = {\n columnFilter: {\n name: [name],\n ...(type ? {type: [type]} : {}),\n ...(annotationValue ? {annotationValue} : {}),\n ...(domainValue ? {domainValue} : {}),\n },\n compatibleWith: [] as AxisId[],\n strictlyCompatible: false,\n };\n const start = Date.now();\n const response: FindColumnsResponse = await this.pframeDriver.findColumns(this.pframeHandle, request);\n if (debug) {\n const time = Date.now() - start;\n if (time > LONG_REQUEST) console.log('findColumnBy', time);\n }\n const result: ColumnId[] = [];\n response.hits.forEach(({columnId, spec}) => {\n // ***\n // consider mapping variants in qualifications\n // ***\n\n result.push(new ColumnId({name: columnId, type: spec.valueType}));\n });\n if (result.length > 1) {\n console.warn(`More than 1 column found for ${name}}`);\n }\n if (result.length === 0) {\n console.warn(`No columns found for ${name}}`);\n return null;\n }\n return result[0];\n } catch (err) {\n console.error('PFrame: findColumns error');\n throw err;\n }\n }\n}\n"],"names":["UNIQUE_VALUES_LIMIT","convertColumnData","type","response","res","i","pTableValue","ColumnsProvider","pframeHandle","pframeDriver","__publicField","id","filters","start","axes","u","item","columns","AxisId","err","limit","request","overflow","axisId","parents","columnParents","isColumnId","specs","c","axisIdStr","realParents","idx","columnSpec","axisSpec","responses","p","lodash","r","primaryIds","secondaryIds","primaryInnerJoin","primarySourcesFixedAxes","secondarySourcesFixedAxes","primaryColumns","secondaryColumns","axisFilters","_a","v","spec","ColumnId","sources","result","axesSpec","selectedSources","strictlyCompatible","types","names","annotations","name","annotationValue","domainValue","columnId"],"mappings":";;;;AA4BA,MAAMA,IAAsB;AAE5B,SAASC,EAAkBC,GAAiBC,GAAkC;AAC1E,MAAID,MAAS;AACT,WAAOC,EAAS;AAEpB,QAAMC,IAAe,IAAI,MAAMD,EAAS,KAAK,MAAM;AACnD,WAASE,IAAI,GAAGA,IAAIF,EAAS,KAAK,QAAQE;AAClCD,MAAAC,CAAC,IAAIC,EAAYH,GAAUE,GAAG,EAAC,QAAQ,MAAM,IAAI,MAAK;AAEvD,SAAAD;AACX;AASO,MAAMG,EAAgB;AAAA,EAIzB,YAAYC,GAA4BC,GAA4B;AAHpEC,MAAA,MAAA,cAAA,GACAA,EAAA,MAAA,cAAA,GAGI,KAAK,eAAeF,GACpB,KAAK,eAAeC;AAAAA,EAAA;AAAA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EAAS;AAAA,QACT,MAAMjC,EAAK;AAAA,QACX,MAAMA,EAAK,KAAK;AAAA,MAAA,CACnB;AAAA,IAAA;AAAA,EACT;AAAA,EAGJ,MAAM,aACF0C,GACAxD,GACAyD,GACAC,GACwB;AACpB,QAAA;AACA,YAAMvC,IAA8B;AAAA,QAChC,cAAc;AAAA,UACV,MAAM,CAACqC,CAAI;AAAA,UACX,GAAIxD,IAAO,EAAC,MAAM,CAACA,CAAI,MAAK,CAAA;AAAA,UAC5B,GAAIyD,IAAkB,EAAC,iBAAAA,EAAAA,IAAmB,CAAA;AAAA,UAC1C,GAAIC,IAAc,EAAC,aAAAA,MAAe,CAAA;AAAA,QAAA;AAAA,QAEtC,gBAAgB,CAAA;AAAA,QAChB,oBAAoB;AAAA,MAAA,GAElB/C,IAAQ,KAAK,IAAA,GACbV,IAAgC,MAAM,KAAK,aAAa,YAAY,KAAK,cAAckB,CAAO,GAK9F8B,IAAqB,CAAA;AAWvB,aAVJhD,EAAS,KAAK,QAAQ,CAAC,EAAC,UAAA0D,GAAU,MAAAb,QAAU;AAKjCG,UAAA,KAAK,IAAIF,EAAS,EAAC,MAAMY,GAAU,MAAMb,EAAK,UAAA,CAAU,CAAC;AAAA,MAAA,CACnE,GACGG,EAAO,SAAS,KACR,QAAA,KAAK,gCAAgCO,CAAI,GAAG,GAEpDP,EAAO,WAAW,KACV,QAAA,KAAK,wBAAwBO,CAAI,GAAG,GACrC,QAEJP,EAAO,CAAC;AAAA,IAAA,SACVhC,GAAK;AACV,YAAA,QAAQ,MAAM,2BAA2B,GACnCA;AAAAA,IAAA;AAAA,EACV;AAER;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import s from "./_virtual/canonicalize.js";
|
|
2
|
+
var m = Object.defineProperty, u = (n, t, r) => t in n ? m(n, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[t] = r, e = (n, t, r) => u(n, typeof t != "symbol" ? t + "" : t, r);
|
|
3
|
+
class i {
|
|
4
|
+
constructor({ type: t, name: r, domain: a }) {
|
|
5
|
+
e(this, "kind", "axis"), e(this, "type"), e(this, "name"), e(this, "domain"), this.type = t, this.name = r, this.domain = { ...a };
|
|
6
|
+
}
|
|
7
|
+
toCanonicalString() {
|
|
8
|
+
return s(this);
|
|
9
|
+
}
|
|
10
|
+
static fromAxisSpec(t) {
|
|
11
|
+
return new i({ name: t.name, type: t.type, domain: t.domain });
|
|
12
|
+
}
|
|
13
|
+
static fromAxesSpec(t) {
|
|
14
|
+
return t.map((r) => i.fromAxisSpec(r));
|
|
15
|
+
}
|
|
16
|
+
copy() {
|
|
17
|
+
return new i({ type: this.type, name: this.name, domain: this.domain });
|
|
18
|
+
}
|
|
19
|
+
toPFrameId() {
|
|
20
|
+
return {
|
|
21
|
+
type: this.type,
|
|
22
|
+
name: this.name,
|
|
23
|
+
domain: this.domain
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
static fromPojo(t) {
|
|
27
|
+
return new i(t);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
class o {
|
|
31
|
+
constructor({ name: t, type: r }) {
|
|
32
|
+
e(this, "kind", "column"), e(this, "name"), e(this, "type"), this.name = t, this.type = r;
|
|
33
|
+
}
|
|
34
|
+
toCanonicalString() {
|
|
35
|
+
return s(this);
|
|
36
|
+
}
|
|
37
|
+
static fromPojo(t) {
|
|
38
|
+
return new o(t);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function d(n) {
|
|
42
|
+
return n !== null && n.kind === "column";
|
|
43
|
+
}
|
|
44
|
+
function h(n) {
|
|
45
|
+
return n !== null && n.kind === "axis";
|
|
46
|
+
}
|
|
47
|
+
function p(n) {
|
|
48
|
+
const t = JSON.parse(n);
|
|
49
|
+
if (t.kind === "column")
|
|
50
|
+
return o.fromPojo(t);
|
|
51
|
+
if (t.kind === "axis")
|
|
52
|
+
return i.fromPojo(t);
|
|
53
|
+
throw Error("wrong column or axis object");
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
i as AxisId,
|
|
57
|
+
o as ColumnId,
|
|
58
|
+
p as columnOrAxisIdFromString,
|
|
59
|
+
h as isAxisId,
|
|
60
|
+
d as isColumnId
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec.js","sources":["../../../../../node_modules/@milaboratories/pf-plots/src/spec.ts"],"sourcesContent":["import canonicalize from 'canonicalize';\nimport type {\n AxisSpec,\n AxisId as PFrameAxisId,\n ValueType,\n} from '@milaboratories/pl-model-common';\n\ninterface ToCanonicalString {\n toCanonicalString(): ColumnOrAxisIdString;\n}\n\ninterface AxisIdProps {\n type: ValueType;\n name: string;\n domain?: Record<string, string>;\n}\n\ninterface AxisIdPojo {\n kind: 'axis';\n type: ValueType;\n name: string;\n domain?: Record<string, string>;\n}\n\nexport class AxisId implements ToCanonicalString {\n kind = 'axis';\n type: ValueType;\n name: string;\n domain?: Record<string, string>;\n\n constructor({type, name, domain}: AxisIdProps) {\n this.type = type;\n this.name = name;\n this.domain = {...domain};\n }\n\n toCanonicalString(): ColumnOrAxisIdString {\n return canonicalize(this)!;\n }\n\n static fromAxisSpec(axisSpec: AxisSpec) {\n return new AxisId({name: axisSpec.name, type: axisSpec.type, domain: axisSpec.domain});\n }\n\n static fromAxesSpec(axesSpec: AxisSpec[]): AxisId[] {\n return axesSpec.map(axis => AxisId.fromAxisSpec(axis));\n }\n\n copy(): AxisId {\n return new AxisId({type: this.type, name: this.name, domain: this.domain});\n }\n\n toPFrameId():PFrameAxisId {\n return {\n type: this.type,\n name: this.name,\n domain: this.domain\n };\n }\n\n static fromPojo(values: AxisIdPojo) {\n return new AxisId(values);\n }\n}\n\ninterface ColumnIdProps {\n name: string;\n type: ValueType;\n}\n\ninterface ColumnIdPojo {\n kind: 'column';\n name: string;\n type: ValueType;\n}\n\nexport class ColumnId implements ToCanonicalString {\n kind = 'column';\n name: string;\n type: ValueType;\n\n constructor({name, type}: ColumnIdProps) {\n this.name = name;\n this.type = type;\n }\n\n toCanonicalString(): ColumnOrAxisIdString {\n return canonicalize(this)!;\n }\n\n static fromPojo(pojo: ColumnIdPojo) {\n return new ColumnId(pojo);\n }\n}\n\nexport function isColumnId(id: ColumnId | AxisId | null): id is ColumnId {\n return id !== null && id.kind === 'column';\n}\n\nexport function isAxisId(id: ColumnId | AxisId | null): id is AxisId {\n return id !== null && id.kind === 'axis';\n}\n\nexport type ColumnOrAxisIdString = string;\n\nexport function columnOrAxisIdFromString(str: ColumnOrAxisIdString) {\n const pojo: ColumnIdPojo | AxisIdPojo = JSON.parse(str);\n if (pojo.kind === 'column') {\n return ColumnId.fromPojo(pojo);\n }\n if (pojo.kind === 'axis') {\n return AxisId.fromPojo(pojo);\n }\n throw Error('wrong column or axis object');\n}\n"],"names":["AxisId","type","name","domain","__publicField","canonicalize","axisSpec","axesSpec","axis","values","ColumnId","pojo","isColumnId","id","isAxisId","columnOrAxisIdFromString","str"],"mappings":";;AAwBO,MAAMA,EAAoC;AAAA,EAM7C,YAAY,EAAC,MAAAC,GAAM,MAAAC,GAAM,QAAAC,KAAsB;AAL/CC,IAAAA,EAAA,MAAA,QAAO,MAAA,GACPA,EAAA,MAAA,MAAA,GACAA,EAAA,MAAA,MAAA,GACAA,EAAA,MAAA,QAAA,GAGI,KAAK,OAAOH,GACZ,KAAK,OAAOC,GACP,KAAA,SAAS,EAAC,GAAGC,EAAAA;AAAAA,EAAM;AAAA,EAG5B,oBAA0C;AACtC,WAAOE,EAAa,IAAI;AAAA,EAAA;AAAA,EAG5B,OAAO,aAAaC,GAAoB;AACpC,WAAO,IAAIN,EAAO,EAAC,MAAMM,EAAS,MAAM,MAAMA,EAAS,MAAM,QAAQA,EAAS,OAAA,CAAO;AAAA,EAAA;AAAA,EAGzF,OAAO,aAAaC,GAAgC;AAChD,WAAOA,EAAS,IAAI,CAAAC,MAAQR,EAAO,aAAaQ,CAAI,CAAC;AAAA,EAAA;AAAA,EAGzD,OAAe;AACX,WAAO,IAAIR,EAAO,EAAC,MAAM,KAAK,MAAM,MAAM,KAAK,MAAM,QAAQ,KAAK,OAAA,CAAO;AAAA,EAAA;AAAA,EAG7E,aAA0B;AACf,WAAA;AAAA,MACH,MAAM,KAAK;AAAA,MACX,MAAM,KAAK;AAAA,MACX,QAAQ,KAAK;AAAA,IAAA;AAAA,EACjB;AAAA,EAGJ,OAAO,SAASS,GAAoB;AACzB,WAAA,IAAIT,EAAOS,CAAM;AAAA,EAAA;AAEhC;AAaO,MAAMC,EAAsC;AAAA,EAK/C,YAAY,EAAC,MAAAR,GAAM,MAAAD,EAAAA,GAAsB;AAJzCG,IAAAA,EAAA,MAAA,QAAO,QAAA,GACPA,EAAA,MAAA,MAAA,GACAA,EAAA,MAAA,MAAA,GAGI,KAAK,OAAOF,GACZ,KAAK,OAAOD;AAAAA,EAAA;AAAA,EAGhB,oBAA0C;AACtC,WAAOI,EAAa,IAAI;AAAA,EAAA;AAAA,EAG5B,OAAO,SAASM,GAAoB;AACzB,WAAA,IAAID,EAASC,CAAI;AAAA,EAAA;AAEhC;AAEO,SAASC,EAAWC,GAA8C;AAC9D,SAAAA,MAAO,QAAQA,EAAG,SAAS;AACtC;AAEO,SAASC,EAASD,GAA4C;AAC1D,SAAAA,MAAO,QAAQA,EAAG,SAAS;AACtC;AAIO,SAASE,EAAyBC,GAA2B;AAC1D,QAAAL,IAAkC,KAAK,MAAMK,CAAG;AAClD,MAAAL,EAAK,SAAS;AACP,WAAAD,EAAS,SAASC,CAAI;AAE7B,MAAAA,EAAK,SAAS;AACP,WAAAX,EAAO,SAASW,CAAI;AAE/B,QAAM,MAAM,6BAA6B;AAC7C;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { LinkerMap as L, getNormalizedAxesList as F } from "./node_modules/@milaboratories/pl-model-common/dist/index.js";
|
|
2
|
+
import { columnOrAxisIdFromString as f, isColumnId as S, AxisId as p, ColumnId as T, isAxisId as C } from "./spec.js";
|
|
3
|
+
import { SUBSET_FILTER_KEY as I, DISCRETE_FILTER_KEY as A, IS_LINKER_COLUMN as M, COLUMN_LABEL_KEY as O, IS_VIRTUAL_COLUMN as R, AXIS_NATURE_KEY as U, COLUMN_NAME_KEY as V, COLUMN_DOMAIN_KEY as $ } from "./constants.js";
|
|
4
|
+
import w from "./_virtual/canonicalize.js";
|
|
5
|
+
async function Q(e, n, a, o, i, t, r = !0, c) {
|
|
6
|
+
var l, d, y, g;
|
|
7
|
+
const u = f(n);
|
|
8
|
+
if (S(u)) {
|
|
9
|
+
const s = await e.pFrameProvider.getColumnSpecById(u);
|
|
10
|
+
if (!s)
|
|
11
|
+
return;
|
|
12
|
+
const v = G(
|
|
13
|
+
s,
|
|
14
|
+
i,
|
|
15
|
+
t,
|
|
16
|
+
c
|
|
17
|
+
).map((m) => p.fromAxisSpec(m).toCanonicalString()), N = new Set(v), P = s.axesSpec.map((m) => p.fromAxisSpec(m).toCanonicalString()), b = {};
|
|
18
|
+
r && P.forEach((m, x) => {
|
|
19
|
+
N.has(m) && (b[m] = x);
|
|
20
|
+
});
|
|
21
|
+
const _ = {
|
|
22
|
+
kind: "column",
|
|
23
|
+
name: s.name,
|
|
24
|
+
label: a ?? await h(e, n, []),
|
|
25
|
+
type: s.valueType,
|
|
26
|
+
spec: s,
|
|
27
|
+
annotations: s.annotations,
|
|
28
|
+
isSubsetFilter: ((l = s.annotations) == null ? void 0 : l[I]) === "true",
|
|
29
|
+
isDiscreteFilter: s.valueType === "String" || ((d = s.annotations) == null ? void 0 : d[A]) === "true",
|
|
30
|
+
axesToBeFixed: v,
|
|
31
|
+
axesToBeFixedIndexes: b
|
|
32
|
+
};
|
|
33
|
+
o.set(u.toCanonicalString(), _);
|
|
34
|
+
for (const m of s.axesSpec) {
|
|
35
|
+
const x = p.fromAxisSpec(m).toCanonicalString();
|
|
36
|
+
if (o.has(x))
|
|
37
|
+
continue;
|
|
38
|
+
const k = z(m), D = {
|
|
39
|
+
kind: "axis",
|
|
40
|
+
name: m.name,
|
|
41
|
+
label: await h(e, x, [n]),
|
|
42
|
+
type: m.type,
|
|
43
|
+
mustBeConsumed: k,
|
|
44
|
+
dividable: !1,
|
|
45
|
+
spec: m,
|
|
46
|
+
annotations: m.annotations,
|
|
47
|
+
isSubsetFilter: ((y = m.annotations) == null ? void 0 : y[I]) === "true",
|
|
48
|
+
isDiscreteFilter: m.type === "String" || ((g = m.annotations) == null ? void 0 : g[A]) === "true",
|
|
49
|
+
parentSources: [n]
|
|
50
|
+
};
|
|
51
|
+
o.set(x, D);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function Z(e) {
|
|
56
|
+
const n = f(e), { name: a, type: o } = n;
|
|
57
|
+
return S(n) ? {
|
|
58
|
+
kind: "column",
|
|
59
|
+
name: "",
|
|
60
|
+
label: " ",
|
|
61
|
+
type: n.type,
|
|
62
|
+
spec: { axesSpec: [], kind: "PColumn", valueType: n.type, name: a },
|
|
63
|
+
annotations: void 0,
|
|
64
|
+
isSubsetFilter: !1,
|
|
65
|
+
isDiscreteFilter: n.type === "String",
|
|
66
|
+
axesToBeFixed: [],
|
|
67
|
+
axesToBeFixedIndexes: {}
|
|
68
|
+
} : {
|
|
69
|
+
kind: "axis",
|
|
70
|
+
name: "",
|
|
71
|
+
label: " ",
|
|
72
|
+
type: o,
|
|
73
|
+
spec: { type: o, name: a },
|
|
74
|
+
mustBeConsumed: !1,
|
|
75
|
+
dividable: !1,
|
|
76
|
+
annotations: void 0,
|
|
77
|
+
isSubsetFilter: !1,
|
|
78
|
+
isDiscreteFilter: o === "String",
|
|
79
|
+
parentSources: []
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function ee(e) {
|
|
83
|
+
return {
|
|
84
|
+
type: e.type,
|
|
85
|
+
components: { ...e.components },
|
|
86
|
+
dividedAxes: { ...e.dividedAxes }
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function K(e) {
|
|
90
|
+
const { selectedSource: n, type: a, selectedFilterRange: o, selectedFilterValue: i } = e, t = f(n);
|
|
91
|
+
if (!t)
|
|
92
|
+
throw Error("Empty source selected");
|
|
93
|
+
if (a === "range") {
|
|
94
|
+
const r = [];
|
|
95
|
+
return (o == null ? void 0 : o.max) !== void 0 && r.push({
|
|
96
|
+
type: "bySingleColumnV2",
|
|
97
|
+
column: C(t) ? { type: "axis", id: t.toPFrameId() } : { type: "column", id: t.name },
|
|
98
|
+
predicate: {
|
|
99
|
+
operator: "LessOrEqual",
|
|
100
|
+
reference: o.max
|
|
101
|
+
}
|
|
102
|
+
}), (o == null ? void 0 : o.min) !== void 0 && r.push({
|
|
103
|
+
type: "bySingleColumnV2",
|
|
104
|
+
column: C(t) ? { type: "axis", id: t.toPFrameId() } : { type: "column", id: t.name },
|
|
105
|
+
predicate: {
|
|
106
|
+
operator: "GreaterOrEqual",
|
|
107
|
+
reference: o == null ? void 0 : o.min
|
|
108
|
+
}
|
|
109
|
+
}), r;
|
|
110
|
+
} else if (a === "subset")
|
|
111
|
+
return [
|
|
112
|
+
{
|
|
113
|
+
type: "bySingleColumnV2",
|
|
114
|
+
column: C(t) ? { type: "axis", id: t.toPFrameId() } : { type: "column", id: t.name },
|
|
115
|
+
predicate: {
|
|
116
|
+
operator: "Not",
|
|
117
|
+
operand: { operator: "IsNA" }
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
];
|
|
121
|
+
return typeof i > "u" ? [] : [
|
|
122
|
+
{
|
|
123
|
+
type: "bySingleColumnV2",
|
|
124
|
+
column: C(t) ? { type: "axis", id: t.toPFrameId() } : {
|
|
125
|
+
type: "column",
|
|
126
|
+
id: t.name
|
|
127
|
+
},
|
|
128
|
+
predicate: {
|
|
129
|
+
operator: "Equal",
|
|
130
|
+
reference: t.type === "String" ? String(i) : Number(i)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
];
|
|
134
|
+
}
|
|
135
|
+
function ne(e) {
|
|
136
|
+
const n = [];
|
|
137
|
+
for (const a of e)
|
|
138
|
+
n.push(...K(a));
|
|
139
|
+
return n;
|
|
140
|
+
}
|
|
141
|
+
function E(e) {
|
|
142
|
+
var n, a;
|
|
143
|
+
if ("kind" in e && e.kind === "PColumn") {
|
|
144
|
+
const t = e.name ?? ((n = e.annotations) == null ? void 0 : n[V]), r = e.domain ?? ((a = e.annotations) == null ? void 0 : a[$]);
|
|
145
|
+
return w({ name: t, domain: r });
|
|
146
|
+
}
|
|
147
|
+
const o = e.name, i = e.domain;
|
|
148
|
+
return w({ name: o, domain: i });
|
|
149
|
+
}
|
|
150
|
+
async function B(e, n, a) {
|
|
151
|
+
for (const o of a) {
|
|
152
|
+
const i = f(o);
|
|
153
|
+
if (S(i)) {
|
|
154
|
+
const t = await e.pFrameProvider.getColumnSpecById(i), r = ((t == null ? void 0 : t.axesSpec) ?? []).find(
|
|
155
|
+
(c) => p.fromAxisSpec(c).toCanonicalString() === n.toCanonicalString()
|
|
156
|
+
);
|
|
157
|
+
if (r)
|
|
158
|
+
return r;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
const Y = "pl7.app/label";
|
|
164
|
+
async function q(e, n, a) {
|
|
165
|
+
const o = f(n);
|
|
166
|
+
if (S(o))
|
|
167
|
+
return;
|
|
168
|
+
async function i(l) {
|
|
169
|
+
const d = await B(e, l, a);
|
|
170
|
+
return d ? E(d) : null;
|
|
171
|
+
}
|
|
172
|
+
const t = await e.pFrameProvider.getColumnsFull([], !1, void 0, [Y]), r = await i(o), c = t.find(({ spec: l }) => l && l.axesSpec.length === 1 && E(l.axesSpec[0]) === r);
|
|
173
|
+
return c ? new T({ name: c.columnId, type: c.spec.valueType }) : void 0;
|
|
174
|
+
}
|
|
175
|
+
async function j(e, n, a) {
|
|
176
|
+
const o = f(n), i = await q(e, n, a);
|
|
177
|
+
let t;
|
|
178
|
+
return S(o) ? t = await e.pFrameProvider.getColumnSpecById(i ?? o) : t = i ? await e.pFrameProvider.getColumnSpecById(i) : await B(e, o, a), t;
|
|
179
|
+
}
|
|
180
|
+
async function h(e, n, a) {
|
|
181
|
+
var o;
|
|
182
|
+
const i = await j(e, n, a);
|
|
183
|
+
if (!i)
|
|
184
|
+
return "";
|
|
185
|
+
const t = ((o = i.annotations) == null ? void 0 : o[O]) ?? i.name;
|
|
186
|
+
return e.labelsModifier(i.name, t);
|
|
187
|
+
}
|
|
188
|
+
function z(e) {
|
|
189
|
+
var n, a;
|
|
190
|
+
const o = (a = (n = e.annotations) == null ? void 0 : n[U]) == null ? void 0 : a.toLowerCase();
|
|
191
|
+
return !!o && o !== "homogenous" && o !== "homogeneous";
|
|
192
|
+
}
|
|
193
|
+
function te(e) {
|
|
194
|
+
var n, a;
|
|
195
|
+
return ((n = e.annotations) == null ? void 0 : n[I]) === "true" || ((a = e.annotations) == null || a[A]), !0;
|
|
196
|
+
}
|
|
197
|
+
function oe(e) {
|
|
198
|
+
var n, a;
|
|
199
|
+
return !e.name.includes("metadata") && ((n = e.annotations) == null ? void 0 : n[R]) !== "true" && ((a = e.annotations) == null ? void 0 : a[I]) !== "true";
|
|
200
|
+
}
|
|
201
|
+
async function ae(e, n) {
|
|
202
|
+
const a = /* @__PURE__ */ new Set(), o = [];
|
|
203
|
+
for (const i of n) {
|
|
204
|
+
const t = f(i);
|
|
205
|
+
if (S(t)) {
|
|
206
|
+
const r = await e.pFrameProvider.getColumnSpecById(t);
|
|
207
|
+
if (!r)
|
|
208
|
+
continue;
|
|
209
|
+
r.axesSpec.forEach((c) => {
|
|
210
|
+
const l = p.fromAxisSpec(c).toCanonicalString();
|
|
211
|
+
a.has(l) || (a.add(l), o.push(c));
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return o;
|
|
216
|
+
}
|
|
217
|
+
async function ie(e) {
|
|
218
|
+
const n = await e.pFrameProvider.getColumnsFull(
|
|
219
|
+
[],
|
|
220
|
+
!1,
|
|
221
|
+
void 0,
|
|
222
|
+
void 0,
|
|
223
|
+
{ [M]: "true" }
|
|
224
|
+
);
|
|
225
|
+
return L.fromColumns(n);
|
|
226
|
+
}
|
|
227
|
+
async function re(e, n, a, o, i) {
|
|
228
|
+
const t = f(o);
|
|
229
|
+
if (!S(t))
|
|
230
|
+
return [];
|
|
231
|
+
const r = await e.pFrameProvider.getColumnSpecById(t);
|
|
232
|
+
if (!r)
|
|
233
|
+
return [];
|
|
234
|
+
const c = r.axesSpec.filter(
|
|
235
|
+
(u) => {
|
|
236
|
+
const s = p.fromAxisSpec(u).toCanonicalString();
|
|
237
|
+
return !(i != null && i.some((v) => v.axisSource === s));
|
|
238
|
+
}
|
|
239
|
+
), l = new Set(a.map((u) => p.fromAxisSpec(u).toCanonicalString())), d = c.filter((u) => {
|
|
240
|
+
const s = p.fromAxisSpec(u).toCanonicalString();
|
|
241
|
+
return !l.has(s);
|
|
242
|
+
}), y = F(a), g = F(d);
|
|
243
|
+
return n.getLinkerColumnsForAxes({ from: y, to: g }).map((u) => new T({ name: u.columnId, type: u.spec.valueType }));
|
|
244
|
+
}
|
|
245
|
+
function G(e, n, a, o) {
|
|
246
|
+
const i = new Set(n.map((l) => p.fromAxisSpec(l).toCanonicalString())), t = F(e.axesSpec).filter(
|
|
247
|
+
(l) => !i.has(p.fromAxisSpec(l).toCanonicalString())
|
|
248
|
+
), r = F(n), c = L.getAxesRoots(t);
|
|
249
|
+
return o.getNonLinkableAxes(r, c);
|
|
250
|
+
}
|
|
251
|
+
function se(e, n) {
|
|
252
|
+
const a = n.columnsData[Object.keys(n.columnsData)[0]].length, o = new Int32Array(a).fill(0);
|
|
253
|
+
for (let i = 0; i < a; i++) {
|
|
254
|
+
let t = !1;
|
|
255
|
+
for (let r = 0; r < e.length; r++) {
|
|
256
|
+
const { selectedSource: c, selectedFilterValue: l, selectedFilterRange: d, type: y } = e[r], g = f(c), u = (S(g) ? n.columnsData[c] : n.axesData[c])[i];
|
|
257
|
+
if (l !== void 0 && (t = t || u === l), d !== void 0 && (d.min !== void 0 || d.max !== void 0) && typeof u == "number") {
|
|
258
|
+
let s = !0;
|
|
259
|
+
d.min !== void 0 && (s = s && u >= d.min), d.max !== void 0 && (s = s && u <= d.max), t = t || s;
|
|
260
|
+
}
|
|
261
|
+
y === "subset" && (t = t || u != null);
|
|
262
|
+
}
|
|
263
|
+
t && (o[i] = 1);
|
|
264
|
+
}
|
|
265
|
+
return o;
|
|
266
|
+
}
|
|
267
|
+
export {
|
|
268
|
+
Q as addSourceInfoToMap,
|
|
269
|
+
z as axisMustBeConsumed,
|
|
270
|
+
te as checkSourceBySpecForFilters,
|
|
271
|
+
se as createHighlightColumn,
|
|
272
|
+
ie as createLinkerMap,
|
|
273
|
+
oe as dataColumnPredicateDefault,
|
|
274
|
+
ae as getAxesSpecsFromSources,
|
|
275
|
+
h as getColumnOrAxisLabel,
|
|
276
|
+
j as getColumnOrAxisSpec,
|
|
277
|
+
q as getColumnOrAxisValueLabelsId,
|
|
278
|
+
Z as getDefaultInfo,
|
|
279
|
+
K as getFilterFromState,
|
|
280
|
+
ne as getFiltersFromStates,
|
|
281
|
+
E as getGlobalId,
|
|
282
|
+
re as getLinkerColumnsForSource,
|
|
283
|
+
G as getNotAllowedAxes,
|
|
284
|
+
ee as getStateCopy
|
|
285
|
+
};
|
|
286
|
+
//# sourceMappingURL=utils.js.map
|