@loaders.gl/parquet 5.0.0-alpha.6 → 5.0.0-alpha.8

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.
Files changed (54) hide show
  1. package/dist/delta-source-loader-types.js +1 -1
  2. package/dist/delta-source.js +1 -1
  3. package/dist/geoparquet-loader-with-parser.d.ts +1 -1
  4. package/dist/geoparquet-loader.d.ts +2 -2
  5. package/dist/geoparquet-loader.js +1 -1
  6. package/dist/iceberg-rest-catalog.js +1 -1
  7. package/dist/iceberg-rest-catalog.js.map +1 -1
  8. package/dist/index.cjs +327 -106
  9. package/dist/index.cjs.map +3 -3
  10. package/dist/lib/constants.js +1 -1
  11. package/dist/lib/parquet-source-worker-client.d.ts.map +1 -1
  12. package/dist/lib/parquet-source-worker-client.js +3 -1
  13. package/dist/lib/parquet-source-worker-client.js.map +1 -1
  14. package/dist/parquet-dataset-source.cjs +324 -100
  15. package/dist/parquet-dataset-source.cjs.map +3 -3
  16. package/dist/parquet-js-loader-types.d.ts +2 -2
  17. package/dist/parquet-js-loader-types.js +3 -3
  18. package/dist/parquet-js-loader-types.js.map +1 -1
  19. package/dist/parquet-js-loader.d.ts +1 -1
  20. package/dist/parquet-js-loader.d.ts.map +1 -1
  21. package/dist/parquet-js-loader.js +3 -2
  22. package/dist/parquet-js-loader.js.map +1 -1
  23. package/dist/parquet-js-writer.js +1 -1
  24. package/dist/parquet-loader-base.d.ts +1 -1
  25. package/dist/parquet-loader-base.js +1 -1
  26. package/dist/parquet-loader-options.d.ts +1 -1
  27. package/dist/parquet-loader-options.js +1 -1
  28. package/dist/parquet-loader-options.js.map +1 -1
  29. package/dist/parquet-loader-types.d.ts +2 -2
  30. package/dist/parquet-loader.d.ts +1 -1
  31. package/dist/parquet-source-loader-types.js +1 -1
  32. package/dist/parquet-source-loader.cjs +324 -100
  33. package/dist/parquet-source-loader.cjs.map +3 -3
  34. package/dist/parquet-source-worker-factory.d.ts +4 -0
  35. package/dist/parquet-source-worker-factory.d.ts.map +1 -0
  36. package/dist/parquet-source-worker-factory.js +6 -0
  37. package/dist/parquet-source-worker-factory.js.map +1 -0
  38. package/dist/parquet-source-worker.js +61 -108
  39. package/dist/parquet-source-worker.js.map +4 -4
  40. package/dist/parquet-worker-node.cjs +24654 -17960
  41. package/dist/parquet-worker-node.cjs.map +4 -4
  42. package/dist/parquet-worker.js +55 -14
  43. package/dist/parquet-worker.js.map +4 -4
  44. package/dist/parquetjs/codecs/rle.d.ts.map +1 -1
  45. package/dist/parquetjs/codecs/rle.js +15 -6
  46. package/dist/parquetjs/codecs/rle.js.map +1 -1
  47. package/package.json +13 -18
  48. package/src/iceberg-rest-catalog.ts +1 -1
  49. package/src/lib/parquet-source-worker-client.ts +3 -1
  50. package/src/parquet-js-loader-types.ts +2 -2
  51. package/src/parquet-js-loader.ts +3 -2
  52. package/src/parquet-loader-options.ts +1 -1
  53. package/src/parquet-source-worker-factory.ts +8 -0
  54. package/src/parquetjs/codecs/rle.ts +17 -6
package/dist/index.cjs CHANGED
@@ -61,7 +61,7 @@ var init_parquet_loader_options = __esm({
61
61
  PARQUET_LOADER_DEFAULT_OPTIONS = {
62
62
  columns: void 0,
63
63
  preserveBinary: false,
64
- shape: "object-row-table"
64
+ shape: "arrow-table"
65
65
  };
66
66
  }
67
67
  });
@@ -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.6" : "latest";
76
+ VERSION = true ? "5.0.0-alpha.8" : "latest";
77
77
  PARQUET_LOADER_BASE = {
78
78
  ...ParquetFormat,
79
79
  dataType: null,
@@ -666,6 +666,7 @@ var init_worker_pool = __esm({
666
666
  props = {};
667
667
  jobQueue = [];
668
668
  idleQueue = [];
669
+ activeJobs = /* @__PURE__ */ new Set();
669
670
  count = 0;
670
671
  isDestroyed = false;
671
672
  /** Checks if workers are supported on this platform */
@@ -684,10 +685,14 @@ var init_worker_pool = __esm({
684
685
  this.setProps(props);
685
686
  }
686
687
  /**
687
- * Terminates all workers in the pool
688
+ * Terminates all workers in the pool and aborts active jobs.
689
+ * @param reason Optional error delivered to active jobs.
688
690
  * @note Can free up significant memory
689
691
  */
690
- destroy() {
692
+ destroy(reason = new Error("Worker pool was destroyed")) {
693
+ this.activeJobs.forEach((job) => job.abort(reason));
694
+ const queuedJobs = this.jobQueue.splice(0);
695
+ queuedJobs.forEach((queuedJob) => queuedJob.onReject(reason));
691
696
  this.idleQueue.forEach((worker) => worker.destroy());
692
697
  this.isDestroyed = true;
693
698
  }
@@ -710,8 +715,11 @@ var init_worker_pool = __esm({
710
715
  }
711
716
  }
712
717
  async startJob(name, onMessage2 = (job, type, data) => job.done(data), onError = (job, error) => job.error(error)) {
713
- const startPromise = new Promise((onStart) => {
714
- this.jobQueue.push({ name, onMessage: onMessage2, onError, onStart });
718
+ if (this.isDestroyed) {
719
+ return Promise.reject(new Error("Worker pool was destroyed"));
720
+ }
721
+ const startPromise = new Promise((onStart, onReject) => {
722
+ this.jobQueue.push({ name, onMessage: onMessage2, onError, onStart, onReject });
715
723
  return this;
716
724
  });
717
725
  this._startQueuedJob();
@@ -739,6 +747,7 @@ var init_worker_pool = __esm({
739
747
  backlog: this.jobQueue.length
740
748
  });
741
749
  const job = new WorkerJob(queuedJob.name, workerThread);
750
+ this.activeJobs.add(job);
742
751
  workerThread.ref();
743
752
  workerThread.onMessage = (data) => queuedJob.onMessage(job, data.type, data.payload);
744
753
  workerThread.onError = (error) => queuedJob.onError(job, error);
@@ -747,6 +756,7 @@ var init_worker_pool = __esm({
747
756
  await job.result;
748
757
  } catch {
749
758
  } finally {
759
+ this.activeJobs.delete(job);
750
760
  this.returnWorkerToQueue(workerThread);
751
761
  }
752
762
  }
@@ -860,12 +870,13 @@ var init_worker_farm = __esm({
860
870
  this.workerPools = /* @__PURE__ */ new Map();
861
871
  }
862
872
  /**
863
- * Terminate all workers in the farm
873
+ * Terminate all workers in the farm and abort active jobs.
874
+ * @param reason Optional error delivered to active jobs.
864
875
  * @note Can free up significant memory
865
876
  */
866
- destroy() {
877
+ destroy(reason) {
867
878
  for (const workerPool of this.workerPools.values()) {
868
- workerPool.destroy();
879
+ workerPool.destroy(reason);
869
880
  }
870
881
  this.workerPools = /* @__PURE__ */ new Map();
871
882
  }
@@ -1109,13 +1120,17 @@ var init_src = __esm({
1109
1120
 
1110
1121
  // ../loader-utils/src/lib/worker-loader-utils/parse-with-worker.ts
1111
1122
  function canParseWithWorker(loader, options) {
1112
- var _a, _b;
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;
1113
1128
  const workerOptions = getWorkerOptions(options);
1114
1129
  const nodeWorkers = workerOptions._nodeWorkers;
1115
1130
  if (!isBrowser2 && !nodeWorkers) {
1116
1131
  return false;
1117
1132
  }
1118
- if (loader.id === "excel" && ((_a = options == null ? void 0 : options.excel) == null ? void 0 : _a.shape) === "arrow-table" || loader.id === "ply" && ((_b = options == null ? void 0 : options.ply) == null ? void 0 : _b.shape) === "arrow-table") {
1133
+ if (loader.id === "las" && (((_c = options == null ? void 0 : options.las) == null ? void 0 : _c.shape) ?? "arrow-table") === "arrow-table") {
1119
1134
  return false;
1120
1135
  }
1121
1136
  if (loader.id === "csv" && !shouldParseCSVWithWorker(options)) {
@@ -1162,7 +1177,12 @@ function callParseOnMainThread(parseOnMainThread, input, options, context) {
1162
1177
  return parseOnMainThread(input, void 0, options, context);
1163
1178
  }
1164
1179
  function getWorkerOptions(options = {}, loader) {
1165
- const serializedOptions = JSON.parse(JSON.stringify(options));
1180
+ const serializedOptions = JSON.parse(
1181
+ JSON.stringify({
1182
+ ...options,
1183
+ ...options.core ? { core: { ...options.core, authentications: void 0 } } : {}
1184
+ })
1185
+ );
1166
1186
  const workerOptions = {
1167
1187
  ...serializedOptions.core,
1168
1188
  ...serializedOptions
@@ -1251,6 +1271,48 @@ var init_async_iteration = __esm({
1251
1271
  }
1252
1272
  });
1253
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
+
1254
1316
  // ../loader-utils/src/lib/request-utils/request-cache.ts
1255
1317
  function createAbortError3() {
1256
1318
  const error = new Error("Request aborted");
@@ -1485,21 +1547,54 @@ var init_request_cache = __esm({
1485
1547
 
1486
1548
  // ../loader-utils/src/lib/request-utils/request-credentials.ts
1487
1549
  function createAuthenticatedFetch(options) {
1488
- const baseFetch = options.fetch || ((url, requestOptions) => fetch(url, requestOptions));
1489
- if (!options.credentials.length) return baseFetch;
1490
- const existingMetadata = baseFetch[AUTHENTICATED_FETCH];
1491
- if (existingMetadata === options.credentials) return baseFetch;
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);
1492
1577
  const authenticatedFetch = async (url, requestOptions = {}) => {
1493
- 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);
1494
1582
  const resolvedURL = parseHTTPURL(url);
1495
- if (!resolvedURL) return baseFetch(url, requestOptions);
1496
- const authorization = await authorizeRequest(resolvedURL, requestOptions, options.credentials);
1497
- const response = await baseFetch(authorization.url, authorization.options);
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);
1498
1586
  const refreshableCredentials = authorization.credentials.filter(
1499
1587
  ({ credential }) => typeof credential.token === "function" && credential.refreshStatusCodes.includes(response.status)
1500
1588
  );
1501
- if (!refreshableCredentials.length || !isReplayableRequest(requestOptions)) return response;
1502
- if ((_a = requestOptions.signal) == null ? void 0 : _a.aborted) throw createAbortError4();
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();
1503
1598
  const refreshedTokens = /* @__PURE__ */ new Map();
1504
1599
  await Promise.all(
1505
1600
  refreshableCredentials.map(async ({ credential }) => {
@@ -1507,24 +1602,111 @@ function createAuthenticatedFetch(options) {
1507
1602
  if (token) refreshedTokens.set(credential, token);
1508
1603
  })
1509
1604
  );
1510
- if (!refreshedTokens.size) return response;
1511
- await ((_b = response.body) == null ? void 0 : _b.cancel().catch(() => {
1605
+ if (!refreshedTokens.size && !shouldRetrySignature) return response;
1606
+ await ((_c = response.body) == null ? void 0 : _c.cancel().catch(() => {
1512
1607
  }));
1513
- if ((_c = requestOptions.signal) == null ? void 0 : _c.aborted) throw createAbortError4();
1514
- const replayAuthorization = await authorizeRequest(
1608
+ if ((_d = requestOptions.signal) == null ? void 0 : _d.aborted) throw createAbortError4();
1609
+ const replayAuthorization = resolvedURL ? await authorizeRequest(
1515
1610
  resolvedURL,
1516
1611
  requestOptions,
1517
- options.credentials,
1612
+ tokenCredentials,
1518
1613
  refreshedTokens,
1519
1614
  authorization.credentials
1615
+ ) : { url, options: requestOptions };
1616
+ const replayRequest = await authenticateRequest(
1617
+ replayAuthorization,
1618
+ requestCredentials,
1619
+ "retry",
1620
+ response
1520
1621
  );
1521
- return baseFetch(replayAuthorization.url, replayAuthorization.options);
1622
+ return baseFetch(replayRequest.url, replayRequest.options);
1522
1623
  };
1523
1624
  Object.defineProperty(authenticatedFetch, AUTHENTICATED_FETCH, {
1524
- value: options.credentials
1625
+ value: {
1626
+ fetch: baseFetch,
1627
+ credentials,
1628
+ credentialResolutions,
1629
+ fetchOptions
1630
+ }
1525
1631
  });
1526
1632
  return authenticatedFetch;
1527
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
+ }
1528
1710
  async function authorizeRequest(sourceURL, requestOptions, credentials, tokenOverrides = /* @__PURE__ */ new Map(), previousCredentials = []) {
1529
1711
  const url = new URL(sourceURL);
1530
1712
  const headers = new Headers(requestOptions.headers);
@@ -1593,6 +1775,7 @@ var AUTHENTICATED_FETCH, refreshPromises;
1593
1775
  var init_request_credentials = __esm({
1594
1776
  "../loader-utils/src/lib/request-utils/request-credentials.ts"() {
1595
1777
  "use strict";
1778
+ init_authentication();
1596
1779
  AUTHENTICATED_FETCH = /* @__PURE__ */ Symbol("loaders.gl.authenticated-fetch");
1597
1780
  refreshPromises = /* @__PURE__ */ new WeakMap();
1598
1781
  }
@@ -1838,6 +2021,7 @@ var init_range_request_scheduler = __esm({
1838
2021
  /** Optional event callback for range batching diagnostics. */
1839
2022
  onEvent;
1840
2023
  pendingRequests = [];
2024
+ /** Pending batch window, independent of in-flight transport requests. */
1841
2025
  flushTimer = null;
1842
2026
  /** Creates a scheduler for one group of byte-range-addressable resources. */
1843
2027
  constructor(props = {}) {
@@ -1914,7 +2098,7 @@ var init_range_request_scheduler = __esm({
1914
2098
  }
1915
2099
  /** Immediately starts loading the currently queued requests. */
1916
2100
  flush() {
1917
- if (this.flushTimer) {
2101
+ if (this.flushTimer !== null) {
1918
2102
  clearTimeout(this.flushTimer);
1919
2103
  this.flushTimer = null;
1920
2104
  }
@@ -1936,9 +2120,9 @@ var init_range_request_scheduler = __esm({
1936
2120
  this.fetchMergedRequest(mergedRequest);
1937
2121
  }
1938
2122
  }
1939
- /** Schedules the next pending-request flush. */
2123
+ /** Starts a fixed batch window only when no flush is already scheduled. */
1940
2124
  scheduleFlush() {
1941
- if (this.flushTimer) {
2125
+ if (this.flushTimer !== null) {
1942
2126
  return;
1943
2127
  }
1944
2128
  this.flushTimer = setTimeout(() => this.flush(), this.props.batchDelayMs);
@@ -2498,39 +2682,25 @@ var init_blob_file = __esm({
2498
2682
 
2499
2683
  // ../loader-utils/src/lib/sources/data-source.ts
2500
2684
  function getFetchFunction(options) {
2501
- var _a, _b;
2502
- const fetchOption = (options == null ? void 0 : options.fetch) ?? ((_a = options == null ? void 0 : options.core) == null ? void 0 : _a.fetch);
2503
- let fetchFunction;
2504
- if (typeof fetchOption === "function") {
2505
- fetchFunction = (url, fetchOptions) => fetchOption(url, fetchOptions);
2506
- } else if (fetchOption) {
2507
- fetchFunction = (url, requestOptions) => fetch(url, mergeFetchOptions(fetchOption, requestOptions));
2508
- } else {
2509
- fetchFunction = (url, requestOptions) => fetch(url, requestOptions);
2510
- }
2511
- return createAuthenticatedFetch({
2512
- fetch: fetchFunction,
2513
- credentials: ((_b = options == null ? void 0 : options.core) == null ? void 0 : _b.credentials) || []
2514
- });
2515
- }
2516
- function mergeFetchOptions(fetchOptions, requestOptions) {
2517
- const mergedOptions = { ...fetchOptions, ...requestOptions };
2518
- if (fetchOptions.headers || (requestOptions == null ? void 0 : requestOptions.headers)) {
2519
- mergedOptions.headers = mergeHeaders(fetchOptions.headers, requestOptions == null ? void 0 : requestOptions.headers);
2520
- }
2521
- return mergedOptions;
2685
+ return getAuthenticatedFetch(options);
2522
2686
  }
2523
- function mergeHeaders(defaultHeaders, requestHeaders) {
2524
- const headers = new Headers(defaultHeaders);
2525
- if (requestHeaders) {
2526
- new Headers(requestHeaders).forEach((value, key) => headers.set(key, value));
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
+ );
2527
2693
  }
2528
- return headers;
2529
- }
2530
- function normalizeDirectLoaderOptions(options) {
2531
2694
  const loadOptions = { ...options };
2532
2695
  if (options == null ? void 0 : options.core) {
2533
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
+ }
2534
2704
  }
2535
2705
  const topLevelBaseUri = typeof loadOptions.baseUri === "string" ? loadOptions.baseUri : void 0;
2536
2706
  const topLevelBaseUrl = typeof loadOptions.baseUrl === "string" ? loadOptions.baseUrl : void 0;
@@ -2568,6 +2738,7 @@ var init_data_source = __esm({
2568
2738
  init_file_aliases();
2569
2739
  init_log();
2570
2740
  init_request_credentials();
2741
+ init_authentication();
2571
2742
  UNAVAILABLE_CORE_API = {
2572
2743
  fetchFile: unavailableCoreApiMethod("fetchFile"),
2573
2744
  parse: unavailableCoreApiMethod("parse"),
@@ -2582,7 +2753,6 @@ var init_data_source = __esm({
2582
2753
  core: {
2583
2754
  type: "auto",
2584
2755
  attributions: [],
2585
- loadOptions: {},
2586
2756
  loaders: [],
2587
2757
  onError: void 0
2588
2758
  }
@@ -2591,9 +2761,9 @@ var init_data_source = __esm({
2591
2761
  options;
2592
2762
  data;
2593
2763
  url;
2594
- /** The actual load options, if calling a loaders.gl loader */
2764
+ /** Shared parser options derived from the source options, excluding source-only core controls. */
2595
2765
  loadOptions;
2596
- /** A resolved fetch function extracted from loadOptions prop */
2766
+ /** A resolved fetch function extracted from the shared core options. */
2597
2767
  fetch;
2598
2768
  /** Shared source-level runtime hooks, when supplied by the source factory. */
2599
2769
  coreApi;
@@ -2601,15 +2771,13 @@ var init_data_source = __esm({
2601
2771
  hasCoreApi;
2602
2772
  _needsRefresh = true;
2603
2773
  constructor(data, options, defaultOptions, coreApi) {
2604
- var _a;
2605
- if (defaultOptions) {
2606
- this.options = mergeOptions({ ...defaultOptions, core: _DataSource.defaultOptions }, options);
2607
- } else {
2608
- this.options = { ...options };
2609
- }
2774
+ this.options = mergeOptions(
2775
+ mergeOptions(_DataSource.defaultOptions, defaultOptions || {}),
2776
+ options
2777
+ );
2610
2778
  this.data = data;
2611
2779
  this.url = typeof data === "string" ? resolvePath(data) : "";
2612
- const loadOptions = normalizeDirectLoaderOptions((_a = this.options.core) == null ? void 0 : _a.loadOptions);
2780
+ const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(this.options));
2613
2781
  this.loadOptions = loadOptions;
2614
2782
  const fetch2 = getFetchFunction(loadOptions);
2615
2783
  this.coreApi = coreApi || UNAVAILABLE_CORE_API;
@@ -2617,7 +2785,11 @@ var init_data_source = __esm({
2617
2785
  this.fetch = fetch2;
2618
2786
  }
2619
2787
  setProps(options) {
2620
- this.options = Object.assign(this.options, options);
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);
2621
2793
  this.setNeedsRefresh();
2622
2794
  }
2623
2795
  /** Mark this data source as needing a refresh (redraw) */
@@ -2937,6 +3109,9 @@ function getDataTypeFromArray(array) {
2937
3109
  return { type: "null", nullable: true };
2938
3110
  }
2939
3111
  function getDataTypeFromTypedArray(array) {
3112
+ if (typeof Float16Array !== "undefined" && array instanceof Float16Array) {
3113
+ return "float16";
3114
+ }
2940
3115
  switch (array.constructor) {
2941
3116
  case Int8Array:
2942
3117
  return "int8";
@@ -2951,6 +3126,10 @@ function getDataTypeFromTypedArray(array) {
2951
3126
  return "int32";
2952
3127
  case Uint32Array:
2953
3128
  return "uint32";
3129
+ case BigInt64Array:
3130
+ return "int64";
3131
+ case BigUint64Array:
3132
+ return "uint64";
2954
3133
  case Float32Array:
2955
3134
  return "float32";
2956
3135
  case Float64Array:
@@ -2978,15 +3157,19 @@ function getArrayTypeFromDataType(type, nullable) {
2978
3157
  return Float32Array;
2979
3158
  case "float64":
2980
3159
  return Float64Array;
3160
+ case "float16":
3161
+ return (0, import_types.getFloat16ArrayConstructor)();
2981
3162
  default:
2982
3163
  break;
2983
3164
  }
2984
3165
  }
2985
3166
  return Array;
2986
3167
  }
3168
+ var import_types;
2987
3169
  var init_data_type = __esm({
2988
3170
  "../schema-utils/src/lib/schema/data-type.ts"() {
2989
3171
  "use strict";
3172
+ import_types = require("@math.gl/types");
2990
3173
  }
2991
3174
  });
2992
3175
 
@@ -3038,6 +3221,13 @@ function serializeArrowType(arrowType) {
3038
3221
  if (isArrowViewType(arrowType, "Utf8View")) {
3039
3222
  return "utf8-view";
3040
3223
  }
3224
+ if (isOptionalArrowType(arrowType, "LargeList")) {
3225
+ const largeListType = arrowType;
3226
+ return {
3227
+ type: "large-list",
3228
+ children: [serializeArrowField(largeListType.valueField)]
3229
+ };
3230
+ }
3041
3231
  switch (arrowType.constructor) {
3042
3232
  case arrow.Null:
3043
3233
  return "null";
@@ -3176,12 +3366,6 @@ function serializeArrowType(arrowType) {
3176
3366
  type: "list",
3177
3367
  children: [serializeArrowField(listField)]
3178
3368
  };
3179
- case arrow.LargeList:
3180
- const largeListType = arrowType;
3181
- return {
3182
- type: "large-list",
3183
- children: [serializeArrowField(largeListType.valueField)]
3184
- };
3185
3369
  case arrow.FixedSizeList:
3186
3370
  const fixedSizeList = arrowType;
3187
3371
  return {
@@ -3234,7 +3418,13 @@ function deserializeArrowType(dataType, options) {
3234
3418
  }
3235
3419
  case "large-list": {
3236
3420
  const field = deserializeArrowField(dataType.children[0], options);
3237
- return new arrow.LargeList(field);
3421
+ const LargeList = getOptionalArrowConstructor("LargeList");
3422
+ if (!LargeList) {
3423
+ throw new Error(
3424
+ "LargeList requires an Apache Arrow runtime that exports the LargeList constructor"
3425
+ );
3426
+ }
3427
+ return new LargeList(field);
3238
3428
  }
3239
3429
  case "fixed-size-list": {
3240
3430
  const child = deserializeArrowField(dataType.children[0], options);
@@ -3330,11 +3520,11 @@ function deserializeArrowType(dataType, options) {
3330
3520
  throw new Error("array type not supported");
3331
3521
  }
3332
3522
  }
3333
- function getArrowViewConstructors() {
3334
- return arrow;
3523
+ function getOptionalArrowConstructor(typeName) {
3524
+ return arrow[typeName];
3335
3525
  }
3336
3526
  function isArrowViewType(arrowType, viewTypeName) {
3337
- const constructor = getArrowViewConstructors()[viewTypeName];
3527
+ const constructor = getOptionalArrowConstructor(viewTypeName);
3338
3528
  if (constructor && arrowType instanceof constructor) {
3339
3529
  return true;
3340
3530
  }
@@ -3342,12 +3532,16 @@ function isArrowViewType(arrowType, viewTypeName) {
3342
3532
  const guard = viewTypeName === "BinaryView" ? guards.isBinaryView : guards.isUtf8View;
3343
3533
  return Boolean(guard == null ? void 0 : guard(arrowType));
3344
3534
  }
3535
+ function isOptionalArrowType(arrowType, typeName) {
3536
+ const constructor = getOptionalArrowConstructor(typeName);
3537
+ return Boolean(constructor && arrowType instanceof constructor);
3538
+ }
3345
3539
  function makeVariableWidthArrowType(viewTypeName, fallbackType, options) {
3346
3540
  const viewTypeMode = (options == null ? void 0 : options.viewTypes) || "never";
3347
3541
  if (viewTypeMode === "never") {
3348
3542
  return fallbackType;
3349
3543
  }
3350
- const constructor = getArrowViewConstructors()[viewTypeName];
3544
+ const constructor = getOptionalArrowConstructor(viewTypeName);
3351
3545
  if (constructor) {
3352
3546
  return new constructor();
3353
3547
  }
@@ -3359,7 +3553,7 @@ function makeVariableWidthArrowType(viewTypeName, fallbackType, options) {
3359
3553
  return fallbackType;
3360
3554
  }
3361
3555
  function makeRequiredArrowViewType(viewTypeName) {
3362
- const constructor = getArrowViewConstructors()[viewTypeName];
3556
+ const constructor = getOptionalArrowConstructor(viewTypeName);
3363
3557
  if (!constructor) {
3364
3558
  throw new Error(
3365
3559
  `${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
@@ -6265,7 +6459,7 @@ var init_parquet_loader_options2 = __esm({
6265
6459
  PARQUET_LOADER_DEFAULT_OPTIONS2 = {
6266
6460
  columns: void 0,
6267
6461
  preserveBinary: false,
6268
- shape: "object-row-table"
6462
+ shape: "arrow-table"
6269
6463
  };
6270
6464
  }
6271
6465
  });
@@ -7278,7 +7472,7 @@ var init_geoparquet_loader = __esm({
7278
7472
  "use strict";
7279
7473
  init_parquet_format();
7280
7474
  init_parquet_loader_options();
7281
- VERSION5 = true ? "5.0.0-alpha.6" : "latest";
7475
+ VERSION5 = true ? "5.0.0-alpha.8" : "latest";
7282
7476
  GeoParquetLoader = {
7283
7477
  ...ParquetFormat,
7284
7478
  dataType: null,
@@ -8419,6 +8613,18 @@ function readUnsignedVarIntNumber(cursor) {
8419
8613
  }
8420
8614
  throw new Error("invalid RLE run header");
8421
8615
  }
8616
+ function encodeUnsignedVarIntNumber(value) {
8617
+ if (!Number.isSafeInteger(value) || value < 0) {
8618
+ throw new Error("RLE run header must be a non-negative safe integer");
8619
+ }
8620
+ const bytes = [];
8621
+ while (value >= 128) {
8622
+ bytes.push(value % 128 | 128);
8623
+ value = Math.floor(value / 128);
8624
+ }
8625
+ bytes.push(value);
8626
+ return Uint8Array.from(bytes);
8627
+ }
8422
8628
  function assertReadable(cursor, byteLength) {
8423
8629
  const size = cursor.size ?? cursor.buffer.length;
8424
8630
  if (byteLength < 0 || cursor.offset + byteLength > size) {
@@ -8440,10 +8646,7 @@ function encodeRunBitpacked(values, opts) {
8440
8646
  buf[Math.floor(b / 8)] |= 1 << b % 8;
8441
8647
  }
8442
8648
  }
8443
- return concatUint8Arrays([
8444
- Uint8Array.from(import_varint.default.encode(paddedValues.length / 8 << 1 | 1)),
8445
- buf
8446
- ]);
8649
+ return concatUint8Arrays([encodeUnsignedVarIntNumber(paddedValues.length / 8 << 1 | 1), buf]);
8447
8650
  }
8448
8651
  function encodeRunRepeated(value, count, opts) {
8449
8652
  const bitWidth = opts.bitWidth;
@@ -8452,15 +8655,13 @@ function encodeRunRepeated(value, count, opts) {
8452
8655
  buf[i] = value & 255;
8453
8656
  value = Math.floor(value / 256);
8454
8657
  }
8455
- return concatUint8Arrays([Uint8Array.from(import_varint.default.encode(count << 1)), buf]);
8658
+ return concatUint8Arrays([encodeUnsignedVarIntNumber(count << 1), buf]);
8456
8659
  }
8457
- var import_varint;
8458
8660
  var init_rle = __esm({
8459
8661
  "src/parquetjs/codecs/rle.ts"() {
8460
8662
  "use strict";
8461
8663
  init_declare();
8462
8664
  init_binary_utils();
8463
- import_varint = __toESM(require("varint"), 1);
8464
8665
  }
8465
8666
  });
8466
8667
 
@@ -24792,7 +24993,7 @@ var init_parquet_js_loader_types = __esm({
24792
24993
  columns: void 0,
24793
24994
  preserveBinary: false,
24794
24995
  verifyFooterSignature: true,
24795
- shape: "object-row-table"
24996
+ shape: "arrow-table"
24796
24997
  };
24797
24998
  ParquetJSLoader = {
24798
24999
  ...ParquetFormat2,
@@ -24831,7 +25032,8 @@ var init_parquet_js_loader = __esm({
24831
25032
  DEFAULT_PARQUET_JS_OPTIONS2 = {
24832
25033
  columns: void 0,
24833
25034
  preserveBinary: false,
24834
- verifyFooterSignature: true
25035
+ verifyFooterSignature: true,
25036
+ shape: "arrow-table"
24835
25037
  };
24836
25038
  ParquetJSLoaderWithParser = {
24837
25039
  ...ParquetJSLoaderMetadataWithoutPreload,
@@ -25974,6 +26176,15 @@ var init_parquet_page_index = __esm({
25974
26176
  }
25975
26177
  });
25976
26178
 
26179
+ // src/parquet-source-worker-factory.ts
26180
+ var PARQUET_SOURCE_WORKER_LOAD_WORKER;
26181
+ var init_parquet_source_worker_factory = __esm({
26182
+ "src/parquet-source-worker-factory.ts"() {
26183
+ "use strict";
26184
+ PARQUET_SOURCE_WORKER_LOAD_WORKER = void 0;
26185
+ }
26186
+ });
26187
+
25977
26188
  // src/parquet-source-worker-url.ts
25978
26189
  function resolveParquetSourceWorkerUrl() {
25979
26190
  if (!import_meta5.url) {
@@ -26014,12 +26225,14 @@ var init_parquet_source_worker_client = __esm({
26014
26225
  "use strict";
26015
26226
  init_src2();
26016
26227
  init_parquet_loader_base2();
26228
+ init_parquet_source_worker_factory();
26017
26229
  init_parquet_source_worker_url();
26018
26230
  PARQUET_SOURCE_WORKER = {
26019
26231
  ...PARQUET_LOADER_BASE2,
26020
26232
  id: "parquet-source",
26021
26233
  name: "ParquetSource",
26022
- worker: PARQUET_SOURCE_WORKER_URL
26234
+ worker: PARQUET_SOURCE_WORKER_URL,
26235
+ loadWorker: PARQUET_SOURCE_WORKER_LOAD_WORKER
26023
26236
  };
26024
26237
  }
26025
26238
  });
@@ -28100,12 +28313,12 @@ init_geoparquet_loader();
28100
28313
 
28101
28314
  // dist/parquet-js-loader-types.js
28102
28315
  init_parquet_format();
28103
- var VERSION8 = true ? "5.0.0-alpha.6" : "latest";
28316
+ var VERSION8 = true ? "5.0.0-alpha.8" : "latest";
28104
28317
  var DEFAULT_PARQUET_JS_OPTIONS3 = {
28105
28318
  columns: void 0,
28106
28319
  preserveBinary: false,
28107
28320
  verifyFooterSignature: true,
28108
- shape: "object-row-table"
28321
+ shape: "arrow-table"
28109
28322
  };
28110
28323
  async function preloadParquetJSLoader2() {
28111
28324
  const { ParquetJSLoaderWithParser: ParquetJSLoaderWithParser2 } = await Promise.resolve().then(() => (init_parquet_js_loader(), parquet_js_loader_exports));
@@ -28127,7 +28340,7 @@ var ParquetJSLoader2 = {
28127
28340
 
28128
28341
  // dist/parquet-source-loader-types.js
28129
28342
  init_parquet_format();
28130
- var VERSION10 = true ? "5.0.0-alpha.6" : "latest";
28343
+ var VERSION10 = true ? "5.0.0-alpha.8" : "latest";
28131
28344
  async function preloadParquetSourceLoader2() {
28132
28345
  const { ParquetSourceLoaderWithParser: ParquetSourceLoaderWithParser2 } = await Promise.resolve().then(() => (init_parquet_source_loader(), parquet_source_loader_exports));
28133
28346
  return ParquetSourceLoaderWithParser2;
@@ -28251,7 +28464,7 @@ init_normalize_parquet_options2();
28251
28464
  init_parquet_format();
28252
28465
 
28253
28466
  // dist/lib/constants.js
28254
- var VERSION11 = true ? "5.0.0-alpha.6" : "latest";
28467
+ var VERSION11 = true ? "5.0.0-alpha.8" : "latest";
28255
28468
  var PARQUET_MAGIC2 = "PAR1";
28256
28469
  var PARQUET_MAGIC_ENCRYPTED2 = "PARE";
28257
28470
  var PARQUET_RDLVL_TYPE2 = "INT32";
@@ -28718,7 +28931,6 @@ function toPrimitiveBytes2(value) {
28718
28931
  }
28719
28932
 
28720
28933
  // dist/parquetjs/codecs/rle.js
28721
- var import_varint2 = __toESM(require("varint"), 1);
28722
28934
  function encodeValues6(type, values, opts) {
28723
28935
  if (!("bitWidth" in opts)) {
28724
28936
  throw new Error("bitWidth is required");
@@ -29297,6 +29509,18 @@ function readUnsignedVarIntNumber3(cursor) {
29297
29509
  }
29298
29510
  throw new Error("invalid RLE run header");
29299
29511
  }
29512
+ function encodeUnsignedVarIntNumber2(value) {
29513
+ if (!Number.isSafeInteger(value) || value < 0) {
29514
+ throw new Error("RLE run header must be a non-negative safe integer");
29515
+ }
29516
+ const bytes = [];
29517
+ while (value >= 128) {
29518
+ bytes.push(value % 128 | 128);
29519
+ value = Math.floor(value / 128);
29520
+ }
29521
+ bytes.push(value);
29522
+ return Uint8Array.from(bytes);
29523
+ }
29300
29524
  function assertReadable3(cursor, byteLength) {
29301
29525
  const size = cursor.size ?? cursor.buffer.length;
29302
29526
  if (byteLength < 0 || cursor.offset + byteLength > size) {
@@ -29316,10 +29540,7 @@ function encodeRunBitpacked2(values, opts) {
29316
29540
  buf[Math.floor(b / 8)] |= 1 << b % 8;
29317
29541
  }
29318
29542
  }
29319
- return concatUint8Arrays2([
29320
- Uint8Array.from(import_varint2.default.encode(paddedValues.length / 8 << 1 | 1)),
29321
- buf
29322
- ]);
29543
+ return concatUint8Arrays2([encodeUnsignedVarIntNumber2(paddedValues.length / 8 << 1 | 1), buf]);
29323
29544
  }
29324
29545
  function encodeRunRepeated2(value, count, opts) {
29325
29546
  const bitWidth = opts.bitWidth;
@@ -29328,7 +29549,7 @@ function encodeRunRepeated2(value, count, opts) {
29328
29549
  buf[i] = value & 255;
29329
29550
  value = Math.floor(value / 256);
29330
29551
  }
29331
- return concatUint8Arrays2([Uint8Array.from(import_varint2.default.encode(count << 1)), buf]);
29552
+ return concatUint8Arrays2([encodeUnsignedVarIntNumber2(count << 1), buf]);
29332
29553
  }
29333
29554
 
29334
29555
  // dist/parquetjs/codecs/dictionary.js
@@ -39114,7 +39335,7 @@ function formatDataType(dataType) {
39114
39335
 
39115
39336
  // dist/parquet-js-writer.js
39116
39337
  init_parquet_format();
39117
- var VERSION12 = true ? "5.0.0-alpha.6" : "latest";
39338
+ var VERSION12 = true ? "5.0.0-alpha.8" : "latest";
39118
39339
  var DEFAULT_PARQUET_JS_OPTIONS4 = {};
39119
39340
  var ParquetJSWriter = {
39120
39341
  ...ParquetFormat,