@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 { I3SAttributeFormat } 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 I3S attributes
10
10
  */
@@ -4,7 +4,7 @@
4
4
  import { I3SBuildingSceneLayerFormat } 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 I3S - Building Scene Layer
10
10
  */
@@ -5,7 +5,7 @@ import { I3SContentFormat } from "./i3s-format.js";
5
5
  import { I3S_LOADER_OPTIONS } from "./i3s-loader-options.js";
6
6
  // __VERSION__ is injected by babel-plugin-version-inline
7
7
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
8
- const VERSION = typeof "5.0.0-beta.5" !== 'undefined' ? "5.0.0-beta.5" : 'latest';
8
+ const VERSION = typeof "5.0.0-beta.6" !== 'undefined' ? "5.0.0-beta.6" : 'latest';
9
9
  /**
10
10
  * Loader for I3S - Indexed 3D Scene Layer
11
11
  */
@@ -4,7 +4,7 @@
4
4
  import { I3SLEPCCFormat } 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
  /** Metadata-only loader for standalone I3S LEPCC resources. */
9
9
  export const I3SLEPCCLoader = {
10
10
  ...I3SLEPCCFormat,
@@ -6,7 +6,7 @@ import { I3SContentLoader } from "./i3s-content-loader.js";
6
6
  import { I3S_LOADER_OPTIONS } from "./i3s-loader-options.js";
7
7
  // __VERSION__ is injected by babel-plugin-version-inline
8
8
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
9
- const VERSION = typeof "5.0.0-beta.5" !== 'undefined' ? "5.0.0-beta.5" : 'latest';
9
+ const VERSION = typeof "5.0.0-beta.6" !== 'undefined' ? "5.0.0-beta.6" : 'latest';
10
10
  /**
11
11
  * Loader for I3S - Indexed 3D Scene Layer
12
12
  */
@@ -4,7 +4,7 @@
4
4
  import { I3SNodePageFormat } 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 I3S node pages
10
10
  */
@@ -4,7 +4,7 @@
4
4
  import { SLPKFormat } 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 SLPK - Scene Layer Package (Archive I3S format)
10
10
  * @todo - this reloads the entire archive for every tile, should be optimized
@@ -5,7 +5,7 @@ import { encodeIndexedZip, encodeIndexedZipInBatches } from '@loaders.gl/archive
5
5
  import { SLPKFormat } from "./i3s-format.js";
6
6
  // __VERSION__ is injected by babel-plugin-version-inline
7
7
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
8
- const VERSION = typeof "5.0.0-beta.5" !== 'undefined' ? "5.0.0-beta.5" : 'latest';
8
+ const VERSION = typeof "5.0.0-beta.6" !== 'undefined' ? "5.0.0-beta.6" : 'latest';
9
9
  /** SLPK requires ZIP64 above 2 GiB; the default output budget retains the original 2 GiB bound. */
10
10
  const MAX_ARCHIVE_BYTES = 0x7fffffff;
11
11
  /**
@@ -1232,6 +1232,7 @@ async function loadLibraryInWorker(libraryUrl, moduleLibraryUrl = libraryUrl) {
1232
1232
  } catch {
1233
1233
  const moduleUrl = new URL(moduleLibraryUrl, globalThis.location.href).href;
1234
1234
  const library = await import(
1235
+ /* webpackIgnore: true */
1235
1236
  /* @vite-ignore */
1236
1237
  moduleUrl
1237
1238
  );
@@ -2842,6 +2843,8 @@ var init_http_file_transport = __esm({
2842
2843
  identityHints;
2843
2844
  /** Failure objects already included in telemetry. */
2844
2845
  countedFailures = /* @__PURE__ */ new WeakSet();
2846
+ /** Observer for cumulative transport counters, including asynchronous cancellation. */
2847
+ onTelemetry;
2845
2848
  /** Mutable counters backing immutable telemetry snapshots. */
2846
2849
  telemetry = {
2847
2850
  requestedBytes: 0,
@@ -2855,6 +2858,7 @@ var init_http_file_transport = __esm({
2855
2858
  constructor(url, options) {
2856
2859
  validateKnownByteLength(options.byteLength);
2857
2860
  this.url = url;
2861
+ this.onTelemetry = options.onTelemetry;
2858
2862
  this.fetchFunction = options.fetch || ((input, init) => globalThis.fetch(input, init));
2859
2863
  this.fetchOptions = options.fetchOptions ? { ...options.fetchOptions, headers: new Headers(options.fetchOptions.headers) } : void 0;
2860
2864
  this.consistency = options.consistency || "best-effort";
@@ -2881,6 +2885,7 @@ var init_http_file_transport = __esm({
2881
2885
  }
2882
2886
  /** Counts each failure object once even when it passes through several async layers. */
2883
2887
  trackFailure(error) {
2888
+ var _a;
2884
2889
  if (typeof error === "object" && error !== null) {
2885
2890
  if (this.countedFailures.has(error)) {
2886
2891
  return;
@@ -2892,10 +2897,11 @@ var init_http_file_transport = __esm({
2892
2897
  } else {
2893
2898
  this.telemetry.errorCount++;
2894
2899
  }
2900
+ (_a = this.onTelemetry) == null ? void 0 : _a.call(this, this.getTelemetry(), error);
2895
2901
  }
2896
2902
  /** Performs and validates one exact HTTP range request. */
2897
2903
  async requestRange(offset, length, signal, expectedIdentity) {
2898
- var _a;
2904
+ var _a, _b;
2899
2905
  const requestStartTime = getTimestamp2();
2900
2906
  const abortContext = createCombinedAbortContext(signal, (_a = this.fetchOptions) == null ? void 0 : _a.signal);
2901
2907
  this.telemetry.requestCount++;
@@ -2912,7 +2918,13 @@ var init_http_file_transport = __esm({
2912
2918
  await cancelResponse(response);
2913
2919
  throw new Error(`HTTP byte-range request expected 206, received ${response.status}`);
2914
2920
  }
2915
- const contentRange = await readContentRange(response);
2921
+ const contentRange = response.headers.has("Content-Range") ? await readContentRange(response) : await this.inferContentRange(
2922
+ response,
2923
+ offset,
2924
+ length,
2925
+ expectedIdentity,
2926
+ abortContext.signal
2927
+ );
2916
2928
  const responseIdentity = getResponseIdentity(response, contentRange.byteLength);
2917
2929
  const responseError = getIdentityError(
2918
2930
  expectedIdentity,
@@ -2946,6 +2958,45 @@ var init_http_file_transport = __esm({
2946
2958
  } finally {
2947
2959
  abortContext.removeAbortListeners();
2948
2960
  this.telemetry.networkTimeMs += getTimestamp2() - requestStartTime;
2961
+ (_b = this.onTelemetry) == null ? void 0 : _b.call(this, this.getTelemetry());
2962
+ }
2963
+ }
2964
+ /** Infers bounds for a CORS-filtered 206; the caller still validates the body length. */
2965
+ async inferContentRange(response, offset, length, expectedIdentity, signal) {
2966
+ var _a;
2967
+ try {
2968
+ let byteLength = (expectedIdentity == null ? void 0 : expectedIdentity.byteLength) ?? this.identityHints.byteLength;
2969
+ if (byteLength === void 0) {
2970
+ const headers = new Headers((_a = this.fetchOptions) == null ? void 0 : _a.headers);
2971
+ headers.delete("Range");
2972
+ this.telemetry.requestCount++;
2973
+ const metadata3 = await this.fetchFunction(this.url, {
2974
+ ...this.fetchOptions,
2975
+ method: "HEAD",
2976
+ body: void 0,
2977
+ headers,
2978
+ signal
2979
+ });
2980
+ await cancelResponse(metadata3);
2981
+ const value = metadata3.headers.get("Content-Length");
2982
+ byteLength = value && /^\d+$/.test(value) ? Number(value) : NaN;
2983
+ if (metadata3.status !== 200 || !Number.isSafeInteger(byteLength) || byteLength < offset + length) {
2984
+ throw new Error(
2985
+ "HTTP byte-range response is missing Content-Range and HEAD did not provide a valid file length"
2986
+ );
2987
+ }
2988
+ const identityError = getIdentityError(
2989
+ getResponseIdentity(metadata3, byteLength),
2990
+ getResponseIdentity(response, byteLength),
2991
+ this.identityHints,
2992
+ this.consistency
2993
+ );
2994
+ if (identityError) throw new Error(identityError);
2995
+ }
2996
+ return { offset, endOffset: offset + length - 1, byteLength };
2997
+ } catch (error) {
2998
+ await cancelResponse(response);
2999
+ throw error;
2949
3000
  }
2950
3001
  }
2951
3002
  /** Validates and consumes the special empty-object identity response. */
@@ -3195,7 +3246,7 @@ function getSourceLoaderOptions(options) {
3195
3246
  if (options == null ? void 0 : options.core) {
3196
3247
  loadOptions.core = { ...options.core };
3197
3248
  const parserCore = loadOptions.core;
3198
- for (const key of ["type", "attributions", "loaders", "onError", "loadOptions"]) {
3249
+ for (const key of ["type", "name", "attributions", "loaders", "onError", "loadOptions"]) {
3199
3250
  delete parserCore[key];
3200
3251
  }
3201
3252
  if (Object.keys(parserCore).length === 0) {
@@ -3230,6 +3281,44 @@ function unavailableCoreApiMethod(methodName) {
3230
3281
  );
3231
3282
  };
3232
3283
  }
3284
+ function getDataSourceName(data, options) {
3285
+ var _a, _b, _c;
3286
+ const explicitName = (_a = options.core) == null ? void 0 : _a.name;
3287
+ if (explicitName !== void 0) {
3288
+ if (typeof explicitName !== "string" || !explicitName.trim())
3289
+ throw new Error("Data source name must be a non-empty string.");
3290
+ return explicitName;
3291
+ }
3292
+ if (data && typeof data === "object") {
3293
+ const named = data;
3294
+ if (typeof named.name === "string" && named.name.trim())
3295
+ return data instanceof Blob ? removeFileExtension(named.name) : named.name;
3296
+ const metadata3 = (_b = named.schema) == null ? void 0 : _b.metadata;
3297
+ const embeddedName = metadata3 instanceof Map ? metadata3.get("name") : metadata3 == null ? void 0 : metadata3.name;
3298
+ if (typeof embeddedName === "string" && embeddedName.trim()) return embeddedName;
3299
+ }
3300
+ if (typeof data === "string") {
3301
+ try {
3302
+ const url = new URL(data.replace(/\\/g, "/"), "https://source.invalid/");
3303
+ if (!["data:", "blob:"].includes(url.protocol)) {
3304
+ let basename = url.pathname.split("/").filter(Boolean).pop();
3305
+ if (basename) {
3306
+ try {
3307
+ basename = decodeURIComponent(basename);
3308
+ } catch {
3309
+ }
3310
+ return removeFileExtension(basename);
3311
+ }
3312
+ }
3313
+ } catch {
3314
+ }
3315
+ }
3316
+ return ((_c = options.core) == null ? void 0 : _c.type) && options.core.type !== "auto" ? options.core.type : "source";
3317
+ }
3318
+ function removeFileExtension(name22) {
3319
+ const extension = name22.lastIndexOf(".");
3320
+ return extension > 0 ? name22.slice(0, extension) : name22;
3321
+ }
3233
3322
  var UNAVAILABLE_CORE_API, DataSource;
3234
3323
  var init_data_source = __esm({
3235
3324
  "../core/src/loader-utils/lib/sources/data-source.ts"() {
@@ -3261,6 +3350,8 @@ var init_data_source = __esm({
3261
3350
  options;
3262
3351
  data;
3263
3352
  url;
3353
+ /** Stable query-visible name, resolved without fetching source data. */
3354
+ name;
3264
3355
  /** Shared parser options derived from the source options, excluding source-only core controls. */
3265
3356
  loadOptions;
3266
3357
  /** A resolved fetch function extracted from the shared core options. */
@@ -3277,6 +3368,7 @@ var init_data_source = __esm({
3277
3368
  );
3278
3369
  this.data = data;
3279
3370
  this.url = typeof data === "string" ? resolvePath(data) : "";
3371
+ this.name = getDataSourceName(data, this.options);
3280
3372
  const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(this.options));
3281
3373
  this.loadOptions = loadOptions;
3282
3374
  const fetch2 = getFetchFunction(loadOptions);
@@ -3285,6 +3377,9 @@ var init_data_source = __esm({
3285
3377
  this.fetch = fetch2;
3286
3378
  }
3287
3379
  setProps(options) {
3380
+ var _a;
3381
+ if (((_a = options.core) == null ? void 0 : _a.name) !== void 0 && options.core.name !== this.name)
3382
+ throw new Error("Data source names are fixed at creation.");
3288
3383
  const mergedOptions = mergeOptions(this.options, options);
3289
3384
  const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(mergedOptions));
3290
3385
  this.options = mergedOptions;
@@ -27474,7 +27569,7 @@ var init_i3s_content_loader = __esm({
27474
27569
  "use strict";
27475
27570
  init_i3s_format();
27476
27571
  init_i3s_loader_options();
27477
- VERSION11 = true ? "5.0.0-beta.5" : "latest";
27572
+ VERSION11 = true ? "5.0.0-beta.6" : "latest";
27478
27573
  I3SContentLoader = {
27479
27574
  ...I3SContentFormat,
27480
27575
  dataType: null,
@@ -27503,7 +27598,7 @@ var init_i3s_node_page_loader = __esm({
27503
27598
  "dist/i3s/i3s-node-page-loader.js"() {
27504
27599
  "use strict";
27505
27600
  init_i3s_format();
27506
- VERSION12 = true ? "5.0.0-beta.5" : "latest";
27601
+ VERSION12 = true ? "5.0.0-beta.6" : "latest";
27507
27602
  I3SNodePageLoader = {
27508
27603
  ...I3SNodePageFormat,
27509
27604
  dataType: null,
@@ -28200,7 +28295,7 @@ var init_i3s_loader = __esm({
28200
28295
  init_i3s_format();
28201
28296
  init_i3s_content_loader();
28202
28297
  init_i3s_loader_options();
28203
- VERSION13 = true ? "5.0.0-beta.5" : "latest";
28298
+ VERSION13 = true ? "5.0.0-beta.6" : "latest";
28204
28299
  I3SLoader = {
28205
28300
  ...I3SFormat,
28206
28301
  dataType: null,
@@ -31167,7 +31262,7 @@ var init_i3s_slpk_loader = __esm({
31167
31262
  "dist/i3s/i3s-slpk-loader.js"() {
31168
31263
  "use strict";
31169
31264
  init_i3s_format();
31170
- VERSION15 = true ? "5.0.0-beta.5" : "latest";
31265
+ VERSION15 = true ? "5.0.0-beta.6" : "latest";
31171
31266
  SLPKLoader = {
31172
31267
  ...SLPKFormat,
31173
31268
  dataType: null,
@@ -31508,7 +31603,7 @@ var init_i3s_attribute_loader = __esm({
31508
31603
  "dist/i3s/i3s-attribute-loader.js"() {
31509
31604
  "use strict";
31510
31605
  init_i3s_format();
31511
- VERSION17 = true ? "5.0.0-beta.5" : "latest";
31606
+ VERSION17 = true ? "5.0.0-beta.6" : "latest";
31512
31607
  I3SAttributeLoader = {
31513
31608
  ...I3SAttributeFormat,
31514
31609
  dataType: null,
@@ -31600,7 +31695,7 @@ var init_i3s_building_scene_layer_loader = __esm({
31600
31695
  "dist/i3s/i3s-building-scene-layer-loader.js"() {
31601
31696
  "use strict";
31602
31697
  init_i3s_format();
31603
- VERSION18 = true ? "5.0.0-beta.5" : "latest";
31698
+ VERSION18 = true ? "5.0.0-beta.6" : "latest";
31604
31699
  I3SBuildingSceneLayerLoader = {
31605
31700
  ...I3SBuildingSceneLayerFormat,
31606
31701
  dataType: null,
@@ -31738,7 +31833,7 @@ var init_arcgis_webscene_loader = __esm({
31738
31833
  "dist/i3s/arcgis-webscene-loader.js"() {
31739
31834
  "use strict";
31740
31835
  init_i3s_format();
31741
- VERSION19 = true ? "5.0.0-beta.5" : "latest";
31836
+ VERSION19 = true ? "5.0.0-beta.6" : "latest";
31742
31837
  ArcGISWebSceneLoader = {
31743
31838
  ...ArcGISWebSceneFormat,
31744
31839
  dataType: null,
@@ -31918,7 +32013,7 @@ init_i3s_loader();
31918
32013
  // dist/i3s/i3s-slpk-writer.js
31919
32014
  init_indexed_zip_writer();
31920
32015
  init_i3s_format();
31921
- var VERSION14 = true ? "5.0.0-beta.5" : "latest";
32016
+ var VERSION14 = true ? "5.0.0-beta.6" : "latest";
31922
32017
  var MAX_ARCHIVE_BYTES = 2147483647;
31923
32018
  var SLPKWriter = {
31924
32019
  ...SLPKFormat,
@@ -31990,7 +32085,7 @@ init_i3s_content_loader();
31990
32085
 
31991
32086
  // dist/i3s/i3s-lepcc-loader-types.js
31992
32087
  init_i3s_format();
31993
- var VERSION16 = true ? "5.0.0-beta.5" : "latest";
32088
+ var VERSION16 = true ? "5.0.0-beta.6" : "latest";
31994
32089
  var I3SLEPCCLoader = {
31995
32090
  ...I3SLEPCCFormat,
31996
32091
  dataType: null,