@loaders.gl/parquet 5.0.0-alpha.7 → 5.0.0-alpha.9
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/delta-source-loader-types.js +1 -1
- package/dist/delta-source.js +1 -1
- package/dist/geoparquet-loader.js +1 -1
- package/dist/iceberg-rest-catalog.js +1 -1
- package/dist/iceberg-rest-catalog.js.map +1 -1
- package/dist/index.cjs +282 -83
- package/dist/index.cjs.map +3 -3
- package/dist/lib/constants.js +1 -1
- package/dist/lib/parsers/parse-parquet-to-arrow-js.js +6 -2
- package/dist/lib/parsers/parse-parquet-to-arrow-js.js.map +1 -1
- package/dist/parquet-dataset-source.cjs +284 -79
- package/dist/parquet-dataset-source.cjs.map +3 -3
- package/dist/parquet-js-loader-types.js +1 -1
- package/dist/parquet-js-writer.js +1 -1
- package/dist/parquet-loader-base.js +1 -1
- package/dist/parquet-source-loader-types.js +1 -1
- package/dist/parquet-source-loader.cjs +284 -79
- package/dist/parquet-source-loader.cjs.map +3 -3
- package/dist/parquet-source-loader.js +14 -1
- package/dist/parquet-source-loader.js.map +1 -1
- package/dist/parquet-source-worker.js +21 -95
- package/dist/parquet-source-worker.js.map +4 -4
- package/dist/parquet-worker-node.cjs +24589 -17870
- package/dist/parquet-worker-node.cjs.map +4 -4
- package/dist/parquet-worker.js +5 -1
- package/dist/parquet-worker.js.map +2 -2
- package/dist/parquetjs/codecs/rle.d.ts.map +1 -1
- package/dist/parquetjs/codecs/rle.js +19 -6
- package/dist/parquetjs/codecs/rle.js.map +1 -1
- package/package.json +13 -18
- package/src/iceberg-rest-catalog.ts +1 -1
- package/src/lib/parsers/parse-parquet-to-arrow-js.ts +6 -2
- package/src/parquet-source-loader.ts +18 -1
- package/src/parquetjs/codecs/rle.ts +20 -6
package/dist/index.cjs
CHANGED
|
@@ -73,7 +73,7 @@ var init_parquet_loader_base = __esm({
|
|
|
73
73
|
"use strict";
|
|
74
74
|
init_parquet_format();
|
|
75
75
|
init_parquet_loader_options();
|
|
76
|
-
VERSION = true ? "5.0.0-alpha.
|
|
76
|
+
VERSION = true ? "5.0.0-alpha.9" : "latest";
|
|
77
77
|
PARQUET_LOADER_BASE = {
|
|
78
78
|
...ParquetFormat,
|
|
79
79
|
dataType: null,
|
|
@@ -1120,13 +1120,17 @@ var init_src = __esm({
|
|
|
1120
1120
|
|
|
1121
1121
|
// ../loader-utils/src/lib/worker-loader-utils/parse-with-worker.ts
|
|
1122
1122
|
function canParseWithWorker(loader, options) {
|
|
1123
|
-
var _a;
|
|
1123
|
+
var _a, _b, _c;
|
|
1124
|
+
if ((_b = (_a = options == null ? void 0 : options.core) == null ? void 0 : _a.credentials) == null ? void 0 : _b.some(
|
|
1125
|
+
(credential) => credential.type === "request" || "token" in credential && typeof credential.token === "function"
|
|
1126
|
+
))
|
|
1127
|
+
return false;
|
|
1124
1128
|
const workerOptions = getWorkerOptions(options);
|
|
1125
1129
|
const nodeWorkers = workerOptions._nodeWorkers;
|
|
1126
1130
|
if (!isBrowser2 && !nodeWorkers) {
|
|
1127
1131
|
return false;
|
|
1128
1132
|
}
|
|
1129
|
-
if (loader.id === "las" && (((
|
|
1133
|
+
if (loader.id === "las" && (((_c = options == null ? void 0 : options.las) == null ? void 0 : _c.shape) ?? "arrow-table") === "arrow-table") {
|
|
1130
1134
|
return false;
|
|
1131
1135
|
}
|
|
1132
1136
|
if (loader.id === "csv" && !shouldParseCSVWithWorker(options)) {
|
|
@@ -1173,7 +1177,12 @@ function callParseOnMainThread(parseOnMainThread, input, options, context) {
|
|
|
1173
1177
|
return parseOnMainThread(input, void 0, options, context);
|
|
1174
1178
|
}
|
|
1175
1179
|
function getWorkerOptions(options = {}, loader) {
|
|
1176
|
-
const serializedOptions = JSON.parse(
|
|
1180
|
+
const serializedOptions = JSON.parse(
|
|
1181
|
+
JSON.stringify({
|
|
1182
|
+
...options,
|
|
1183
|
+
...options.core ? { core: { ...options.core, authentications: void 0 } } : {}
|
|
1184
|
+
})
|
|
1185
|
+
);
|
|
1177
1186
|
const workerOptions = {
|
|
1178
1187
|
...serializedOptions.core,
|
|
1179
1188
|
...serializedOptions
|
|
@@ -1262,6 +1271,48 @@ var init_async_iteration = __esm({
|
|
|
1262
1271
|
}
|
|
1263
1272
|
});
|
|
1264
1273
|
|
|
1274
|
+
// ../loader-utils/src/lib/request-utils/authentication.ts
|
|
1275
|
+
function resolveCredentials(credentials, authentications = []) {
|
|
1276
|
+
if (credentials.every(isAuthentication)) return credentials;
|
|
1277
|
+
return credentials.map((credential, index) => {
|
|
1278
|
+
if (isAuthentication(credential)) return credential;
|
|
1279
|
+
const AuthenticationClass = authentications.find(
|
|
1280
|
+
(authentication2) => authentication2.type === (credential == null ? void 0 : credential.type)
|
|
1281
|
+
);
|
|
1282
|
+
if (!AuthenticationClass) {
|
|
1283
|
+
throw new Error(`No authentication class registered for credential at index ${index}.`);
|
|
1284
|
+
}
|
|
1285
|
+
let authentication;
|
|
1286
|
+
try {
|
|
1287
|
+
authentication = new AuthenticationClass(credential);
|
|
1288
|
+
} catch {
|
|
1289
|
+
throw new Error(`Invalid authentication configuration at index ${index}.`);
|
|
1290
|
+
}
|
|
1291
|
+
if (!isAuthentication(authentication)) {
|
|
1292
|
+
throw new Error(`Authentication class returned an invalid credential at index ${index}.`);
|
|
1293
|
+
}
|
|
1294
|
+
return authentication;
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
function resolveAuthenticationOptions(options) {
|
|
1298
|
+
var _a, _b;
|
|
1299
|
+
if (!((_b = (_a = options.core) == null ? void 0 : _a.credentials) == null ? void 0 : _b.length)) return options;
|
|
1300
|
+
const credentials = resolveCredentials(options.core.credentials, options.core.authentications);
|
|
1301
|
+
if (credentials === options.core.credentials) return options;
|
|
1302
|
+
return { ...options, core: { ...options.core, credentials } };
|
|
1303
|
+
}
|
|
1304
|
+
function isAuthentication(credential) {
|
|
1305
|
+
if (!credential || typeof credential !== "object") return false;
|
|
1306
|
+
if (typeof credential.id !== "string" || !Array.isArray(credential.origins)) return false;
|
|
1307
|
+
if (credential.type === "request") return typeof credential.authenticate === "function";
|
|
1308
|
+
return (credential.type === "header" || credential.type === "query-parameter") && typeof credential.name === "string" && (typeof credential.token === "string" || typeof credential.token === "function") && Array.isArray(credential.refreshStatusCodes);
|
|
1309
|
+
}
|
|
1310
|
+
var init_authentication = __esm({
|
|
1311
|
+
"../loader-utils/src/lib/request-utils/authentication.ts"() {
|
|
1312
|
+
"use strict";
|
|
1313
|
+
}
|
|
1314
|
+
});
|
|
1315
|
+
|
|
1265
1316
|
// ../loader-utils/src/lib/request-utils/request-cache.ts
|
|
1266
1317
|
function createAbortError3() {
|
|
1267
1318
|
const error = new Error("Request aborted");
|
|
@@ -1496,21 +1547,54 @@ var init_request_cache = __esm({
|
|
|
1496
1547
|
|
|
1497
1548
|
// ../loader-utils/src/lib/request-utils/request-credentials.ts
|
|
1498
1549
|
function createAuthenticatedFetch(options) {
|
|
1499
|
-
const
|
|
1500
|
-
|
|
1501
|
-
const
|
|
1502
|
-
|
|
1550
|
+
const suppliedFetch = options.fetch || ((url, requestOptions) => fetch(url, requestOptions));
|
|
1551
|
+
const existingMetadata = suppliedFetch[AUTHENTICATED_FETCH];
|
|
1552
|
+
const credentialResolutions = new Map(existingMetadata == null ? void 0 : existingMetadata.credentialResolutions);
|
|
1553
|
+
const resolvedCredentials = resolveCredentials(
|
|
1554
|
+
options.credentials.map((credential) => credentialResolutions.get(credential) || credential),
|
|
1555
|
+
options.authentications
|
|
1556
|
+
);
|
|
1557
|
+
options.credentials.forEach((credential, index) => {
|
|
1558
|
+
credentialResolutions.set(credential, resolvedCredentials[index]);
|
|
1559
|
+
});
|
|
1560
|
+
if (!options.fetchOptions && (!resolvedCredentials.length || (existingMetadata == null ? void 0 : existingMetadata.credentials.length) === resolvedCredentials.length && resolvedCredentials.every(
|
|
1561
|
+
(credential, index) => credential === existingMetadata.credentials[index]
|
|
1562
|
+
)))
|
|
1563
|
+
return suppliedFetch;
|
|
1564
|
+
const baseFetch = (existingMetadata == null ? void 0 : existingMetadata.fetch) || suppliedFetch;
|
|
1565
|
+
const credentials = existingMetadata ? [.../* @__PURE__ */ new Set([...resolvedCredentials, ...existingMetadata.credentials])] : resolvedCredentials;
|
|
1566
|
+
const fetchOptions = mergeFetchOptions(
|
|
1567
|
+
(existingMetadata == null ? void 0 : existingMetadata.fetchOptions) || {},
|
|
1568
|
+
options.fetchOptions
|
|
1569
|
+
);
|
|
1570
|
+
const tokenCredentials = credentials.filter(
|
|
1571
|
+
(credential) => credential.type !== "request"
|
|
1572
|
+
);
|
|
1573
|
+
const requestCredentials = credentials.filter(
|
|
1574
|
+
(credential) => credential.type === "request"
|
|
1575
|
+
);
|
|
1576
|
+
for (const credential of requestCredentials) normalizeRequestOrigins(credential.origins);
|
|
1503
1577
|
const authenticatedFetch = async (url, requestOptions = {}) => {
|
|
1504
|
-
var _a, _b, _c;
|
|
1578
|
+
var _a, _b, _c, _d;
|
|
1579
|
+
requestOptions = mergeFetchOptions(fetchOptions, requestOptions);
|
|
1580
|
+
if ((_a = requestOptions.signal) == null ? void 0 : _a.aborted) throw createAbortError4();
|
|
1581
|
+
if (!credentials.length) return baseFetch(url, requestOptions);
|
|
1505
1582
|
const resolvedURL = parseHTTPURL(url);
|
|
1506
|
-
|
|
1507
|
-
const
|
|
1508
|
-
const response = await baseFetch(
|
|
1583
|
+
const authorization = resolvedURL ? await authorizeRequest(resolvedURL, requestOptions, tokenCredentials) : { url, options: requestOptions, credentials: [] };
|
|
1584
|
+
const signedRequest = await authenticateRequest(authorization, requestCredentials, "request");
|
|
1585
|
+
const response = await baseFetch(signedRequest.url, signedRequest.options);
|
|
1509
1586
|
const refreshableCredentials = authorization.credentials.filter(
|
|
1510
1587
|
({ credential }) => typeof credential.token === "function" && credential.refreshStatusCodes.includes(response.status)
|
|
1511
1588
|
);
|
|
1512
|
-
|
|
1513
|
-
|
|
1589
|
+
const shouldRetrySignature = signedRequest.credentials.some(
|
|
1590
|
+
(credential) => {
|
|
1591
|
+
var _a2;
|
|
1592
|
+
return (_a2 = credential.refreshStatusCodes) == null ? void 0 : _a2.includes(response.status);
|
|
1593
|
+
}
|
|
1594
|
+
);
|
|
1595
|
+
if (!refreshableCredentials.length && !shouldRetrySignature || !isReplayableRequest(requestOptions) || !isReplayableRequest(signedRequest.options))
|
|
1596
|
+
return response;
|
|
1597
|
+
if ((_b = requestOptions.signal) == null ? void 0 : _b.aborted) throw createAbortError4();
|
|
1514
1598
|
const refreshedTokens = /* @__PURE__ */ new Map();
|
|
1515
1599
|
await Promise.all(
|
|
1516
1600
|
refreshableCredentials.map(async ({ credential }) => {
|
|
@@ -1518,24 +1602,111 @@ function createAuthenticatedFetch(options) {
|
|
|
1518
1602
|
if (token) refreshedTokens.set(credential, token);
|
|
1519
1603
|
})
|
|
1520
1604
|
);
|
|
1521
|
-
if (!refreshedTokens.size) return response;
|
|
1522
|
-
await ((
|
|
1605
|
+
if (!refreshedTokens.size && !shouldRetrySignature) return response;
|
|
1606
|
+
await ((_c = response.body) == null ? void 0 : _c.cancel().catch(() => {
|
|
1523
1607
|
}));
|
|
1524
|
-
if ((
|
|
1525
|
-
const replayAuthorization = await authorizeRequest(
|
|
1608
|
+
if ((_d = requestOptions.signal) == null ? void 0 : _d.aborted) throw createAbortError4();
|
|
1609
|
+
const replayAuthorization = resolvedURL ? await authorizeRequest(
|
|
1526
1610
|
resolvedURL,
|
|
1527
1611
|
requestOptions,
|
|
1528
|
-
|
|
1612
|
+
tokenCredentials,
|
|
1529
1613
|
refreshedTokens,
|
|
1530
1614
|
authorization.credentials
|
|
1615
|
+
) : { url, options: requestOptions };
|
|
1616
|
+
const replayRequest = await authenticateRequest(
|
|
1617
|
+
replayAuthorization,
|
|
1618
|
+
requestCredentials,
|
|
1619
|
+
"retry",
|
|
1620
|
+
response
|
|
1531
1621
|
);
|
|
1532
|
-
return baseFetch(
|
|
1622
|
+
return baseFetch(replayRequest.url, replayRequest.options);
|
|
1533
1623
|
};
|
|
1534
1624
|
Object.defineProperty(authenticatedFetch, AUTHENTICATED_FETCH, {
|
|
1535
|
-
value:
|
|
1625
|
+
value: {
|
|
1626
|
+
fetch: baseFetch,
|
|
1627
|
+
credentials,
|
|
1628
|
+
credentialResolutions,
|
|
1629
|
+
fetchOptions
|
|
1630
|
+
}
|
|
1536
1631
|
});
|
|
1537
1632
|
return authenticatedFetch;
|
|
1538
1633
|
}
|
|
1634
|
+
function getAuthenticatedFetch(options = {}) {
|
|
1635
|
+
var _a, _b, _c;
|
|
1636
|
+
const fetchOption = options.fetch ?? ((_a = options.core) == null ? void 0 : _a.fetch);
|
|
1637
|
+
let fetchFunction;
|
|
1638
|
+
if (typeof fetchOption === "function") {
|
|
1639
|
+
fetchFunction = fetchOption;
|
|
1640
|
+
} else {
|
|
1641
|
+
fetchFunction = (url, requestOptions) => fetch(url, requestOptions);
|
|
1642
|
+
}
|
|
1643
|
+
return createAuthenticatedFetch({
|
|
1644
|
+
fetch: fetchFunction,
|
|
1645
|
+
fetchOptions: typeof fetchOption === "object" && fetchOption ? fetchOption : void 0,
|
|
1646
|
+
credentials: ((_b = options.core) == null ? void 0 : _b.credentials) || [],
|
|
1647
|
+
authentications: (_c = options.core) == null ? void 0 : _c.authentications
|
|
1648
|
+
});
|
|
1649
|
+
}
|
|
1650
|
+
function mergeFetchOptions(defaultOptions, requestOptions) {
|
|
1651
|
+
const mergedOptions = { ...defaultOptions, ...requestOptions };
|
|
1652
|
+
if (defaultOptions.headers || (requestOptions == null ? void 0 : requestOptions.headers)) {
|
|
1653
|
+
const headers = new Headers(defaultOptions.headers);
|
|
1654
|
+
new Headers(requestOptions == null ? void 0 : requestOptions.headers).forEach((value, key) => headers.set(key, value));
|
|
1655
|
+
mergedOptions.headers = headers;
|
|
1656
|
+
}
|
|
1657
|
+
return mergedOptions;
|
|
1658
|
+
}
|
|
1659
|
+
async function authenticateRequest(request, credentials, reason, response) {
|
|
1660
|
+
const appliedCredentials = [];
|
|
1661
|
+
const signal = request.options.signal;
|
|
1662
|
+
for (const credential of credentials) {
|
|
1663
|
+
const origin = getRequestOrigin(request.url);
|
|
1664
|
+
if (!origin || !normalizeRequestOrigins(credential.origins).includes(origin)) continue;
|
|
1665
|
+
if (signal == null ? void 0 : signal.aborted) throw createAbortError4();
|
|
1666
|
+
const authenticatedRequest = await credential.authenticate({
|
|
1667
|
+
url: request.url,
|
|
1668
|
+
options: { ...request.options, headers: new Headers(request.options.headers) },
|
|
1669
|
+
reason,
|
|
1670
|
+
response: response ? { status: response.status, headers: new Headers(response.headers) } : void 0
|
|
1671
|
+
});
|
|
1672
|
+
if (!authenticatedRequest || typeof authenticatedRequest.url !== "string" || !authenticatedRequest.options || typeof authenticatedRequest.options !== "object") {
|
|
1673
|
+
throw new Error("Authentication callback returned an invalid request.");
|
|
1674
|
+
}
|
|
1675
|
+
request = {
|
|
1676
|
+
url: authenticatedRequest.url,
|
|
1677
|
+
options: { ...authenticatedRequest.options, ...signal ? { signal } : {} }
|
|
1678
|
+
};
|
|
1679
|
+
appliedCredentials.push(credential);
|
|
1680
|
+
}
|
|
1681
|
+
if (signal == null ? void 0 : signal.aborted) throw createAbortError4();
|
|
1682
|
+
return { ...request, credentials: appliedCredentials };
|
|
1683
|
+
}
|
|
1684
|
+
function getRequestOrigin(url) {
|
|
1685
|
+
try {
|
|
1686
|
+
const parsedURL = new URL(url);
|
|
1687
|
+
if (!parsedURL.host || parsedURL.username || parsedURL.password) return null;
|
|
1688
|
+
return parsedURL.origin !== "null" ? parsedURL.origin : `${parsedURL.protocol}//${parsedURL.host}`;
|
|
1689
|
+
} catch {
|
|
1690
|
+
return null;
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
function normalizeRequestOrigins(origins) {
|
|
1694
|
+
if (!origins.length)
|
|
1695
|
+
throw new Error("Request authentication requires at least one exact origin.");
|
|
1696
|
+
return origins.map((origin) => {
|
|
1697
|
+
const resolvedOrigin = getRequestOrigin(origin);
|
|
1698
|
+
let url;
|
|
1699
|
+
try {
|
|
1700
|
+
url = new URL(origin);
|
|
1701
|
+
} catch {
|
|
1702
|
+
throw new Error("Invalid request authentication origin.");
|
|
1703
|
+
}
|
|
1704
|
+
if (!resolvedOrigin || url.pathname && url.pathname !== "/" || url.search || url.hash) {
|
|
1705
|
+
throw new Error("Invalid request authentication origin.");
|
|
1706
|
+
}
|
|
1707
|
+
return resolvedOrigin;
|
|
1708
|
+
});
|
|
1709
|
+
}
|
|
1539
1710
|
async function authorizeRequest(sourceURL, requestOptions, credentials, tokenOverrides = /* @__PURE__ */ new Map(), previousCredentials = []) {
|
|
1540
1711
|
const url = new URL(sourceURL);
|
|
1541
1712
|
const headers = new Headers(requestOptions.headers);
|
|
@@ -1604,6 +1775,7 @@ var AUTHENTICATED_FETCH, refreshPromises;
|
|
|
1604
1775
|
var init_request_credentials = __esm({
|
|
1605
1776
|
"../loader-utils/src/lib/request-utils/request-credentials.ts"() {
|
|
1606
1777
|
"use strict";
|
|
1778
|
+
init_authentication();
|
|
1607
1779
|
AUTHENTICATED_FETCH = /* @__PURE__ */ Symbol("loaders.gl.authenticated-fetch");
|
|
1608
1780
|
refreshPromises = /* @__PURE__ */ new WeakMap();
|
|
1609
1781
|
}
|
|
@@ -1849,6 +2021,7 @@ var init_range_request_scheduler = __esm({
|
|
|
1849
2021
|
/** Optional event callback for range batching diagnostics. */
|
|
1850
2022
|
onEvent;
|
|
1851
2023
|
pendingRequests = [];
|
|
2024
|
+
/** Pending batch window, independent of in-flight transport requests. */
|
|
1852
2025
|
flushTimer = null;
|
|
1853
2026
|
/** Creates a scheduler for one group of byte-range-addressable resources. */
|
|
1854
2027
|
constructor(props = {}) {
|
|
@@ -1925,7 +2098,7 @@ var init_range_request_scheduler = __esm({
|
|
|
1925
2098
|
}
|
|
1926
2099
|
/** Immediately starts loading the currently queued requests. */
|
|
1927
2100
|
flush() {
|
|
1928
|
-
if (this.flushTimer) {
|
|
2101
|
+
if (this.flushTimer !== null) {
|
|
1929
2102
|
clearTimeout(this.flushTimer);
|
|
1930
2103
|
this.flushTimer = null;
|
|
1931
2104
|
}
|
|
@@ -1947,9 +2120,9 @@ var init_range_request_scheduler = __esm({
|
|
|
1947
2120
|
this.fetchMergedRequest(mergedRequest);
|
|
1948
2121
|
}
|
|
1949
2122
|
}
|
|
1950
|
-
/**
|
|
2123
|
+
/** Starts a fixed batch window only when no flush is already scheduled. */
|
|
1951
2124
|
scheduleFlush() {
|
|
1952
|
-
if (this.flushTimer) {
|
|
2125
|
+
if (this.flushTimer !== null) {
|
|
1953
2126
|
return;
|
|
1954
2127
|
}
|
|
1955
2128
|
this.flushTimer = setTimeout(() => this.flush(), this.props.batchDelayMs);
|
|
@@ -2509,39 +2682,25 @@ var init_blob_file = __esm({
|
|
|
2509
2682
|
|
|
2510
2683
|
// ../loader-utils/src/lib/sources/data-source.ts
|
|
2511
2684
|
function getFetchFunction(options) {
|
|
2512
|
-
|
|
2513
|
-
const fetchOption = (options == null ? void 0 : options.fetch) ?? ((_a = options == null ? void 0 : options.core) == null ? void 0 : _a.fetch);
|
|
2514
|
-
let fetchFunction;
|
|
2515
|
-
if (typeof fetchOption === "function") {
|
|
2516
|
-
fetchFunction = (url, fetchOptions) => fetchOption(url, fetchOptions);
|
|
2517
|
-
} else if (fetchOption) {
|
|
2518
|
-
fetchFunction = (url, requestOptions) => fetch(url, mergeFetchOptions(fetchOption, requestOptions));
|
|
2519
|
-
} else {
|
|
2520
|
-
fetchFunction = (url, requestOptions) => fetch(url, requestOptions);
|
|
2521
|
-
}
|
|
2522
|
-
return createAuthenticatedFetch({
|
|
2523
|
-
fetch: fetchFunction,
|
|
2524
|
-
credentials: ((_b = options == null ? void 0 : options.core) == null ? void 0 : _b.credentials) || []
|
|
2525
|
-
});
|
|
2526
|
-
}
|
|
2527
|
-
function mergeFetchOptions(fetchOptions, requestOptions) {
|
|
2528
|
-
const mergedOptions = { ...fetchOptions, ...requestOptions };
|
|
2529
|
-
if (fetchOptions.headers || (requestOptions == null ? void 0 : requestOptions.headers)) {
|
|
2530
|
-
mergedOptions.headers = mergeHeaders(fetchOptions.headers, requestOptions == null ? void 0 : requestOptions.headers);
|
|
2531
|
-
}
|
|
2532
|
-
return mergedOptions;
|
|
2685
|
+
return getAuthenticatedFetch(options);
|
|
2533
2686
|
}
|
|
2534
|
-
function
|
|
2535
|
-
|
|
2536
|
-
if (
|
|
2537
|
-
new
|
|
2687
|
+
function getSourceLoaderOptions(options) {
|
|
2688
|
+
var _a;
|
|
2689
|
+
if (options.loadOptions !== void 0 || ((_a = options.core) == null ? void 0 : _a.loadOptions) !== void 0) {
|
|
2690
|
+
throw new Error(
|
|
2691
|
+
"Source loadOptions and core.loadOptions were removed. Use core and root loader namespaces directly."
|
|
2692
|
+
);
|
|
2538
2693
|
}
|
|
2539
|
-
return headers;
|
|
2540
|
-
}
|
|
2541
|
-
function normalizeDirectLoaderOptions(options) {
|
|
2542
2694
|
const loadOptions = { ...options };
|
|
2543
2695
|
if (options == null ? void 0 : options.core) {
|
|
2544
2696
|
loadOptions.core = { ...options.core };
|
|
2697
|
+
const parserCore = loadOptions.core;
|
|
2698
|
+
for (const key of ["type", "attributions", "loaders", "onError", "loadOptions"]) {
|
|
2699
|
+
delete parserCore[key];
|
|
2700
|
+
}
|
|
2701
|
+
if (Object.keys(parserCore).length === 0) {
|
|
2702
|
+
delete loadOptions.core;
|
|
2703
|
+
}
|
|
2545
2704
|
}
|
|
2546
2705
|
const topLevelBaseUri = typeof loadOptions.baseUri === "string" ? loadOptions.baseUri : void 0;
|
|
2547
2706
|
const topLevelBaseUrl = typeof loadOptions.baseUrl === "string" ? loadOptions.baseUrl : void 0;
|
|
@@ -2579,6 +2738,7 @@ var init_data_source = __esm({
|
|
|
2579
2738
|
init_file_aliases();
|
|
2580
2739
|
init_log();
|
|
2581
2740
|
init_request_credentials();
|
|
2741
|
+
init_authentication();
|
|
2582
2742
|
UNAVAILABLE_CORE_API = {
|
|
2583
2743
|
fetchFile: unavailableCoreApiMethod("fetchFile"),
|
|
2584
2744
|
parse: unavailableCoreApiMethod("parse"),
|
|
@@ -2593,7 +2753,6 @@ var init_data_source = __esm({
|
|
|
2593
2753
|
core: {
|
|
2594
2754
|
type: "auto",
|
|
2595
2755
|
attributions: [],
|
|
2596
|
-
loadOptions: {},
|
|
2597
2756
|
loaders: [],
|
|
2598
2757
|
onError: void 0
|
|
2599
2758
|
}
|
|
@@ -2602,9 +2761,9 @@ var init_data_source = __esm({
|
|
|
2602
2761
|
options;
|
|
2603
2762
|
data;
|
|
2604
2763
|
url;
|
|
2605
|
-
/**
|
|
2764
|
+
/** Shared parser options derived from the source options, excluding source-only core controls. */
|
|
2606
2765
|
loadOptions;
|
|
2607
|
-
/** A resolved fetch function extracted from
|
|
2766
|
+
/** A resolved fetch function extracted from the shared core options. */
|
|
2608
2767
|
fetch;
|
|
2609
2768
|
/** Shared source-level runtime hooks, when supplied by the source factory. */
|
|
2610
2769
|
coreApi;
|
|
@@ -2612,15 +2771,13 @@ var init_data_source = __esm({
|
|
|
2612
2771
|
hasCoreApi;
|
|
2613
2772
|
_needsRefresh = true;
|
|
2614
2773
|
constructor(data, options, defaultOptions, coreApi) {
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
this.options = { ...options };
|
|
2620
|
-
}
|
|
2774
|
+
this.options = mergeOptions(
|
|
2775
|
+
mergeOptions(_DataSource.defaultOptions, defaultOptions || {}),
|
|
2776
|
+
options
|
|
2777
|
+
);
|
|
2621
2778
|
this.data = data;
|
|
2622
2779
|
this.url = typeof data === "string" ? resolvePath(data) : "";
|
|
2623
|
-
const loadOptions =
|
|
2780
|
+
const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(this.options));
|
|
2624
2781
|
this.loadOptions = loadOptions;
|
|
2625
2782
|
const fetch2 = getFetchFunction(loadOptions);
|
|
2626
2783
|
this.coreApi = coreApi || UNAVAILABLE_CORE_API;
|
|
@@ -2628,7 +2785,11 @@ var init_data_source = __esm({
|
|
|
2628
2785
|
this.fetch = fetch2;
|
|
2629
2786
|
}
|
|
2630
2787
|
setProps(options) {
|
|
2631
|
-
|
|
2788
|
+
const mergedOptions = mergeOptions(this.options, options);
|
|
2789
|
+
const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(mergedOptions));
|
|
2790
|
+
this.options = mergedOptions;
|
|
2791
|
+
this.loadOptions = loadOptions;
|
|
2792
|
+
this.fetch = getFetchFunction(loadOptions);
|
|
2632
2793
|
this.setNeedsRefresh();
|
|
2633
2794
|
}
|
|
2634
2795
|
/** Mark this data source as needing a refresh (redraw) */
|
|
@@ -2965,6 +3126,10 @@ function getDataTypeFromTypedArray(array) {
|
|
|
2965
3126
|
return "int32";
|
|
2966
3127
|
case Uint32Array:
|
|
2967
3128
|
return "uint32";
|
|
3129
|
+
case BigInt64Array:
|
|
3130
|
+
return "int64";
|
|
3131
|
+
case BigUint64Array:
|
|
3132
|
+
return "uint64";
|
|
2968
3133
|
case Float32Array:
|
|
2969
3134
|
return "float32";
|
|
2970
3135
|
case Float64Array:
|
|
@@ -7307,7 +7472,7 @@ var init_geoparquet_loader = __esm({
|
|
|
7307
7472
|
"use strict";
|
|
7308
7473
|
init_parquet_format();
|
|
7309
7474
|
init_parquet_loader_options();
|
|
7310
|
-
VERSION5 = true ? "5.0.0-alpha.
|
|
7475
|
+
VERSION5 = true ? "5.0.0-alpha.9" : "latest";
|
|
7311
7476
|
GeoParquetLoader = {
|
|
7312
7477
|
...ParquetFormat,
|
|
7313
7478
|
dataType: null,
|
|
@@ -8003,6 +8168,7 @@ function fillParquetValueBuffer(output, value, start, end) {
|
|
|
8003
8168
|
return;
|
|
8004
8169
|
}
|
|
8005
8170
|
if (Array.isArray(output)) {
|
|
8171
|
+
if (output.length < end) output.length = end;
|
|
8006
8172
|
output.fill(value, start, end);
|
|
8007
8173
|
return;
|
|
8008
8174
|
}
|
|
@@ -8448,6 +8614,18 @@ function readUnsignedVarIntNumber(cursor) {
|
|
|
8448
8614
|
}
|
|
8449
8615
|
throw new Error("invalid RLE run header");
|
|
8450
8616
|
}
|
|
8617
|
+
function encodeUnsignedVarIntNumber(value) {
|
|
8618
|
+
if (!Number.isSafeInteger(value) || value < 0) {
|
|
8619
|
+
throw new Error("RLE run header must be a non-negative safe integer");
|
|
8620
|
+
}
|
|
8621
|
+
const bytes = [];
|
|
8622
|
+
while (value >= 128) {
|
|
8623
|
+
bytes.push(value % 128 | 128);
|
|
8624
|
+
value = Math.floor(value / 128);
|
|
8625
|
+
}
|
|
8626
|
+
bytes.push(value);
|
|
8627
|
+
return Uint8Array.from(bytes);
|
|
8628
|
+
}
|
|
8451
8629
|
function assertReadable(cursor, byteLength) {
|
|
8452
8630
|
const size = cursor.size ?? cursor.buffer.length;
|
|
8453
8631
|
if (byteLength < 0 || cursor.offset + byteLength > size) {
|
|
@@ -8469,10 +8647,7 @@ function encodeRunBitpacked(values, opts) {
|
|
|
8469
8647
|
buf[Math.floor(b / 8)] |= 1 << b % 8;
|
|
8470
8648
|
}
|
|
8471
8649
|
}
|
|
8472
|
-
return concatUint8Arrays([
|
|
8473
|
-
Uint8Array.from(import_varint.default.encode(paddedValues.length / 8 << 1 | 1)),
|
|
8474
|
-
buf
|
|
8475
|
-
]);
|
|
8650
|
+
return concatUint8Arrays([encodeUnsignedVarIntNumber(paddedValues.length / 8 << 1 | 1), buf]);
|
|
8476
8651
|
}
|
|
8477
8652
|
function encodeRunRepeated(value, count, opts) {
|
|
8478
8653
|
const bitWidth = opts.bitWidth;
|
|
@@ -8481,15 +8656,13 @@ function encodeRunRepeated(value, count, opts) {
|
|
|
8481
8656
|
buf[i] = value & 255;
|
|
8482
8657
|
value = Math.floor(value / 256);
|
|
8483
8658
|
}
|
|
8484
|
-
return concatUint8Arrays([
|
|
8659
|
+
return concatUint8Arrays([encodeUnsignedVarIntNumber(count << 1), buf]);
|
|
8485
8660
|
}
|
|
8486
|
-
var import_varint;
|
|
8487
8661
|
var init_rle = __esm({
|
|
8488
8662
|
"src/parquetjs/codecs/rle.ts"() {
|
|
8489
8663
|
"use strict";
|
|
8490
8664
|
init_declare();
|
|
8491
8665
|
init_binary_utils();
|
|
8492
|
-
import_varint = __toESM(require("varint"), 1);
|
|
8493
8666
|
}
|
|
8494
8667
|
});
|
|
8495
8668
|
|
|
@@ -24204,7 +24377,10 @@ function hasStandardNestedCollection(field) {
|
|
|
24204
24377
|
}
|
|
24205
24378
|
function normalizeNestedParquetValue(value, field) {
|
|
24206
24379
|
var _a, _b, _c, _d, _e;
|
|
24207
|
-
if (value === void 0 || value === null
|
|
24380
|
+
if (value === void 0 || value === null) {
|
|
24381
|
+
return null;
|
|
24382
|
+
}
|
|
24383
|
+
if (!field.fields) {
|
|
24208
24384
|
return value;
|
|
24209
24385
|
}
|
|
24210
24386
|
if (((_a = field.logicalType) == null ? void 0 : _a.type) === "LIST") {
|
|
@@ -27007,7 +27183,20 @@ async function filterParquetRowGroupsWithBloomFilters(initialization, rowGroupIn
|
|
|
27007
27183
|
let filtersRead = 0;
|
|
27008
27184
|
let bytesRead = 0;
|
|
27009
27185
|
for (const rowGroupIndex of rowGroupIndices) {
|
|
27010
|
-
|
|
27186
|
+
let rowGroup = initialization.metadata.rowGroups[rowGroupIndex];
|
|
27187
|
+
const rawRowGroup = initialization.fileMetadata.row_groups[rowGroupIndex];
|
|
27188
|
+
if (rawRowGroup.columns.some((columnChunk) => columnChunk.encrypted_column_metadata)) {
|
|
27189
|
+
await initialization.reader.resolveColumnMetadata(
|
|
27190
|
+
rawRowGroup,
|
|
27191
|
+
rowGroupIndex,
|
|
27192
|
+
getParquetPredicateColumns(predicate).map((column) => [column])
|
|
27193
|
+
);
|
|
27194
|
+
throwIfAborted4(signal);
|
|
27195
|
+
rowGroup = {
|
|
27196
|
+
...rowGroup,
|
|
27197
|
+
columns: rawRowGroup.columns.filter((columnChunk) => Boolean(columnChunk.meta_data)).map((columnChunk) => createColumnChunkMetadata(columnChunk, initialization.parquetSchema))
|
|
27198
|
+
};
|
|
27199
|
+
}
|
|
27011
27200
|
const probes = getParquetBloomFilterProbes(predicate, rowGroup);
|
|
27012
27201
|
let keepRowGroup = true;
|
|
27013
27202
|
for (const probe of probes) {
|
|
@@ -28141,7 +28330,7 @@ init_geoparquet_loader();
|
|
|
28141
28330
|
|
|
28142
28331
|
// dist/parquet-js-loader-types.js
|
|
28143
28332
|
init_parquet_format();
|
|
28144
|
-
var VERSION8 = true ? "5.0.0-alpha.
|
|
28333
|
+
var VERSION8 = true ? "5.0.0-alpha.9" : "latest";
|
|
28145
28334
|
var DEFAULT_PARQUET_JS_OPTIONS3 = {
|
|
28146
28335
|
columns: void 0,
|
|
28147
28336
|
preserveBinary: false,
|
|
@@ -28168,7 +28357,7 @@ var ParquetJSLoader2 = {
|
|
|
28168
28357
|
|
|
28169
28358
|
// dist/parquet-source-loader-types.js
|
|
28170
28359
|
init_parquet_format();
|
|
28171
|
-
var VERSION10 = true ? "5.0.0-alpha.
|
|
28360
|
+
var VERSION10 = true ? "5.0.0-alpha.9" : "latest";
|
|
28172
28361
|
async function preloadParquetSourceLoader2() {
|
|
28173
28362
|
const { ParquetSourceLoaderWithParser: ParquetSourceLoaderWithParser2 } = await Promise.resolve().then(() => (init_parquet_source_loader(), parquet_source_loader_exports));
|
|
28174
28363
|
return ParquetSourceLoaderWithParser2;
|
|
@@ -28292,7 +28481,7 @@ init_normalize_parquet_options2();
|
|
|
28292
28481
|
init_parquet_format();
|
|
28293
28482
|
|
|
28294
28483
|
// dist/lib/constants.js
|
|
28295
|
-
var VERSION11 = true ? "5.0.0-alpha.
|
|
28484
|
+
var VERSION11 = true ? "5.0.0-alpha.9" : "latest";
|
|
28296
28485
|
var PARQUET_MAGIC2 = "PAR1";
|
|
28297
28486
|
var PARQUET_MAGIC_ENCRYPTED2 = "PARE";
|
|
28298
28487
|
var PARQUET_RDLVL_TYPE2 = "INT32";
|
|
@@ -28759,7 +28948,6 @@ function toPrimitiveBytes2(value) {
|
|
|
28759
28948
|
}
|
|
28760
28949
|
|
|
28761
28950
|
// dist/parquetjs/codecs/rle.js
|
|
28762
|
-
var import_varint2 = __toESM(require("varint"), 1);
|
|
28763
28951
|
function encodeValues6(type, values, opts) {
|
|
28764
28952
|
if (!("bitWidth" in opts)) {
|
|
28765
28953
|
throw new Error("bitWidth is required");
|
|
@@ -28953,6 +29141,8 @@ function fillParquetValueBuffer2(output, value, start, end) {
|
|
|
28953
29141
|
return;
|
|
28954
29142
|
}
|
|
28955
29143
|
if (Array.isArray(output)) {
|
|
29144
|
+
if (output.length < end)
|
|
29145
|
+
output.length = end;
|
|
28956
29146
|
output.fill(value, start, end);
|
|
28957
29147
|
return;
|
|
28958
29148
|
}
|
|
@@ -29338,6 +29528,18 @@ function readUnsignedVarIntNumber3(cursor) {
|
|
|
29338
29528
|
}
|
|
29339
29529
|
throw new Error("invalid RLE run header");
|
|
29340
29530
|
}
|
|
29531
|
+
function encodeUnsignedVarIntNumber2(value) {
|
|
29532
|
+
if (!Number.isSafeInteger(value) || value < 0) {
|
|
29533
|
+
throw new Error("RLE run header must be a non-negative safe integer");
|
|
29534
|
+
}
|
|
29535
|
+
const bytes = [];
|
|
29536
|
+
while (value >= 128) {
|
|
29537
|
+
bytes.push(value % 128 | 128);
|
|
29538
|
+
value = Math.floor(value / 128);
|
|
29539
|
+
}
|
|
29540
|
+
bytes.push(value);
|
|
29541
|
+
return Uint8Array.from(bytes);
|
|
29542
|
+
}
|
|
29341
29543
|
function assertReadable3(cursor, byteLength) {
|
|
29342
29544
|
const size = cursor.size ?? cursor.buffer.length;
|
|
29343
29545
|
if (byteLength < 0 || cursor.offset + byteLength > size) {
|
|
@@ -29357,10 +29559,7 @@ function encodeRunBitpacked2(values, opts) {
|
|
|
29357
29559
|
buf[Math.floor(b / 8)] |= 1 << b % 8;
|
|
29358
29560
|
}
|
|
29359
29561
|
}
|
|
29360
|
-
return concatUint8Arrays2([
|
|
29361
|
-
Uint8Array.from(import_varint2.default.encode(paddedValues.length / 8 << 1 | 1)),
|
|
29362
|
-
buf
|
|
29363
|
-
]);
|
|
29562
|
+
return concatUint8Arrays2([encodeUnsignedVarIntNumber2(paddedValues.length / 8 << 1 | 1), buf]);
|
|
29364
29563
|
}
|
|
29365
29564
|
function encodeRunRepeated2(value, count, opts) {
|
|
29366
29565
|
const bitWidth = opts.bitWidth;
|
|
@@ -29369,7 +29568,7 @@ function encodeRunRepeated2(value, count, opts) {
|
|
|
29369
29568
|
buf[i] = value & 255;
|
|
29370
29569
|
value = Math.floor(value / 256);
|
|
29371
29570
|
}
|
|
29372
|
-
return concatUint8Arrays2([
|
|
29571
|
+
return concatUint8Arrays2([encodeUnsignedVarIntNumber2(count << 1), buf]);
|
|
29373
29572
|
}
|
|
29374
29573
|
|
|
29375
29574
|
// dist/parquetjs/codecs/dictionary.js
|
|
@@ -39155,7 +39354,7 @@ function formatDataType(dataType) {
|
|
|
39155
39354
|
|
|
39156
39355
|
// dist/parquet-js-writer.js
|
|
39157
39356
|
init_parquet_format();
|
|
39158
|
-
var VERSION12 = true ? "5.0.0-alpha.
|
|
39357
|
+
var VERSION12 = true ? "5.0.0-alpha.9" : "latest";
|
|
39159
39358
|
var DEFAULT_PARQUET_JS_OPTIONS4 = {};
|
|
39160
39359
|
var ParquetJSWriter = {
|
|
39161
39360
|
...ParquetFormat,
|