@uwdata/mosaic-spec 0.6.1 → 0.7.0
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/LICENSE +19 -0
- package/dist/mosaic-spec.js +397 -354
- package/dist/mosaic-spec.min.js +20 -20
- package/package.json +5 -5
package/dist/mosaic-spec.js
CHANGED
|
@@ -12884,6 +12884,15 @@ var Query = class _Query {
|
|
|
12884
12884
|
static except(...queries) {
|
|
12885
12885
|
return new SetOperation("EXCEPT", queries.flat());
|
|
12886
12886
|
}
|
|
12887
|
+
static describe(query) {
|
|
12888
|
+
const q = query.clone();
|
|
12889
|
+
const { clone, toString } = q;
|
|
12890
|
+
return Object.assign(q, {
|
|
12891
|
+
describe: true,
|
|
12892
|
+
clone: () => _Query.describe(clone.call(q)),
|
|
12893
|
+
toString: () => `DESCRIBE ${toString.call(q)}`
|
|
12894
|
+
});
|
|
12895
|
+
}
|
|
12887
12896
|
constructor() {
|
|
12888
12897
|
this.query = {
|
|
12889
12898
|
with: [],
|
|
@@ -13118,6 +13127,7 @@ var Query = class _Query {
|
|
|
13118
13127
|
}
|
|
13119
13128
|
toString() {
|
|
13120
13129
|
const {
|
|
13130
|
+
with: cte,
|
|
13121
13131
|
select: select2,
|
|
13122
13132
|
distinct: distinct2,
|
|
13123
13133
|
from: from2,
|
|
@@ -13129,8 +13139,7 @@ var Query = class _Query {
|
|
|
13129
13139
|
qualify,
|
|
13130
13140
|
orderby,
|
|
13131
13141
|
limit,
|
|
13132
|
-
offset: offset2
|
|
13133
|
-
with: cte
|
|
13142
|
+
offset: offset2
|
|
13134
13143
|
} = this.query;
|
|
13135
13144
|
const sql2 = [];
|
|
13136
13145
|
if (cte.length) {
|
|
@@ -13252,6 +13261,9 @@ var SetOperation = class _SetOperation {
|
|
|
13252
13261
|
function isQuery(value) {
|
|
13253
13262
|
return value instanceof Query || value instanceof SetOperation;
|
|
13254
13263
|
}
|
|
13264
|
+
function isDescribeQuery(value) {
|
|
13265
|
+
return isQuery(value) && value.describe;
|
|
13266
|
+
}
|
|
13255
13267
|
function unquote(s2) {
|
|
13256
13268
|
return isDoubleQuoted(s2) ? s2.slice(1, -1) : s2;
|
|
13257
13269
|
}
|
|
@@ -13433,131 +13445,6 @@ function toDuckDBValue(value) {
|
|
|
13433
13445
|
}
|
|
13434
13446
|
}
|
|
13435
13447
|
|
|
13436
|
-
// ../core/src/util/js-type.js
|
|
13437
|
-
function jsType(type2) {
|
|
13438
|
-
switch (type2) {
|
|
13439
|
-
case "BIGINT":
|
|
13440
|
-
case "HUGEINT":
|
|
13441
|
-
case "INTEGER":
|
|
13442
|
-
case "SMALLINT":
|
|
13443
|
-
case "TINYINT":
|
|
13444
|
-
case "UBIGINT":
|
|
13445
|
-
case "UINTEGER":
|
|
13446
|
-
case "USMALLINT":
|
|
13447
|
-
case "UTINYINT":
|
|
13448
|
-
case "DOUBLE":
|
|
13449
|
-
case "FLOAT":
|
|
13450
|
-
case "REAL":
|
|
13451
|
-
case "DECIMAL":
|
|
13452
|
-
return "number";
|
|
13453
|
-
case "DATE":
|
|
13454
|
-
case "TIMESTAMP":
|
|
13455
|
-
case "TIMESTAMPTZ":
|
|
13456
|
-
case "TIMESTAMP WITH TIME ZONE":
|
|
13457
|
-
case "TIME":
|
|
13458
|
-
case "TIMESTAMP_NS":
|
|
13459
|
-
return "date";
|
|
13460
|
-
case "BOOLEAN":
|
|
13461
|
-
return "boolean";
|
|
13462
|
-
case "VARCHAR":
|
|
13463
|
-
case "UUID":
|
|
13464
|
-
return "string";
|
|
13465
|
-
case "LIST":
|
|
13466
|
-
return "array";
|
|
13467
|
-
case "BLOB":
|
|
13468
|
-
case "STRUCT":
|
|
13469
|
-
case "MAP":
|
|
13470
|
-
return "object";
|
|
13471
|
-
default:
|
|
13472
|
-
throw new Error(`Unsupported type: ${type2}`);
|
|
13473
|
-
}
|
|
13474
|
-
}
|
|
13475
|
-
|
|
13476
|
-
// ../core/src/util/summarize.js
|
|
13477
|
-
var Count = "count";
|
|
13478
|
-
var Nulls = "nulls";
|
|
13479
|
-
var Max = "max";
|
|
13480
|
-
var Min = "min";
|
|
13481
|
-
var Distinct = "distinct";
|
|
13482
|
-
var statMap = {
|
|
13483
|
-
[Count]: count,
|
|
13484
|
-
[Distinct]: (column3) => count(column3).distinct(),
|
|
13485
|
-
[Max]: max,
|
|
13486
|
-
[Min]: min,
|
|
13487
|
-
[Nulls]: (column3) => count().where(isNull(column3))
|
|
13488
|
-
};
|
|
13489
|
-
function summarize({ table: table3, column: column3 }, stats) {
|
|
13490
|
-
return Query.from(table3).select(stats.map((s2) => [s2, statMap[s2](column3)]));
|
|
13491
|
-
}
|
|
13492
|
-
|
|
13493
|
-
// ../core/src/Catalog.js
|
|
13494
|
-
var object = () => /* @__PURE__ */ Object.create(null);
|
|
13495
|
-
var Catalog = class {
|
|
13496
|
-
constructor(coordinator2) {
|
|
13497
|
-
this.mc = coordinator2;
|
|
13498
|
-
this.clear();
|
|
13499
|
-
}
|
|
13500
|
-
clear() {
|
|
13501
|
-
this.tables = object();
|
|
13502
|
-
}
|
|
13503
|
-
tableInfo(table3) {
|
|
13504
|
-
const cache = this.tables;
|
|
13505
|
-
if (cache[table3]) {
|
|
13506
|
-
return cache[table3];
|
|
13507
|
-
}
|
|
13508
|
-
const infoPromise = getTableInfo(this.mc, table3).catch((err) => {
|
|
13509
|
-
cache[table3] = null;
|
|
13510
|
-
throw err;
|
|
13511
|
-
});
|
|
13512
|
-
return cache[table3] = infoPromise;
|
|
13513
|
-
}
|
|
13514
|
-
async fieldInfo({ table: table3, column: column3, stats }) {
|
|
13515
|
-
const tableInfo = await this.tableInfo(table3);
|
|
13516
|
-
const colInfo = tableInfo[column3];
|
|
13517
|
-
if (colInfo == null)
|
|
13518
|
-
return;
|
|
13519
|
-
if (!stats?.length)
|
|
13520
|
-
return colInfo;
|
|
13521
|
-
const result = await this.mc.query(
|
|
13522
|
-
summarize(colInfo, stats),
|
|
13523
|
-
{ persist: true }
|
|
13524
|
-
);
|
|
13525
|
-
const info = { ...colInfo, ...Array.from(result)[0] };
|
|
13526
|
-
for (const key in info) {
|
|
13527
|
-
const value = info[key];
|
|
13528
|
-
if (typeof value === "bigint") {
|
|
13529
|
-
info[key] = Number(value);
|
|
13530
|
-
}
|
|
13531
|
-
}
|
|
13532
|
-
return info;
|
|
13533
|
-
}
|
|
13534
|
-
async queryFields(fields) {
|
|
13535
|
-
const list = await resolveFields(this, fields);
|
|
13536
|
-
const data = await Promise.all(list.map((f) => this.fieldInfo(f)));
|
|
13537
|
-
return data.filter((x3) => x3);
|
|
13538
|
-
}
|
|
13539
|
-
};
|
|
13540
|
-
async function getTableInfo(mc, table3) {
|
|
13541
|
-
const result = await mc.query(
|
|
13542
|
-
`DESCRIBE ${asRelation(table3)}`,
|
|
13543
|
-
{ type: "json", cache: false }
|
|
13544
|
-
);
|
|
13545
|
-
const columns = object();
|
|
13546
|
-
for (const entry of result) {
|
|
13547
|
-
columns[entry.column_name] = {
|
|
13548
|
-
table: table3,
|
|
13549
|
-
column: entry.column_name,
|
|
13550
|
-
sqlType: entry.column_type,
|
|
13551
|
-
type: jsType(entry.column_type),
|
|
13552
|
-
nullable: entry.null === "YES"
|
|
13553
|
-
};
|
|
13554
|
-
}
|
|
13555
|
-
return columns;
|
|
13556
|
-
}
|
|
13557
|
-
async function resolveFields(catalog, list) {
|
|
13558
|
-
return list.length === 1 && list[0].column === "*" ? Object.values(await catalog.tableInfo(list[0].table)) : list;
|
|
13559
|
-
}
|
|
13560
|
-
|
|
13561
13448
|
// ../core/src/util/hash.js
|
|
13562
13449
|
function fnv_hash(v2) {
|
|
13563
13450
|
let a2 = 2166136261;
|
|
@@ -13917,7 +13804,7 @@ function consolidate(group3, enqueue, record) {
|
|
|
13917
13804
|
type: "arrow",
|
|
13918
13805
|
cache: false,
|
|
13919
13806
|
record: false,
|
|
13920
|
-
query: consolidatedQuery(group3, record)
|
|
13807
|
+
query: group3.query = consolidatedQuery(group3, record)
|
|
13921
13808
|
},
|
|
13922
13809
|
result: group3.result = queryResult()
|
|
13923
13810
|
});
|
|
@@ -13965,7 +13852,7 @@ function consolidatedQuery(group3, record) {
|
|
|
13965
13852
|
return query.$select(Array.from(fields.values()));
|
|
13966
13853
|
}
|
|
13967
13854
|
async function processResults(group3, cache) {
|
|
13968
|
-
const { maps, result } = group3;
|
|
13855
|
+
const { maps, query, result } = group3;
|
|
13969
13856
|
if (!maps)
|
|
13970
13857
|
return;
|
|
13971
13858
|
let data;
|
|
@@ -13977,25 +13864,33 @@ async function processResults(group3, cache) {
|
|
|
13977
13864
|
}
|
|
13978
13865
|
return;
|
|
13979
13866
|
}
|
|
13867
|
+
const describe = isDescribeQuery(query);
|
|
13980
13868
|
group3.forEach(({ entry }, index2) => {
|
|
13981
13869
|
const { request, result: result2 } = entry;
|
|
13982
|
-
const
|
|
13870
|
+
const map4 = maps[index2];
|
|
13871
|
+
const extract = describe && map4 ? filterResult(data, map4) : map4 ? projectResult(data, map4) : data;
|
|
13983
13872
|
if (request.cache) {
|
|
13984
|
-
cache.set(String(request.query),
|
|
13873
|
+
cache.set(String(request.query), extract);
|
|
13985
13874
|
}
|
|
13986
|
-
result2.fulfill(
|
|
13875
|
+
result2.fulfill(extract);
|
|
13987
13876
|
});
|
|
13988
13877
|
}
|
|
13989
13878
|
function projectResult(data, map4) {
|
|
13990
|
-
|
|
13991
|
-
|
|
13992
|
-
|
|
13993
|
-
|
|
13879
|
+
const cols = {};
|
|
13880
|
+
for (const [name2, as] of map4) {
|
|
13881
|
+
cols[as] = data.getChild(name2);
|
|
13882
|
+
}
|
|
13883
|
+
return new data.constructor(cols);
|
|
13884
|
+
}
|
|
13885
|
+
function filterResult(data, map4) {
|
|
13886
|
+
const lookup = new Map(map4);
|
|
13887
|
+
const result = [];
|
|
13888
|
+
for (const d of data) {
|
|
13889
|
+
if (lookup.has(d.column_name)) {
|
|
13890
|
+
result.push({ ...d, column_name: lookup.get(d.column_name) });
|
|
13994
13891
|
}
|
|
13995
|
-
return new data.constructor(cols);
|
|
13996
|
-
} else {
|
|
13997
|
-
return data;
|
|
13998
13892
|
}
|
|
13893
|
+
return result;
|
|
13999
13894
|
}
|
|
14000
13895
|
|
|
14001
13896
|
// ../core/src/util/cache.js
|
|
@@ -14242,6 +14137,197 @@ function QueryManager() {
|
|
|
14242
14137
|
};
|
|
14243
14138
|
}
|
|
14244
14139
|
|
|
14140
|
+
// ../core/src/util/js-type.js
|
|
14141
|
+
function jsType(type2) {
|
|
14142
|
+
switch (type2) {
|
|
14143
|
+
case "BIGINT":
|
|
14144
|
+
case "HUGEINT":
|
|
14145
|
+
case "INTEGER":
|
|
14146
|
+
case "SMALLINT":
|
|
14147
|
+
case "TINYINT":
|
|
14148
|
+
case "UBIGINT":
|
|
14149
|
+
case "UINTEGER":
|
|
14150
|
+
case "USMALLINT":
|
|
14151
|
+
case "UTINYINT":
|
|
14152
|
+
case "DOUBLE":
|
|
14153
|
+
case "FLOAT":
|
|
14154
|
+
case "REAL":
|
|
14155
|
+
return "number";
|
|
14156
|
+
case "DATE":
|
|
14157
|
+
case "TIMESTAMP":
|
|
14158
|
+
case "TIMESTAMPTZ":
|
|
14159
|
+
case "TIMESTAMP WITH TIME ZONE":
|
|
14160
|
+
case "TIME":
|
|
14161
|
+
case "TIMESTAMP_NS":
|
|
14162
|
+
return "date";
|
|
14163
|
+
case "BOOLEAN":
|
|
14164
|
+
return "boolean";
|
|
14165
|
+
case "VARCHAR":
|
|
14166
|
+
case "UUID":
|
|
14167
|
+
return "string";
|
|
14168
|
+
case "ARRAY":
|
|
14169
|
+
case "LIST":
|
|
14170
|
+
return "array";
|
|
14171
|
+
case "BLOB":
|
|
14172
|
+
case "STRUCT":
|
|
14173
|
+
case "MAP":
|
|
14174
|
+
case "GEOMETRY":
|
|
14175
|
+
return "object";
|
|
14176
|
+
default:
|
|
14177
|
+
if (type2.startsWith("DECIMAL")) {
|
|
14178
|
+
return "number";
|
|
14179
|
+
} else if (type2.startsWith("STRUCT") || type2.startsWith("MAP")) {
|
|
14180
|
+
return "object";
|
|
14181
|
+
} else if (type2.endsWith("]")) {
|
|
14182
|
+
return "array";
|
|
14183
|
+
}
|
|
14184
|
+
throw new Error(`Unsupported type: ${type2}`);
|
|
14185
|
+
}
|
|
14186
|
+
}
|
|
14187
|
+
|
|
14188
|
+
// ../core/src/util/convert-arrow.js
|
|
14189
|
+
var INTEGER = 2;
|
|
14190
|
+
var FLOAT = 3;
|
|
14191
|
+
var DECIMAL = 7;
|
|
14192
|
+
var TIMESTAMP = 10;
|
|
14193
|
+
function isArrowTable(values2) {
|
|
14194
|
+
return typeof values2?.getChild === "function";
|
|
14195
|
+
}
|
|
14196
|
+
function convertArrowArrayType(type2) {
|
|
14197
|
+
switch (type2.typeId) {
|
|
14198
|
+
case INTEGER:
|
|
14199
|
+
case FLOAT:
|
|
14200
|
+
case DECIMAL:
|
|
14201
|
+
return Float64Array;
|
|
14202
|
+
default:
|
|
14203
|
+
return Array;
|
|
14204
|
+
}
|
|
14205
|
+
}
|
|
14206
|
+
function convertArrowValue(type2) {
|
|
14207
|
+
const { typeId } = type2;
|
|
14208
|
+
if (typeId === TIMESTAMP) {
|
|
14209
|
+
return (v2) => v2 == null ? v2 : new Date(v2);
|
|
14210
|
+
}
|
|
14211
|
+
if (typeId === INTEGER && type2.bitWidth >= 64) {
|
|
14212
|
+
return (v2) => v2 == null ? v2 : Number(v2);
|
|
14213
|
+
}
|
|
14214
|
+
if (typeId === DECIMAL) {
|
|
14215
|
+
const scale3 = 1 / Math.pow(10, type2.scale);
|
|
14216
|
+
return (v2) => v2 == null ? v2 : decimalToNumber(v2, scale3);
|
|
14217
|
+
}
|
|
14218
|
+
return (v2) => v2;
|
|
14219
|
+
}
|
|
14220
|
+
function convertArrowColumn(column3) {
|
|
14221
|
+
const { type: type2 } = column3;
|
|
14222
|
+
const { typeId } = type2;
|
|
14223
|
+
if (typeId === TIMESTAMP) {
|
|
14224
|
+
const size = column3.length;
|
|
14225
|
+
const array3 = new Array(size);
|
|
14226
|
+
for (let row = 0; row < size; ++row) {
|
|
14227
|
+
const v2 = column3.get(row);
|
|
14228
|
+
array3[row] = v2 == null ? null : new Date(v2);
|
|
14229
|
+
}
|
|
14230
|
+
return array3;
|
|
14231
|
+
}
|
|
14232
|
+
if (typeId === INTEGER && type2.bitWidth >= 64) {
|
|
14233
|
+
const size = column3.length;
|
|
14234
|
+
const array3 = new Float64Array(size);
|
|
14235
|
+
for (let row = 0; row < size; ++row) {
|
|
14236
|
+
const v2 = column3.get(row);
|
|
14237
|
+
array3[row] = v2 == null ? NaN : Number(v2);
|
|
14238
|
+
}
|
|
14239
|
+
return array3;
|
|
14240
|
+
}
|
|
14241
|
+
if (typeId === DECIMAL) {
|
|
14242
|
+
const scale3 = 1 / Math.pow(10, type2.scale);
|
|
14243
|
+
const size = column3.length;
|
|
14244
|
+
const array3 = new Float64Array(size);
|
|
14245
|
+
for (let row = 0; row < size; ++row) {
|
|
14246
|
+
const v2 = column3.get(row);
|
|
14247
|
+
array3[row] = v2 == null ? NaN : decimalToNumber(v2, scale3);
|
|
14248
|
+
}
|
|
14249
|
+
return array3;
|
|
14250
|
+
}
|
|
14251
|
+
return column3.toArray();
|
|
14252
|
+
}
|
|
14253
|
+
var BASE32 = Array.from(
|
|
14254
|
+
{ length: 8 },
|
|
14255
|
+
(_, i) => Math.pow(2, i * 32)
|
|
14256
|
+
);
|
|
14257
|
+
function decimalToNumber(v2, scale3) {
|
|
14258
|
+
const n = v2.length;
|
|
14259
|
+
let x3 = 0;
|
|
14260
|
+
if (v2.signed && (v2[n - 1] | 0) < 0) {
|
|
14261
|
+
for (let i = 0; i < n; ++i) {
|
|
14262
|
+
x3 += ~(v2[i] | 0) * BASE32[i];
|
|
14263
|
+
}
|
|
14264
|
+
x3 = -(x3 + 1);
|
|
14265
|
+
} else {
|
|
14266
|
+
for (let i = 0; i < n; ++i) {
|
|
14267
|
+
x3 += v2[i] * BASE32[i];
|
|
14268
|
+
}
|
|
14269
|
+
}
|
|
14270
|
+
return x3 * scale3;
|
|
14271
|
+
}
|
|
14272
|
+
|
|
14273
|
+
// ../core/src/util/field-info.js
|
|
14274
|
+
var Count = "count";
|
|
14275
|
+
var Nulls = "nulls";
|
|
14276
|
+
var Max = "max";
|
|
14277
|
+
var Min = "min";
|
|
14278
|
+
var Distinct = "distinct";
|
|
14279
|
+
var statMap = {
|
|
14280
|
+
[Count]: count,
|
|
14281
|
+
[Distinct]: (column3) => count(column3).distinct(),
|
|
14282
|
+
[Max]: max,
|
|
14283
|
+
[Min]: min,
|
|
14284
|
+
[Nulls]: (column3) => count().where(isNull(column3))
|
|
14285
|
+
};
|
|
14286
|
+
function summarize(table3, column3, stats) {
|
|
14287
|
+
return Query.from(table3).select(Array.from(stats, (s2) => [s2, statMap[s2](column3)]));
|
|
14288
|
+
}
|
|
14289
|
+
async function queryFieldInfo(mc, fields) {
|
|
14290
|
+
if (fields.length === 1 && `${fields[0].column}` === "*") {
|
|
14291
|
+
return getTableInfo(mc, fields[0].table);
|
|
14292
|
+
} else {
|
|
14293
|
+
return (await Promise.all(fields.map((f) => getFieldInfo(mc, f)))).filter((x3) => x3);
|
|
14294
|
+
}
|
|
14295
|
+
}
|
|
14296
|
+
async function getFieldInfo(mc, { table: table3, column: column3, stats }) {
|
|
14297
|
+
const q = Query.from({ source: table3 }).select({ column: column3 }).groupby(column3.aggregate ? sql`ALL` : []);
|
|
14298
|
+
const [desc2] = Array.from(await mc.query(Query.describe(q)));
|
|
14299
|
+
const info = {
|
|
14300
|
+
table: table3,
|
|
14301
|
+
column: `${column3}`,
|
|
14302
|
+
sqlType: desc2.column_type,
|
|
14303
|
+
type: jsType(desc2.column_type),
|
|
14304
|
+
nullable: desc2.null === "YES"
|
|
14305
|
+
};
|
|
14306
|
+
if (!(stats?.length || stats?.size))
|
|
14307
|
+
return info;
|
|
14308
|
+
const result = await mc.query(
|
|
14309
|
+
summarize(table3, column3, stats),
|
|
14310
|
+
{ persist: true }
|
|
14311
|
+
);
|
|
14312
|
+
for (let i = 0; i < result.numCols; ++i) {
|
|
14313
|
+
const { name: name2 } = result.schema.fields[i];
|
|
14314
|
+
const child = result.getChildAt(i);
|
|
14315
|
+
const convert = convertArrowValue(child.type);
|
|
14316
|
+
info[name2] = convert(child.get(0));
|
|
14317
|
+
}
|
|
14318
|
+
return info;
|
|
14319
|
+
}
|
|
14320
|
+
async function getTableInfo(mc, table3) {
|
|
14321
|
+
const result = await mc.query(`DESCRIBE ${asRelation(table3)}`);
|
|
14322
|
+
return Array.from(result).map((desc2) => ({
|
|
14323
|
+
table: table3,
|
|
14324
|
+
column: desc2.column_name,
|
|
14325
|
+
sqlType: desc2.column_type,
|
|
14326
|
+
type: jsType(desc2.column_type),
|
|
14327
|
+
nullable: desc2.null === "YES"
|
|
14328
|
+
}));
|
|
14329
|
+
}
|
|
14330
|
+
|
|
14245
14331
|
// ../core/src/util/void-logger.js
|
|
14246
14332
|
function voidLogger() {
|
|
14247
14333
|
return {
|
|
@@ -14274,7 +14360,6 @@ var Coordinator = class {
|
|
|
14274
14360
|
logger = console,
|
|
14275
14361
|
manager = QueryManager()
|
|
14276
14362
|
} = options;
|
|
14277
|
-
this.catalog = new Catalog(this);
|
|
14278
14363
|
this.manager = manager;
|
|
14279
14364
|
this.logger(logger);
|
|
14280
14365
|
this.configure(options);
|
|
@@ -14293,7 +14378,7 @@ var Coordinator = class {
|
|
|
14293
14378
|
this.manager.consolidate(consolidate2);
|
|
14294
14379
|
this.indexes = indexes2;
|
|
14295
14380
|
}
|
|
14296
|
-
clear({ clients = true, cache = true
|
|
14381
|
+
clear({ clients = true, cache = true } = {}) {
|
|
14297
14382
|
this.manager.clear();
|
|
14298
14383
|
if (clients) {
|
|
14299
14384
|
this.clients?.forEach((client) => this.disconnect(client));
|
|
@@ -14303,8 +14388,6 @@ var Coordinator = class {
|
|
|
14303
14388
|
}
|
|
14304
14389
|
if (cache)
|
|
14305
14390
|
this.manager.cache().clear();
|
|
14306
|
-
if (catalog)
|
|
14307
|
-
this.catalog.clear();
|
|
14308
14391
|
}
|
|
14309
14392
|
databaseConnector(db) {
|
|
14310
14393
|
return this.manager.connector(db);
|
|
@@ -14357,7 +14440,7 @@ var Coordinator = class {
|
|
|
14357
14440
|
* @param {import('./MosaicClient.js').MosaicClient} client the client to disconnect
|
|
14358
14441
|
*/
|
|
14359
14442
|
async connect(client) {
|
|
14360
|
-
const {
|
|
14443
|
+
const { clients, filterGroups, indexes: indexes2 } = this;
|
|
14361
14444
|
if (clients.has(client)) {
|
|
14362
14445
|
throw new Error("Client already connected.");
|
|
14363
14446
|
}
|
|
@@ -14365,7 +14448,7 @@ var Coordinator = class {
|
|
|
14365
14448
|
client.coordinator = this;
|
|
14366
14449
|
const fields = client.fields();
|
|
14367
14450
|
if (fields?.length) {
|
|
14368
|
-
client.fieldInfo(await
|
|
14451
|
+
client.fieldInfo(await queryFieldInfo(this, fields));
|
|
14369
14452
|
}
|
|
14370
14453
|
const filter3 = client.filterBy;
|
|
14371
14454
|
if (filter3) {
|
|
@@ -22040,46 +22123,46 @@ function streamGeometry(geometry, stream) {
|
|
|
22040
22123
|
}
|
|
22041
22124
|
}
|
|
22042
22125
|
var streamObjectType = {
|
|
22043
|
-
Feature: function(
|
|
22044
|
-
streamGeometry(
|
|
22126
|
+
Feature: function(object, stream) {
|
|
22127
|
+
streamGeometry(object.geometry, stream);
|
|
22045
22128
|
},
|
|
22046
|
-
FeatureCollection: function(
|
|
22047
|
-
var features =
|
|
22129
|
+
FeatureCollection: function(object, stream) {
|
|
22130
|
+
var features = object.features, i = -1, n = features.length;
|
|
22048
22131
|
while (++i < n)
|
|
22049
22132
|
streamGeometry(features[i].geometry, stream);
|
|
22050
22133
|
}
|
|
22051
22134
|
};
|
|
22052
22135
|
var streamGeometryType = {
|
|
22053
|
-
Sphere: function(
|
|
22136
|
+
Sphere: function(object, stream) {
|
|
22054
22137
|
stream.sphere();
|
|
22055
22138
|
},
|
|
22056
|
-
Point: function(
|
|
22057
|
-
|
|
22058
|
-
stream.point(
|
|
22139
|
+
Point: function(object, stream) {
|
|
22140
|
+
object = object.coordinates;
|
|
22141
|
+
stream.point(object[0], object[1], object[2]);
|
|
22059
22142
|
},
|
|
22060
|
-
MultiPoint: function(
|
|
22061
|
-
var coordinates =
|
|
22143
|
+
MultiPoint: function(object, stream) {
|
|
22144
|
+
var coordinates = object.coordinates, i = -1, n = coordinates.length;
|
|
22062
22145
|
while (++i < n)
|
|
22063
|
-
|
|
22146
|
+
object = coordinates[i], stream.point(object[0], object[1], object[2]);
|
|
22064
22147
|
},
|
|
22065
|
-
LineString: function(
|
|
22066
|
-
streamLine(
|
|
22148
|
+
LineString: function(object, stream) {
|
|
22149
|
+
streamLine(object.coordinates, stream, 0);
|
|
22067
22150
|
},
|
|
22068
|
-
MultiLineString: function(
|
|
22069
|
-
var coordinates =
|
|
22151
|
+
MultiLineString: function(object, stream) {
|
|
22152
|
+
var coordinates = object.coordinates, i = -1, n = coordinates.length;
|
|
22070
22153
|
while (++i < n)
|
|
22071
22154
|
streamLine(coordinates[i], stream, 0);
|
|
22072
22155
|
},
|
|
22073
|
-
Polygon: function(
|
|
22074
|
-
streamPolygon(
|
|
22156
|
+
Polygon: function(object, stream) {
|
|
22157
|
+
streamPolygon(object.coordinates, stream);
|
|
22075
22158
|
},
|
|
22076
|
-
MultiPolygon: function(
|
|
22077
|
-
var coordinates =
|
|
22159
|
+
MultiPolygon: function(object, stream) {
|
|
22160
|
+
var coordinates = object.coordinates, i = -1, n = coordinates.length;
|
|
22078
22161
|
while (++i < n)
|
|
22079
22162
|
streamPolygon(coordinates[i], stream);
|
|
22080
22163
|
},
|
|
22081
|
-
GeometryCollection: function(
|
|
22082
|
-
var geometries =
|
|
22164
|
+
GeometryCollection: function(object, stream) {
|
|
22165
|
+
var geometries = object.geometries, i = -1, n = geometries.length;
|
|
22083
22166
|
while (++i < n)
|
|
22084
22167
|
streamGeometry(geometries[i], stream);
|
|
22085
22168
|
}
|
|
@@ -22098,11 +22181,11 @@ function streamPolygon(coordinates, stream) {
|
|
|
22098
22181
|
streamLine(coordinates[i], stream, 1);
|
|
22099
22182
|
stream.polygonEnd();
|
|
22100
22183
|
}
|
|
22101
|
-
function stream_default(
|
|
22102
|
-
if (
|
|
22103
|
-
streamObjectType[
|
|
22184
|
+
function stream_default(object, stream) {
|
|
22185
|
+
if (object && streamObjectType.hasOwnProperty(object.type)) {
|
|
22186
|
+
streamObjectType[object.type](object, stream);
|
|
22104
22187
|
} else {
|
|
22105
|
-
streamGeometry(
|
|
22188
|
+
streamGeometry(object, stream);
|
|
22106
22189
|
}
|
|
22107
22190
|
}
|
|
22108
22191
|
|
|
@@ -22226,12 +22309,12 @@ function centroidRingPoint(lambda, phi) {
|
|
|
22226
22309
|
Z1 += w * (z0 + (z0 = z));
|
|
22227
22310
|
centroidPointCartesian(x0, y0, z0);
|
|
22228
22311
|
}
|
|
22229
|
-
function centroid_default(
|
|
22312
|
+
function centroid_default(object) {
|
|
22230
22313
|
W0 = W1 = X0 = Y0 = Z0 = X1 = Y1 = Z1 = 0;
|
|
22231
22314
|
X2 = new Adder();
|
|
22232
22315
|
Y2 = new Adder();
|
|
22233
22316
|
Z2 = new Adder();
|
|
22234
|
-
stream_default(
|
|
22317
|
+
stream_default(object, centroidStream);
|
|
22235
22318
|
var x3 = +X2, y3 = +Y2, z = +Z2, m = hypot(x3, y3, z);
|
|
22236
22319
|
if (m < epsilon22) {
|
|
22237
22320
|
x3 = X1, y3 = Y1, z = Z1;
|
|
@@ -23415,28 +23498,28 @@ function appendRound2(digits) {
|
|
|
23415
23498
|
// ../../node_modules/d3-geo/src/path/index.js
|
|
23416
23499
|
function path_default(projection3, context) {
|
|
23417
23500
|
let digits = 3, pointRadius = 4.5, projectionStream, contextStream;
|
|
23418
|
-
function path2(
|
|
23419
|
-
if (
|
|
23501
|
+
function path2(object) {
|
|
23502
|
+
if (object) {
|
|
23420
23503
|
if (typeof pointRadius === "function")
|
|
23421
23504
|
contextStream.pointRadius(+pointRadius.apply(this, arguments));
|
|
23422
|
-
stream_default(
|
|
23505
|
+
stream_default(object, projectionStream(contextStream));
|
|
23423
23506
|
}
|
|
23424
23507
|
return contextStream.result();
|
|
23425
23508
|
}
|
|
23426
|
-
path2.area = function(
|
|
23427
|
-
stream_default(
|
|
23509
|
+
path2.area = function(object) {
|
|
23510
|
+
stream_default(object, projectionStream(area_default2));
|
|
23428
23511
|
return area_default2.result();
|
|
23429
23512
|
};
|
|
23430
|
-
path2.measure = function(
|
|
23431
|
-
stream_default(
|
|
23513
|
+
path2.measure = function(object) {
|
|
23514
|
+
stream_default(object, projectionStream(measure_default));
|
|
23432
23515
|
return measure_default.result();
|
|
23433
23516
|
};
|
|
23434
|
-
path2.bounds = function(
|
|
23435
|
-
stream_default(
|
|
23517
|
+
path2.bounds = function(object) {
|
|
23518
|
+
stream_default(object, projectionStream(bounds_default));
|
|
23436
23519
|
return bounds_default.result();
|
|
23437
23520
|
};
|
|
23438
|
-
path2.centroid = function(
|
|
23439
|
-
stream_default(
|
|
23521
|
+
path2.centroid = function(object) {
|
|
23522
|
+
stream_default(object, projectionStream(centroid_default2));
|
|
23440
23523
|
return centroid_default2.result();
|
|
23441
23524
|
};
|
|
23442
23525
|
path2.projection = function(_) {
|
|
@@ -23517,37 +23600,37 @@ TransformStream.prototype = {
|
|
|
23517
23600
|
};
|
|
23518
23601
|
|
|
23519
23602
|
// ../../node_modules/d3-geo/src/projection/fit.js
|
|
23520
|
-
function fit(projection3, fitBounds,
|
|
23603
|
+
function fit(projection3, fitBounds, object) {
|
|
23521
23604
|
var clip = projection3.clipExtent && projection3.clipExtent();
|
|
23522
23605
|
projection3.scale(150).translate([0, 0]);
|
|
23523
23606
|
if (clip != null)
|
|
23524
23607
|
projection3.clipExtent(null);
|
|
23525
|
-
stream_default(
|
|
23608
|
+
stream_default(object, projection3.stream(bounds_default));
|
|
23526
23609
|
fitBounds(bounds_default.result());
|
|
23527
23610
|
if (clip != null)
|
|
23528
23611
|
projection3.clipExtent(clip);
|
|
23529
23612
|
return projection3;
|
|
23530
23613
|
}
|
|
23531
|
-
function fitExtent(projection3, extent4,
|
|
23614
|
+
function fitExtent(projection3, extent4, object) {
|
|
23532
23615
|
return fit(projection3, function(b) {
|
|
23533
23616
|
var w = extent4[1][0] - extent4[0][0], h = extent4[1][1] - extent4[0][1], k2 = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), x3 = +extent4[0][0] + (w - k2 * (b[1][0] + b[0][0])) / 2, y3 = +extent4[0][1] + (h - k2 * (b[1][1] + b[0][1])) / 2;
|
|
23534
23617
|
projection3.scale(150 * k2).translate([x3, y3]);
|
|
23535
|
-
},
|
|
23618
|
+
}, object);
|
|
23536
23619
|
}
|
|
23537
|
-
function fitSize(projection3, size,
|
|
23538
|
-
return fitExtent(projection3, [[0, 0], size],
|
|
23620
|
+
function fitSize(projection3, size, object) {
|
|
23621
|
+
return fitExtent(projection3, [[0, 0], size], object);
|
|
23539
23622
|
}
|
|
23540
|
-
function fitWidth(projection3, width2,
|
|
23623
|
+
function fitWidth(projection3, width2, object) {
|
|
23541
23624
|
return fit(projection3, function(b) {
|
|
23542
23625
|
var w = +width2, k2 = w / (b[1][0] - b[0][0]), x3 = (w - k2 * (b[1][0] + b[0][0])) / 2, y3 = -k2 * b[0][1];
|
|
23543
23626
|
projection3.scale(150 * k2).translate([x3, y3]);
|
|
23544
|
-
},
|
|
23627
|
+
}, object);
|
|
23545
23628
|
}
|
|
23546
|
-
function fitHeight(projection3, height2,
|
|
23629
|
+
function fitHeight(projection3, height2, object) {
|
|
23547
23630
|
return fit(projection3, function(b) {
|
|
23548
23631
|
var h = +height2, k2 = h / (b[1][1] - b[0][1]), x3 = -k2 * b[0][0], y3 = (h - k2 * (b[1][1] + b[0][1])) / 2;
|
|
23549
23632
|
projection3.scale(150 * k2).translate([x3, y3]);
|
|
23550
|
-
},
|
|
23633
|
+
}, object);
|
|
23551
23634
|
}
|
|
23552
23635
|
|
|
23553
23636
|
// ../../node_modules/d3-geo/src/projection/resample.js
|
|
@@ -23719,17 +23802,17 @@ function projectionMutator(projectAt) {
|
|
|
23719
23802
|
projection3.precision = function(_) {
|
|
23720
23803
|
return arguments.length ? (projectResample = resample_default(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2);
|
|
23721
23804
|
};
|
|
23722
|
-
projection3.fitExtent = function(extent4,
|
|
23723
|
-
return fitExtent(projection3, extent4,
|
|
23805
|
+
projection3.fitExtent = function(extent4, object) {
|
|
23806
|
+
return fitExtent(projection3, extent4, object);
|
|
23724
23807
|
};
|
|
23725
|
-
projection3.fitSize = function(size,
|
|
23726
|
-
return fitSize(projection3, size,
|
|
23808
|
+
projection3.fitSize = function(size, object) {
|
|
23809
|
+
return fitSize(projection3, size, object);
|
|
23727
23810
|
};
|
|
23728
|
-
projection3.fitWidth = function(width2,
|
|
23729
|
-
return fitWidth(projection3, width2,
|
|
23811
|
+
projection3.fitWidth = function(width2, object) {
|
|
23812
|
+
return fitWidth(projection3, width2, object);
|
|
23730
23813
|
};
|
|
23731
|
-
projection3.fitHeight = function(height2,
|
|
23732
|
-
return fitHeight(projection3, height2,
|
|
23814
|
+
projection3.fitHeight = function(height2, object) {
|
|
23815
|
+
return fitHeight(projection3, height2, object);
|
|
23733
23816
|
};
|
|
23734
23817
|
function recenter() {
|
|
23735
23818
|
var center2 = scaleTranslateRotate(k2, 0, 0, sx, sy, alpha).apply(null, project2(lambda, phi)), transform3 = scaleTranslateRotate(k2, x3 - center2[0], y3 - center2[1], sx, sy, alpha);
|
|
@@ -23870,17 +23953,17 @@ function albersUsa_default() {
|
|
|
23870
23953
|
hawaiiPoint = hawaii.translate([x3 - 0.205 * k2, y3 + 0.212 * k2]).clipExtent([[x3 - 0.214 * k2 + epsilon6, y3 + 0.166 * k2 + epsilon6], [x3 - 0.115 * k2 - epsilon6, y3 + 0.234 * k2 - epsilon6]]).stream(pointStream);
|
|
23871
23954
|
return reset();
|
|
23872
23955
|
};
|
|
23873
|
-
albersUsa.fitExtent = function(extent4,
|
|
23874
|
-
return fitExtent(albersUsa, extent4,
|
|
23956
|
+
albersUsa.fitExtent = function(extent4, object) {
|
|
23957
|
+
return fitExtent(albersUsa, extent4, object);
|
|
23875
23958
|
};
|
|
23876
|
-
albersUsa.fitSize = function(size,
|
|
23877
|
-
return fitSize(albersUsa, size,
|
|
23959
|
+
albersUsa.fitSize = function(size, object) {
|
|
23960
|
+
return fitSize(albersUsa, size, object);
|
|
23878
23961
|
};
|
|
23879
|
-
albersUsa.fitWidth = function(width2,
|
|
23880
|
-
return fitWidth(albersUsa, width2,
|
|
23962
|
+
albersUsa.fitWidth = function(width2, object) {
|
|
23963
|
+
return fitWidth(albersUsa, width2, object);
|
|
23881
23964
|
};
|
|
23882
|
-
albersUsa.fitHeight = function(height2,
|
|
23883
|
-
return fitHeight(albersUsa, height2,
|
|
23965
|
+
albersUsa.fitHeight = function(height2, object) {
|
|
23966
|
+
return fitHeight(albersUsa, height2, object);
|
|
23884
23967
|
};
|
|
23885
23968
|
function reset() {
|
|
23886
23969
|
cache = cacheStream = null;
|
|
@@ -30473,21 +30556,30 @@ function createProjection({
|
|
|
30473
30556
|
if (k2 > 0) {
|
|
30474
30557
|
tx -= (k2 * (x06 + x12) - dx) / 2;
|
|
30475
30558
|
ty -= (k2 * (y06 + y12) - dy) / 2;
|
|
30476
|
-
transform3 =
|
|
30477
|
-
|
|
30478
|
-
|
|
30479
|
-
|
|
30480
|
-
|
|
30559
|
+
transform3 = Object.assign(
|
|
30560
|
+
transform_default({
|
|
30561
|
+
point(x3, y3) {
|
|
30562
|
+
this.stream.point(x3 * k2 + tx, y3 * k2 + ty);
|
|
30563
|
+
}
|
|
30564
|
+
}),
|
|
30565
|
+
{ invert: ([x3, y3]) => [(x3 - tx) / k2, (y3 - ty) / k2] }
|
|
30566
|
+
);
|
|
30481
30567
|
} else {
|
|
30482
30568
|
warn(`Warning: the projection could not be fit to the specified domain; using the default scale.`);
|
|
30483
30569
|
}
|
|
30484
30570
|
}
|
|
30485
|
-
transform3 ??= tx === 0 && ty === 0 ? identity8() :
|
|
30486
|
-
|
|
30487
|
-
|
|
30488
|
-
|
|
30489
|
-
|
|
30490
|
-
|
|
30571
|
+
transform3 ??= tx === 0 && ty === 0 ? identity8() : Object.assign(
|
|
30572
|
+
transform_default({
|
|
30573
|
+
point(x3, y3) {
|
|
30574
|
+
this.stream.point(x3 + tx, y3 + ty);
|
|
30575
|
+
}
|
|
30576
|
+
}),
|
|
30577
|
+
{ invert: ([x3, y3]) => [x3 - tx, y3 - ty] }
|
|
30578
|
+
);
|
|
30579
|
+
return {
|
|
30580
|
+
stream: (s2) => projection3.stream(transform3.stream(clip(s2))),
|
|
30581
|
+
invert: (p) => projection3.invert(transform3.invert(p))
|
|
30582
|
+
};
|
|
30491
30583
|
}
|
|
30492
30584
|
function namedProjection(projection3) {
|
|
30493
30585
|
switch (`${projection3}`.toLowerCase()) {
|
|
@@ -30573,13 +30665,19 @@ function conicProjection2(createProjection2, kx2, ky2) {
|
|
|
30573
30665
|
aspectRatio: aspectRatio2
|
|
30574
30666
|
};
|
|
30575
30667
|
}
|
|
30576
|
-
var identity8 = constant({
|
|
30668
|
+
var identity8 = constant({
|
|
30669
|
+
stream: (stream) => stream,
|
|
30670
|
+
invert: (p) => p
|
|
30671
|
+
});
|
|
30577
30672
|
var reflectY = constant(
|
|
30578
|
-
|
|
30579
|
-
|
|
30580
|
-
|
|
30581
|
-
|
|
30582
|
-
|
|
30673
|
+
Object.assign(
|
|
30674
|
+
transform_default({
|
|
30675
|
+
point(x3, y3) {
|
|
30676
|
+
this.stream.point(x3, -y3);
|
|
30677
|
+
}
|
|
30678
|
+
}),
|
|
30679
|
+
{ invert: ([x3, y3]) => [x3, -y3] }
|
|
30680
|
+
)
|
|
30583
30681
|
);
|
|
30584
30682
|
function project(cx, cy, values2, projection3) {
|
|
30585
30683
|
const x3 = values2[cx];
|
|
@@ -30658,8 +30756,8 @@ function getGeometryChannels(channel) {
|
|
|
30658
30756
|
sphere() {
|
|
30659
30757
|
}
|
|
30660
30758
|
};
|
|
30661
|
-
for (const
|
|
30662
|
-
stream_default(
|
|
30759
|
+
for (const object of channel.value)
|
|
30760
|
+
stream_default(object, sink);
|
|
30663
30761
|
return [x3, y3];
|
|
30664
30762
|
}
|
|
30665
30763
|
|
|
@@ -34742,6 +34840,7 @@ function plot(options = {}) {
|
|
|
34742
34840
|
}
|
|
34743
34841
|
figure.scale = exposeScales(scales2.scales);
|
|
34744
34842
|
figure.legend = exposeLegends(scaleDescriptors, context, options);
|
|
34843
|
+
figure.projection = context.projection;
|
|
34745
34844
|
const w = consumeWarnings();
|
|
34746
34845
|
if (w > 0) {
|
|
34747
34846
|
select_default2(svg).append("text").attr("x", width2).attr("y", 20).attr("dy", "-1em").attr("text-anchor", "end").attr("font-family", "initial").text("\u26A0\uFE0F").append("title").text(`${w.toLocaleString("en-US")} warning${w === 1 ? "" : "s"}. Please check the console.`);
|
|
@@ -40127,13 +40226,13 @@ var attributeMap = /* @__PURE__ */ new Map([
|
|
|
40127
40226
|
["projectionInsetBottom", "projection.insetBottom"],
|
|
40128
40227
|
["projectionClip", "projection.clip"]
|
|
40129
40228
|
]);
|
|
40130
|
-
function setProperty(
|
|
40229
|
+
function setProperty(object, path2, value) {
|
|
40131
40230
|
for (let i = 0; i < path2.length; ++i) {
|
|
40132
40231
|
const key = path2[i];
|
|
40133
40232
|
if (i === path2.length - 1) {
|
|
40134
|
-
|
|
40233
|
+
object[key] = value;
|
|
40135
40234
|
} else {
|
|
40136
|
-
|
|
40235
|
+
object = object[key] || (object[key] = {});
|
|
40137
40236
|
}
|
|
40138
40237
|
}
|
|
40139
40238
|
}
|
|
@@ -40203,16 +40302,16 @@ function setSymbolAttributes(plot3, svg, attributes2, symbols3) {
|
|
|
40203
40302
|
}
|
|
40204
40303
|
function inferLabels(spec, plot3) {
|
|
40205
40304
|
const { marks: marks2 } = plot3;
|
|
40206
|
-
inferLabel("x", spec, marks2
|
|
40207
|
-
inferLabel("y", spec, marks2
|
|
40305
|
+
inferLabel("x", spec, marks2);
|
|
40306
|
+
inferLabel("y", spec, marks2);
|
|
40208
40307
|
inferLabel("fx", spec, marks2);
|
|
40209
40308
|
inferLabel("fy", spec, marks2);
|
|
40210
40309
|
}
|
|
40211
|
-
function inferLabel(key, spec, marks2
|
|
40310
|
+
function inferLabel(key, spec, marks2) {
|
|
40212
40311
|
const scale3 = spec[key] || {};
|
|
40213
40312
|
if (scale3.axis === null || scale3.label !== void 0)
|
|
40214
40313
|
return;
|
|
40215
|
-
const fields = marks2.map((mark2) => mark2.channelField(
|
|
40314
|
+
const fields = marks2.map((mark2) => mark2.channelField(key)?.field);
|
|
40216
40315
|
if (fields.every((x3) => x3 == null))
|
|
40217
40316
|
return;
|
|
40218
40317
|
let candCol;
|
|
@@ -40225,7 +40324,7 @@ function inferLabel(key, spec, marks2, channels = [key]) {
|
|
|
40225
40324
|
} else if (candCol === void 0 && candLabel === void 0) {
|
|
40226
40325
|
candCol = column3;
|
|
40227
40326
|
candLabel = label2;
|
|
40228
|
-
type2 = getType(marks2[i].data,
|
|
40327
|
+
type2 = getType(marks2[i].data, key) || "number";
|
|
40229
40328
|
} else if (candLabel !== label2) {
|
|
40230
40329
|
candLabel = void 0;
|
|
40231
40330
|
} else if (candCol !== column3) {
|
|
@@ -40267,13 +40366,11 @@ function annotateMarks(svg, indices) {
|
|
|
40267
40366
|
}
|
|
40268
40367
|
}
|
|
40269
40368
|
}
|
|
40270
|
-
function getType(data,
|
|
40369
|
+
function getType(data, channel) {
|
|
40271
40370
|
for (const row of data) {
|
|
40272
|
-
|
|
40273
|
-
|
|
40274
|
-
|
|
40275
|
-
return v2 instanceof Date ? "date" : typeof v2;
|
|
40276
|
-
}
|
|
40371
|
+
const v2 = row[channel] ?? row[channel + "1"] ?? row[channel + "2"];
|
|
40372
|
+
if (v2 != null) {
|
|
40373
|
+
return v2 instanceof Date ? "date" : typeof v2;
|
|
40277
40374
|
}
|
|
40278
40375
|
}
|
|
40279
40376
|
}
|
|
@@ -40476,49 +40573,6 @@ function isSymbol2(value) {
|
|
|
40476
40573
|
return symbols2.has(`${value}`.toLowerCase());
|
|
40477
40574
|
}
|
|
40478
40575
|
|
|
40479
|
-
// ../plot/src/marks/util/arrow.js
|
|
40480
|
-
var INTEGER = 2;
|
|
40481
|
-
var FLOAT = 3;
|
|
40482
|
-
var DECIMAL = 7;
|
|
40483
|
-
var TIMESTAMP = 10;
|
|
40484
|
-
function isArrowTable(values2) {
|
|
40485
|
-
return typeof values2?.getChild === "function";
|
|
40486
|
-
}
|
|
40487
|
-
function convertArrowType(type2) {
|
|
40488
|
-
switch (type2.typeId) {
|
|
40489
|
-
case INTEGER:
|
|
40490
|
-
case FLOAT:
|
|
40491
|
-
case DECIMAL:
|
|
40492
|
-
return Float64Array;
|
|
40493
|
-
default:
|
|
40494
|
-
return Array;
|
|
40495
|
-
}
|
|
40496
|
-
}
|
|
40497
|
-
function convertArrow(type2) {
|
|
40498
|
-
const { typeId } = type2;
|
|
40499
|
-
if (typeId === TIMESTAMP) {
|
|
40500
|
-
return (v2) => v2 == null ? v2 : new Date(v2);
|
|
40501
|
-
}
|
|
40502
|
-
if (typeId === INTEGER && type2.bitWidth >= 64) {
|
|
40503
|
-
return (v2) => v2 == null ? v2 : Number(v2);
|
|
40504
|
-
}
|
|
40505
|
-
return (v2) => v2;
|
|
40506
|
-
}
|
|
40507
|
-
function convertArrowColumn(column3) {
|
|
40508
|
-
const { type: type2 } = column3;
|
|
40509
|
-
const { typeId } = type2;
|
|
40510
|
-
if (typeId === INTEGER && type2.bitWidth >= 64) {
|
|
40511
|
-
const size = column3.length;
|
|
40512
|
-
const array3 = new Float64Array(size);
|
|
40513
|
-
for (let row = 0; row < size; ++row) {
|
|
40514
|
-
const v2 = column3.get(row);
|
|
40515
|
-
array3[row] = v2 == null ? NaN : Number(v2);
|
|
40516
|
-
}
|
|
40517
|
-
return array3;
|
|
40518
|
-
}
|
|
40519
|
-
return column3.toArray();
|
|
40520
|
-
}
|
|
40521
|
-
|
|
40522
40576
|
// ../plot/src/marks/util/to-data-array.js
|
|
40523
40577
|
function toDataArray(data) {
|
|
40524
40578
|
return isArrowTable(data) ? arrowToObjects(data) : data;
|
|
@@ -40534,7 +40588,7 @@ function arrowToObjects(data) {
|
|
|
40534
40588
|
for (let j = 0; j < numCols; ++j) {
|
|
40535
40589
|
const child = batch.getChildAt(j);
|
|
40536
40590
|
const { name: name2, type: type2 } = schema.fields[j];
|
|
40537
|
-
const valueOf =
|
|
40591
|
+
const valueOf = convertArrowValue(type2);
|
|
40538
40592
|
for (let o = k2, i = 0; i < numRows; ++i, ++o) {
|
|
40539
40593
|
objects[o][name2] = valueOf(child.get(i));
|
|
40540
40594
|
}
|
|
@@ -40619,17 +40673,15 @@ var Mark2 = class extends MosaicClient {
|
|
|
40619
40673
|
hasOwnData() {
|
|
40620
40674
|
return this.source == null || isDataArray(this.source);
|
|
40621
40675
|
}
|
|
40676
|
+
hasFieldInfo() {
|
|
40677
|
+
return !!this._fieldInfo;
|
|
40678
|
+
}
|
|
40622
40679
|
channel(channel) {
|
|
40623
40680
|
return this.channels.find((c4) => c4.channel === channel);
|
|
40624
40681
|
}
|
|
40625
|
-
channelField(
|
|
40626
|
-
const
|
|
40627
|
-
|
|
40628
|
-
const c4 = this.channel(channel);
|
|
40629
|
-
if (c4?.field)
|
|
40630
|
-
return c4;
|
|
40631
|
-
}
|
|
40632
|
-
return null;
|
|
40682
|
+
channelField(channel, { exact } = {}) {
|
|
40683
|
+
const c4 = exact ? this.channel(channel) : this.channels.find((c5) => c5.channel.startsWith(channel));
|
|
40684
|
+
return c4?.field ? c4 : null;
|
|
40633
40685
|
}
|
|
40634
40686
|
fields() {
|
|
40635
40687
|
if (this.hasOwnData())
|
|
@@ -40637,26 +40689,25 @@ var Mark2 = class extends MosaicClient {
|
|
|
40637
40689
|
const { source: { table: table3 }, channels, reqs } = this;
|
|
40638
40690
|
const fields = /* @__PURE__ */ new Map();
|
|
40639
40691
|
for (const { channel, field: field2 } of channels) {
|
|
40640
|
-
|
|
40641
|
-
if (!column3) {
|
|
40692
|
+
if (!field2)
|
|
40642
40693
|
continue;
|
|
40643
|
-
|
|
40644
|
-
|
|
40645
|
-
|
|
40646
|
-
|
|
40647
|
-
|
|
40648
|
-
field2.stats?.forEach((s2) => entry.add(s2));
|
|
40649
|
-
}
|
|
40694
|
+
const stats = field2.stats?.stats || [];
|
|
40695
|
+
const key = field2.stats?.column ?? field2;
|
|
40696
|
+
const entry = fields.get(key) ?? fields.set(key, /* @__PURE__ */ new Set()).get(key);
|
|
40697
|
+
stats.forEach((s2) => entry.add(s2));
|
|
40698
|
+
reqs[channel]?.forEach((s2) => entry.add(s2));
|
|
40650
40699
|
}
|
|
40651
|
-
return Array.from(fields, ([
|
|
40652
|
-
return { table: table3, column: column3, stats: Array.from(stats) };
|
|
40653
|
-
});
|
|
40700
|
+
return Array.from(fields, ([c4, s2]) => ({ table: table3, column: c4, stats: s2 }));
|
|
40654
40701
|
}
|
|
40655
40702
|
fieldInfo(info) {
|
|
40656
|
-
|
|
40657
|
-
|
|
40658
|
-
|
|
40659
|
-
|
|
40703
|
+
const lookup = Object.fromEntries(info.map((x3) => [x3.column, x3]));
|
|
40704
|
+
for (const entry of this.channels) {
|
|
40705
|
+
const { field: field2 } = entry;
|
|
40706
|
+
if (field2) {
|
|
40707
|
+
Object.assign(entry, lookup[field2.stats?.column ?? field2]);
|
|
40708
|
+
}
|
|
40709
|
+
}
|
|
40710
|
+
this._fieldInfo = true;
|
|
40660
40711
|
return this;
|
|
40661
40712
|
}
|
|
40662
40713
|
query(filter3 = []) {
|
|
@@ -40724,8 +40775,7 @@ function channelScale(mark2, channel) {
|
|
|
40724
40775
|
const { plot: plot3 } = mark2;
|
|
40725
40776
|
let scaleType = plot3.getAttribute(`${channel}Scale`);
|
|
40726
40777
|
if (!scaleType) {
|
|
40727
|
-
const {
|
|
40728
|
-
const { type: type2 } = mark2.stats[field2.column];
|
|
40778
|
+
const { type: type2 } = mark2.channelField(channel);
|
|
40729
40779
|
scaleType = type2 === "date" ? "time" : "linear";
|
|
40730
40780
|
}
|
|
40731
40781
|
const options = { type: scaleType };
|
|
@@ -40763,15 +40813,13 @@ var xext = { x: ["min", "max"] };
|
|
|
40763
40813
|
var yext = { y: ["min", "max"] };
|
|
40764
40814
|
var xyext = { ...xext, ...yext };
|
|
40765
40815
|
function plotExtent(mark2, filter3, channel, domainAttr, niceAttr) {
|
|
40766
|
-
const { plot: plot3
|
|
40816
|
+
const { plot: plot3 } = mark2;
|
|
40767
40817
|
const domain = plot3.getAttribute(domainAttr);
|
|
40768
40818
|
const nice3 = plot3.getAttribute(niceAttr);
|
|
40769
40819
|
if (Array.isArray(domain) && !domain[Transient]) {
|
|
40770
40820
|
return domain;
|
|
40771
40821
|
} else {
|
|
40772
|
-
const {
|
|
40773
|
-
const { column: column3 } = field2;
|
|
40774
|
-
const { min: min5, max: max4 } = stats[column3];
|
|
40822
|
+
const { column: column3, min: min5, max: max4 } = mark2.channelField(channel);
|
|
40775
40823
|
const dom = filteredExtent(filter3, column3) || (nice3 ? linear2().domain([min5, max4]).nice().domain() : [min5, max4]);
|
|
40776
40824
|
if (domain !== Fixed)
|
|
40777
40825
|
dom[Transient] = true;
|
|
@@ -40791,7 +40839,7 @@ function filteredExtent(filter3, column3) {
|
|
|
40791
40839
|
let lo;
|
|
40792
40840
|
let hi;
|
|
40793
40841
|
const visitor = (type2, clause) => {
|
|
40794
|
-
if (type2 === "BETWEEN" && clause.field
|
|
40842
|
+
if (type2 === "BETWEEN" && `${clause.field}` === column3) {
|
|
40795
40843
|
const { range: range3 } = clause;
|
|
40796
40844
|
if (range3 && (lo == null || range3[0] < lo))
|
|
40797
40845
|
lo = range3[0];
|
|
@@ -40811,26 +40859,23 @@ function filteredExtent(filter3, column3) {
|
|
|
40811
40859
|
var ConnectedMark = class extends Mark2 {
|
|
40812
40860
|
constructor(type2, source, encodings) {
|
|
40813
40861
|
const dim = type2.endsWith("X") ? "y" : type2.endsWith("Y") ? "x" : null;
|
|
40814
|
-
const req = { [dim]: ["min", "max"] };
|
|
40862
|
+
const req = dim ? { [dim]: ["min", "max"] } : void 0;
|
|
40815
40863
|
super(type2, source, encodings, req);
|
|
40816
40864
|
this.dim = dim;
|
|
40817
40865
|
}
|
|
40818
40866
|
query(filter3 = []) {
|
|
40819
|
-
const { plot: plot3, dim, source
|
|
40867
|
+
const { plot: plot3, dim, source } = this;
|
|
40820
40868
|
const { optimize = true } = source.options || {};
|
|
40821
40869
|
const q = super.query(filter3);
|
|
40822
40870
|
if (!dim)
|
|
40823
40871
|
return q;
|
|
40824
40872
|
const ortho = dim === "x" ? "y" : "x";
|
|
40825
|
-
const value = this.channelField(ortho)?.as;
|
|
40826
|
-
const { field: field2, as } = this.channelField(dim);
|
|
40827
|
-
const { type: type2 } = stats[field2.column];
|
|
40873
|
+
const value = this.channelField(ortho, { exact: true })?.as;
|
|
40874
|
+
const { field: field2, as, type: type2, min: min5, max: max4 } = this.channelField(dim);
|
|
40828
40875
|
const isContinuous = type2 === "date" || type2 === "number";
|
|
40829
40876
|
if (optimize && isContinuous && value) {
|
|
40830
|
-
const { column: column3 } = field2;
|
|
40831
|
-
const { max: max4, min: min5 } = stats[column3];
|
|
40832
40877
|
const size = dim === "x" ? plot3.innerWidth() : plot3.innerHeight();
|
|
40833
|
-
const [lo, hi] = filteredExtent(filter3,
|
|
40878
|
+
const [lo, hi] = filteredExtent(filter3, field2) || [min5, max4];
|
|
40834
40879
|
const [expr] = binExpr(this, dim, size, [lo, hi], 1, as);
|
|
40835
40880
|
const cols = q.select().map((c4) => c4.as).filter((c4) => c4 !== as && c4 !== value);
|
|
40836
40881
|
return m4(q, expr, as, value, cols);
|
|
@@ -40852,17 +40897,10 @@ function m4(input3, bin3, x3, y3, cols = []) {
|
|
|
40852
40897
|
|
|
40853
40898
|
// ../plot/src/marks/util/grid.js
|
|
40854
40899
|
function arrayType(values2, name2 = "density") {
|
|
40855
|
-
|
|
40856
|
-
return convertArrowType(values2.getChild(name2).type);
|
|
40857
|
-
} else {
|
|
40858
|
-
return typeof values2[0][name2] === "number" ? Float64Array : Array;
|
|
40859
|
-
}
|
|
40860
|
-
}
|
|
40861
|
-
function grid1d(n, values2) {
|
|
40862
|
-
const Type3 = arrayType(values2);
|
|
40863
|
-
return valuesToGrid(new Type3(n), values2);
|
|
40900
|
+
return isArrowTable(values2) ? convertArrowArrayType(values2.getChild(name2).type) : typeof values2[0]?.[name2] === "number" ? Float64Array : Array;
|
|
40864
40901
|
}
|
|
40865
|
-
function
|
|
40902
|
+
function grid1d(n, values2, name2 = "density") {
|
|
40903
|
+
const grid2 = new (arrayType(values2))(n);
|
|
40866
40904
|
if (isArrowTable(values2)) {
|
|
40867
40905
|
const numRows = values2.numRows;
|
|
40868
40906
|
if (numRows === 0)
|
|
@@ -41361,7 +41399,7 @@ var Grid2DMark = class extends Mark2 {
|
|
|
41361
41399
|
}
|
|
41362
41400
|
setPlot(plot3, index2) {
|
|
41363
41401
|
const update2 = () => {
|
|
41364
|
-
if (this.
|
|
41402
|
+
if (this.hasFieldInfo())
|
|
41365
41403
|
this.requestUpdate();
|
|
41366
41404
|
};
|
|
41367
41405
|
plot3.addAttributeListener("domainX", update2);
|
|
@@ -41706,7 +41744,7 @@ var RasterMark = class extends Grid2DMark {
|
|
|
41706
41744
|
}
|
|
41707
41745
|
setPlot(plot3, index2) {
|
|
41708
41746
|
const update2 = () => {
|
|
41709
|
-
if (this.
|
|
41747
|
+
if (this.hasFieldInfo())
|
|
41710
41748
|
this.rasterize();
|
|
41711
41749
|
};
|
|
41712
41750
|
plot3.addAttributeListener("schemeColor", update2);
|
|
@@ -41907,9 +41945,12 @@ var DenseLineMark = class extends RasterMark {
|
|
|
41907
41945
|
function stripXY(mark2, filter3) {
|
|
41908
41946
|
if (Array.isArray(filter3) && !filter3.length)
|
|
41909
41947
|
return filter3;
|
|
41910
|
-
const xc = mark2.channelField("x")
|
|
41911
|
-
const yc = mark2.channelField("y")
|
|
41912
|
-
const test = (p) =>
|
|
41948
|
+
const { column: xc } = mark2.channelField("x");
|
|
41949
|
+
const { column: yc } = mark2.channelField("y");
|
|
41950
|
+
const test = (p) => {
|
|
41951
|
+
const col = `${p.field}`;
|
|
41952
|
+
return p.op !== "BETWEEN" || col !== xc && col !== yc;
|
|
41953
|
+
};
|
|
41913
41954
|
const filterAnd = (p) => p.op === "AND" ? and(p.children.filter((c4) => test(c4))) : p;
|
|
41914
41955
|
return Array.isArray(filter3) ? filter3.filter((p) => test(p)).map((p) => filterAnd(p)) : filterAnd(filter3);
|
|
41915
41956
|
}
|
|
@@ -42198,7 +42239,7 @@ var RasterTileMark = class extends Grid2DMark {
|
|
|
42198
42239
|
}
|
|
42199
42240
|
setPlot(plot3, index2) {
|
|
42200
42241
|
const update2 = () => {
|
|
42201
|
-
if (this.
|
|
42242
|
+
if (this.hasFieldInfo())
|
|
42202
42243
|
this.rasterize();
|
|
42203
42244
|
};
|
|
42204
42245
|
plot3.addAttributeListener("schemeColor", update2);
|
|
@@ -42747,8 +42788,8 @@ function closeTo(a2, b) {
|
|
|
42747
42788
|
}
|
|
42748
42789
|
|
|
42749
42790
|
// ../plot/src/interactors/util/get-field.js
|
|
42750
|
-
function getField(mark2,
|
|
42751
|
-
const field2 = mark2.channelField(
|
|
42791
|
+
function getField(mark2, channel) {
|
|
42792
|
+
const field2 = mark2.channelField(channel)?.field;
|
|
42752
42793
|
return field2?.basis || field2;
|
|
42753
42794
|
}
|
|
42754
42795
|
|
|
@@ -42782,7 +42823,7 @@ var Interval1D = class {
|
|
|
42782
42823
|
this.pixelSize = pixelSize || 1;
|
|
42783
42824
|
this.selection = selection2;
|
|
42784
42825
|
this.peers = peers;
|
|
42785
|
-
this.field = field2 || getField(mark2,
|
|
42826
|
+
this.field = field2 || getField(mark2, channel);
|
|
42786
42827
|
this.style = style2 && sanitizeStyles(style2);
|
|
42787
42828
|
this.brush = channel === "y" ? brushY2() : brushX2();
|
|
42788
42829
|
this.brush.on("brush end", ({ selection: selection3 }) => this.publish(selection3));
|
|
@@ -42850,8 +42891,8 @@ var Interval2D = class {
|
|
|
42850
42891
|
this.pixelSize = pixelSize || 1;
|
|
42851
42892
|
this.selection = selection2;
|
|
42852
42893
|
this.peers = peers;
|
|
42853
|
-
this.xfield = xfield || getField(mark2,
|
|
42854
|
-
this.yfield = yfield || getField(mark2,
|
|
42894
|
+
this.xfield = xfield || getField(mark2, "x");
|
|
42895
|
+
this.yfield = yfield || getField(mark2, "y");
|
|
42855
42896
|
this.style = style2 && sanitizeStyles(style2);
|
|
42856
42897
|
this.brush = brush2();
|
|
42857
42898
|
this.brush.on("brush end", ({ selection: selection3 }) => this.publish(selection3));
|
|
@@ -42987,8 +43028,8 @@ var PanZoom = class {
|
|
|
42987
43028
|
this.mark = mark2;
|
|
42988
43029
|
this.xsel = x3;
|
|
42989
43030
|
this.ysel = y3;
|
|
42990
|
-
this.xfield = xfield || getField(mark2,
|
|
42991
|
-
this.yfield = yfield || getField(mark2,
|
|
43031
|
+
this.xfield = xfield || getField(mark2, "x");
|
|
43032
|
+
this.yfield = yfield || getField(mark2, "y");
|
|
42992
43033
|
this.zoom = extent3(zoom2, [0, Infinity], [1, 1]);
|
|
42993
43034
|
this.panx = this.xsel && panx;
|
|
42994
43035
|
this.pany = this.ysel && pany;
|
|
@@ -43217,8 +43258,10 @@ function findMark({ marks: marks2 }, channel) {
|
|
|
43217
43258
|
if (channels == null)
|
|
43218
43259
|
return null;
|
|
43219
43260
|
for (let i = marks2.length - 1; i > -1; --i) {
|
|
43220
|
-
|
|
43221
|
-
|
|
43261
|
+
for (const channel2 of channels) {
|
|
43262
|
+
if (marks2[i].channelField(channel2, { exact: true })) {
|
|
43263
|
+
return marks2[i];
|
|
43264
|
+
}
|
|
43222
43265
|
}
|
|
43223
43266
|
}
|
|
43224
43267
|
return null;
|
|
@@ -43247,7 +43290,7 @@ function binField(mark2, channel, column3, options) {
|
|
|
43247
43290
|
column: column3,
|
|
43248
43291
|
label: column3,
|
|
43249
43292
|
get stats() {
|
|
43250
|
-
return ["min", "max"];
|
|
43293
|
+
return { column: column3, stats: ["min", "max"] };
|
|
43251
43294
|
},
|
|
43252
43295
|
get columns() {
|
|
43253
43296
|
return [column3];
|
|
@@ -43257,7 +43300,7 @@ function binField(mark2, channel, column3, options) {
|
|
|
43257
43300
|
},
|
|
43258
43301
|
toString() {
|
|
43259
43302
|
const { apply: apply2, sqlApply, sqlInvert } = channelScale(mark2, channel);
|
|
43260
|
-
const { min: min5, max: max4 } = mark2.
|
|
43303
|
+
const { min: min5, max: max4 } = mark2.channelField(channel);
|
|
43261
43304
|
const b = bins(apply2(min5), apply2(max4), options);
|
|
43262
43305
|
const col = sqlApply(column3);
|
|
43263
43306
|
const base = b.min === 0 ? col : `(${col} - ${b.min})`;
|
|
@@ -44126,8 +44169,8 @@ function attributes(values2) {
|
|
|
44126
44169
|
}
|
|
44127
44170
|
};
|
|
44128
44171
|
}
|
|
44129
|
-
function margins(
|
|
44130
|
-
const { top: top2, bottom: bottom2, left: left2, right: right2 } =
|
|
44172
|
+
function margins(object) {
|
|
44173
|
+
const { top: top2, bottom: bottom2, left: left2, right: right2 } = object;
|
|
44131
44174
|
const attr = {};
|
|
44132
44175
|
if (top2 !== void 0)
|
|
44133
44176
|
attr.marginTop = top2;
|