@loaders.gl/tiles-3d 5.0.0-beta.5 → 5.0.0-beta.6

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 (58) hide show
  1. package/dist/3d-tiles/3d-tiles-archive-loader.js +1 -1
  2. package/dist/3d-tiles/dist.dev.js +50 -1
  3. package/dist/3d-tiles/dist.min.js +11 -11
  4. package/dist/3d-tiles/index.cjs +55 -4
  5. package/dist/3d-tiles/index.cjs.map +1 -1
  6. package/dist/3d-tiles/lib/utils/version.js +1 -1
  7. package/dist/3d-tiles-archive-writer.cjs +1 -1
  8. package/dist/cesium-ion-loader-with-parser.cjs +2 -1
  9. package/dist/cesium-ion-loader-with-parser.cjs.map +1 -1
  10. package/dist/copc/copc-source-loader.js +1 -1
  11. package/dist/copc/copc-writer.js +1 -1
  12. package/dist/copc/index.cjs +99 -5
  13. package/dist/copc/index.cjs.map +1 -1
  14. package/dist/dist.dev.js +92 -2
  15. package/dist/dist.min.js +10 -10
  16. package/dist/i3s/arcgis-webscene-loader.js +1 -1
  17. package/dist/i3s/dist.dev.js +93 -2
  18. package/dist/i3s/dist.min.js +31 -31
  19. package/dist/i3s/i3s-attribute-loader.js +1 -1
  20. package/dist/i3s/i3s-building-scene-layer-loader.js +1 -1
  21. package/dist/i3s/i3s-content-loader.js +1 -1
  22. package/dist/i3s/i3s-lepcc-loader-types.js +1 -1
  23. package/dist/i3s/i3s-loader.js +1 -1
  24. package/dist/i3s/i3s-node-page-loader.js +1 -1
  25. package/dist/i3s/i3s-slpk-loader.js +1 -1
  26. package/dist/i3s/i3s-slpk-writer.js +1 -1
  27. package/dist/i3s/index.cjs +107 -12
  28. package/dist/i3s/index.cjs.map +2 -2
  29. package/dist/i3s-content-worker-node.js +7 -7
  30. package/dist/i3s-content-worker-node.js.map +1 -1
  31. package/dist/i3s-content-worker.js +5 -4
  32. package/dist/i3s-lepcc-worker-node.js +2 -2
  33. package/dist/i3s-lepcc-worker.js +2 -2
  34. package/dist/i3s-mesh-writer.cjs +1 -0
  35. package/dist/i3s-mesh-writer.cjs.map +1 -1
  36. package/dist/i3s-slpk-writer.cjs +1 -1
  37. package/dist/index.cjs +98 -4
  38. package/dist/index.cjs.map +2 -2
  39. package/dist/point-cloud-tile-source-loader-types.js +1 -1
  40. package/dist/point-cloud-tile-source-loader.cjs +46 -2
  41. package/dist/point-cloud-tile-source-loader.cjs.map +2 -2
  42. package/dist/point-cloud-tile-source.cjs +45 -1
  43. package/dist/point-cloud-tile-source.cjs.map +1 -1
  44. package/dist/potree/dist.dev.js +99 -9
  45. package/dist/potree/dist.min.js +15 -15
  46. package/dist/potree/index.cjs +107 -16
  47. package/dist/potree/index.cjs.map +2 -2
  48. package/dist/potree/potree-bin-loader.js +1 -1
  49. package/dist/potree/potree-hierarchy-chunk-loader.js +1 -1
  50. package/dist/potree/potree-loader-types.js +1 -1
  51. package/dist/potree/potree-source-loader.js +1 -1
  52. package/dist/potree/potree-writer.js +1 -1
  53. package/dist/potree/potree2-source.d.ts.map +1 -1
  54. package/dist/potree/potree2-source.js +3 -13
  55. package/dist/potree/potree2-source.js.map +1 -1
  56. package/dist/potree-loader.cjs +1 -1
  57. package/package.json +13 -13
  58. package/src/potree/potree2-source.ts +3 -14
@@ -4,7 +4,7 @@
4
4
  import { ArcGISWebSceneFormat } from "./i3s-format.js";
5
5
  // __VERSION__ is injected by babel-plugin-version-inline
6
6
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
7
- const VERSION = typeof "5.0.0-beta.5" !== 'undefined' ? "5.0.0-beta.5" : 'latest';
7
+ const VERSION = typeof "5.0.0-beta.6" !== 'undefined' ? "5.0.0-beta.6" : 'latest';
8
8
  /**
9
9
  * Loader for ArcGIS WebScene
10
10
  * Spec - https://developers.arcgis.com/web-scene-specification/objects/webscene/
@@ -29514,6 +29514,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
29514
29514
  } catch {
29515
29515
  const moduleUrl2 = new URL(moduleLibraryUrl, globalThis.location.href).href;
29516
29516
  const library2 = await import(
29517
+ /* webpackIgnore: true */
29517
29518
  /* @vite-ignore */
29518
29519
  moduleUrl2
29519
29520
  );
@@ -31319,6 +31320,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31319
31320
  identityHints;
31320
31321
  /** Failure objects already included in telemetry. */
31321
31322
  countedFailures = /* @__PURE__ */ new WeakSet();
31323
+ /** Observer for cumulative transport counters, including asynchronous cancellation. */
31324
+ onTelemetry;
31322
31325
  /** Mutable counters backing immutable telemetry snapshots. */
31323
31326
  telemetry = {
31324
31327
  requestedBytes: 0,
@@ -31332,6 +31335,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31332
31335
  constructor(url2, options) {
31333
31336
  validateKnownByteLength(options.byteLength);
31334
31337
  this.url = url2;
31338
+ this.onTelemetry = options.onTelemetry;
31335
31339
  this.fetchFunction = options.fetch || ((input2, init) => globalThis.fetch(input2, init));
31336
31340
  this.fetchOptions = options.fetchOptions ? { ...options.fetchOptions, headers: new Headers(options.fetchOptions.headers) } : void 0;
31337
31341
  this.consistency = options.consistency || "best-effort";
@@ -31369,6 +31373,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31369
31373
  } else {
31370
31374
  this.telemetry.errorCount++;
31371
31375
  }
31376
+ this.onTelemetry?.(this.getTelemetry(), error62);
31372
31377
  }
31373
31378
  /** Performs and validates one exact HTTP range request. */
31374
31379
  async requestRange(offset2, length4, signal, expectedIdentity) {
@@ -31388,7 +31393,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31388
31393
  await cancelResponse(response);
31389
31394
  throw new Error(`HTTP byte-range request expected 206, received ${response.status}`);
31390
31395
  }
31391
- const contentRange = await readContentRange(response);
31396
+ const contentRange = response.headers.has("Content-Range") ? await readContentRange(response) : await this.inferContentRange(
31397
+ response,
31398
+ offset2,
31399
+ length4,
31400
+ expectedIdentity,
31401
+ abortContext.signal
31402
+ );
31392
31403
  const responseIdentity = getResponseIdentity(response, contentRange.byteLength);
31393
31404
  const responseError = getIdentityError(
31394
31405
  expectedIdentity,
@@ -31422,6 +31433,44 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31422
31433
  } finally {
31423
31434
  abortContext.removeAbortListeners();
31424
31435
  this.telemetry.networkTimeMs += getTimestamp2() - requestStartTime;
31436
+ this.onTelemetry?.(this.getTelemetry());
31437
+ }
31438
+ }
31439
+ /** Infers bounds for a CORS-filtered 206; the caller still validates the body length. */
31440
+ async inferContentRange(response, offset2, length4, expectedIdentity, signal) {
31441
+ try {
31442
+ let byteLength = expectedIdentity?.byteLength ?? this.identityHints.byteLength;
31443
+ if (byteLength === void 0) {
31444
+ const headers = new Headers(this.fetchOptions?.headers);
31445
+ headers.delete("Range");
31446
+ this.telemetry.requestCount++;
31447
+ const metadata3 = await this.fetchFunction(this.url, {
31448
+ ...this.fetchOptions,
31449
+ method: "HEAD",
31450
+ body: void 0,
31451
+ headers,
31452
+ signal
31453
+ });
31454
+ await cancelResponse(metadata3);
31455
+ const value2 = metadata3.headers.get("Content-Length");
31456
+ byteLength = value2 && /^\d+$/.test(value2) ? Number(value2) : NaN;
31457
+ if (metadata3.status !== 200 || !Number.isSafeInteger(byteLength) || byteLength < offset2 + length4) {
31458
+ throw new Error(
31459
+ "HTTP byte-range response is missing Content-Range and HEAD did not provide a valid file length"
31460
+ );
31461
+ }
31462
+ const identityError = getIdentityError(
31463
+ getResponseIdentity(metadata3, byteLength),
31464
+ getResponseIdentity(response, byteLength),
31465
+ this.identityHints,
31466
+ this.consistency
31467
+ );
31468
+ if (identityError) throw new Error(identityError);
31469
+ }
31470
+ return { offset: offset2, endOffset: offset2 + length4 - 1, byteLength };
31471
+ } catch (error62) {
31472
+ await cancelResponse(response);
31473
+ throw error62;
31425
31474
  }
31426
31475
  }
31427
31476
  /** Validates and consumes the special empty-object identity response. */
@@ -31669,7 +31718,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31669
31718
  if (options?.core) {
31670
31719
  loadOptions.core = { ...options.core };
31671
31720
  const parserCore = loadOptions.core;
31672
- for (const key2 of ["type", "attributions", "loaders", "onError", "loadOptions"]) {
31721
+ for (const key2 of ["type", "name", "attributions", "loaders", "onError", "loadOptions"]) {
31673
31722
  delete parserCore[key2];
31674
31723
  }
31675
31724
  if (Object.keys(parserCore).length === 0) {
@@ -31704,6 +31753,43 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31704
31753
  );
31705
31754
  };
31706
31755
  }
31756
+ function getDataSourceName(data, options) {
31757
+ const explicitName = options.core?.name;
31758
+ if (explicitName !== void 0) {
31759
+ if (typeof explicitName !== "string" || !explicitName.trim())
31760
+ throw new Error("Data source name must be a non-empty string.");
31761
+ return explicitName;
31762
+ }
31763
+ if (data && typeof data === "object") {
31764
+ const named = data;
31765
+ if (typeof named.name === "string" && named.name.trim())
31766
+ return data instanceof Blob ? removeFileExtension(named.name) : named.name;
31767
+ const metadata3 = named.schema?.metadata;
31768
+ const embeddedName = metadata3 instanceof Map ? metadata3.get("name") : metadata3?.name;
31769
+ if (typeof embeddedName === "string" && embeddedName.trim()) return embeddedName;
31770
+ }
31771
+ if (typeof data === "string") {
31772
+ try {
31773
+ const url2 = new URL(data.replace(/\\/g, "/"), "https://source.invalid/");
31774
+ if (!["data:", "blob:"].includes(url2.protocol)) {
31775
+ let basename = url2.pathname.split("/").filter(Boolean).pop();
31776
+ if (basename) {
31777
+ try {
31778
+ basename = decodeURIComponent(basename);
31779
+ } catch {
31780
+ }
31781
+ return removeFileExtension(basename);
31782
+ }
31783
+ }
31784
+ } catch {
31785
+ }
31786
+ }
31787
+ return options.core?.type && options.core.type !== "auto" ? options.core.type : "source";
31788
+ }
31789
+ function removeFileExtension(name22) {
31790
+ const extension = name22.lastIndexOf(".");
31791
+ return extension > 0 ? name22.slice(0, extension) : name22;
31792
+ }
31707
31793
  var UNAVAILABLE_CORE_API, DataSource;
31708
31794
  var init_data_source = __esm({
31709
31795
  "../core/src/loader-utils/lib/sources/data-source.ts"() {
@@ -31735,6 +31821,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31735
31821
  options;
31736
31822
  data;
31737
31823
  url;
31824
+ /** Stable query-visible name, resolved without fetching source data. */
31825
+ name;
31738
31826
  /** Shared parser options derived from the source options, excluding source-only core controls. */
31739
31827
  loadOptions;
31740
31828
  /** A resolved fetch function extracted from the shared core options. */
@@ -31751,6 +31839,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31751
31839
  );
31752
31840
  this.data = data;
31753
31841
  this.url = typeof data === "string" ? resolvePath(data) : "";
31842
+ this.name = getDataSourceName(data, this.options);
31754
31843
  const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(this.options));
31755
31844
  this.loadOptions = loadOptions;
31756
31845
  const fetch2 = getFetchFunction(loadOptions);
@@ -31759,6 +31848,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31759
31848
  this.fetch = fetch2;
31760
31849
  }
31761
31850
  setProps(options) {
31851
+ if (options.core?.name !== void 0 && options.core.name !== this.name)
31852
+ throw new Error("Data source names are fixed at creation.");
31762
31853
  const mergedOptions = mergeOptions(this.options, options);
31763
31854
  const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(mergedOptions));
31764
31855
  this.options = mergedOptions;