@loaders.gl/splats 5.0.0-alpha.12 → 5.0.0-alpha.13

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/LICENSE +1 -1
  2. package/dist/dist.dev.js +233 -119
  3. package/dist/dist.min.js +16 -16
  4. package/dist/index.cjs +58 -41
  5. package/dist/index.cjs.map +3 -3
  6. package/dist/ksplat-loader-types.d.ts +1 -1
  7. package/dist/ksplat-loader-types.d.ts.map +1 -1
  8. package/dist/ksplat-loader-types.js +1 -1
  9. package/dist/ksplat-loader.d.ts +1 -1
  10. package/dist/ksplat-loader.d.ts.map +1 -1
  11. package/dist/lib/parse-ksplat.d.ts +1 -1
  12. package/dist/lib/parse-ksplat.d.ts.map +1 -1
  13. package/dist/lib/parse-rad-chunk.d.ts +1 -1
  14. package/dist/lib/parse-rad-chunk.d.ts.map +1 -1
  15. package/dist/lib/parse-splat.d.ts +1 -1
  16. package/dist/lib/parse-splat.d.ts.map +1 -1
  17. package/dist/lib/parse-spz.d.ts +1 -1
  18. package/dist/lib/parse-spz.d.ts.map +1 -1
  19. package/dist/lib/splats-arrow-table.d.ts +1 -1
  20. package/dist/lib/splats-arrow-table.d.ts.map +1 -1
  21. package/dist/rad-loader-types.js +1 -1
  22. package/dist/rad-source-loader.d.ts +3 -3
  23. package/dist/rad-source-loader.d.ts.map +1 -1
  24. package/dist/rad-source-loader.js +2 -2
  25. package/dist/rad-source-loader.js.map +1 -1
  26. package/dist/splat-loader-types.d.ts +1 -1
  27. package/dist/splat-loader-types.d.ts.map +1 -1
  28. package/dist/splat-loader-types.js +1 -1
  29. package/dist/splat-loader.d.ts +1 -1
  30. package/dist/splat-loader.d.ts.map +1 -1
  31. package/dist/spz-loader-types.d.ts +1 -1
  32. package/dist/spz-loader-types.d.ts.map +1 -1
  33. package/dist/spz-loader-types.js +1 -1
  34. package/dist/spz-loader.d.ts +1 -1
  35. package/dist/spz-loader.d.ts.map +1 -1
  36. package/dist/types.d.ts +1 -1
  37. package/dist/types.d.ts.map +1 -1
  38. package/package.json +3 -5
  39. package/src/ksplat-loader-types.ts +2 -2
  40. package/src/ksplat-loader.ts +2 -2
  41. package/src/lib/parse-ksplat.ts +1 -1
  42. package/src/lib/parse-rad-chunk.ts +1 -1
  43. package/src/lib/parse-splat.ts +1 -1
  44. package/src/lib/parse-spz.ts +1 -1
  45. package/src/lib/splats-arrow-table.ts +1 -1
  46. package/src/rad-loader-types.ts +1 -1
  47. package/src/rad-loader.ts +1 -1
  48. package/src/rad-source-loader.ts +3 -3
  49. package/src/splat-loader-types.ts +2 -2
  50. package/src/splat-loader.ts +2 -2
  51. package/src/splats-format.ts +1 -1
  52. package/src/spz-loader-types.ts +2 -2
  53. package/src/spz-loader.ts +2 -2
  54. package/src/types.ts +1 -1
package/dist/index.cjs CHANGED
@@ -81,7 +81,7 @@ var init_splats_format = __esm({
81
81
  }
82
82
  });
83
83
 
84
- // ../loader-utils/src/lib/log-utils/log.ts
84
+ // ../core/src/loader-utils/lib/log-utils/log.ts
85
85
  function createLog() {
86
86
  const log2 = new import_log.Log({ id: "loaders.gl" });
87
87
  globalThis.loaders ||= {};
@@ -93,26 +93,26 @@ function createLog() {
93
93
  }
94
94
  var import_log, VERSION, version, log;
95
95
  var init_log = __esm({
96
- "../loader-utils/src/lib/log-utils/log.ts"() {
96
+ "../core/src/loader-utils/lib/log-utils/log.ts"() {
97
97
  "use strict";
98
- import_log = require("@probe.gl/log");
98
+ import_log = require("probe.gl/log");
99
99
  VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
100
100
  version = VERSION[0] >= "0" && VERSION[0] <= "9" ? `v${VERSION}` : "";
101
101
  log = createLog();
102
102
  }
103
103
  });
104
104
 
105
- // ../loader-utils/src/lib/javascript-utils/is-type.ts
105
+ // ../core/src/loader-utils/lib/javascript-utils/is-type.ts
106
106
  var isObject, isPureObject;
107
107
  var init_is_type = __esm({
108
- "../loader-utils/src/lib/javascript-utils/is-type.ts"() {
108
+ "../core/src/loader-utils/lib/javascript-utils/is-type.ts"() {
109
109
  "use strict";
110
110
  isObject = (value) => value !== null && typeof value === "object";
111
111
  isPureObject = (value) => isObject(value) && value.constructor === {}.constructor;
112
112
  }
113
113
  });
114
114
 
115
- // ../loader-utils/src/lib/option-utils/merge-options.ts
115
+ // ../core/src/loader-utils/lib/option-utils/merge-options.ts
116
116
  function mergeOptions(baseOptions, newOptions) {
117
117
  return mergeOptionsRecursively(baseOptions || {}, newOptions);
118
118
  }
@@ -135,25 +135,25 @@ function mergeOptionsRecursively(baseOptions, newOptions, level = 0) {
135
135
  return options;
136
136
  }
137
137
  var init_merge_options = __esm({
138
- "../loader-utils/src/lib/option-utils/merge-options.ts"() {
138
+ "../core/src/loader-utils/lib/option-utils/merge-options.ts"() {
139
139
  "use strict";
140
140
  init_is_type();
141
141
  }
142
142
  });
143
143
 
144
- // ../loader-utils/src/lib/module-utils/js-module-utils.ts
144
+ // ../core/src/loader-utils/lib/module-utils/js-module-utils.ts
145
145
  function registerJSModules(modules) {
146
146
  globalThis.loaders ||= {};
147
147
  globalThis.loaders.modules ||= {};
148
148
  Object.assign(globalThis.loaders.modules, modules);
149
149
  }
150
150
  var init_js_module_utils = __esm({
151
- "../loader-utils/src/lib/module-utils/js-module-utils.ts"() {
151
+ "../core/src/loader-utils/lib/module-utils/js-module-utils.ts"() {
152
152
  "use strict";
153
153
  }
154
154
  });
155
155
 
156
- // ../loader-utils/src/lib/binary-utils/array-buffer-utils.ts
156
+ // ../core/src/loader-utils/lib/binary-utils/array-buffer-utils.ts
157
157
  function concatenateArrayBuffers(...sources) {
158
158
  return concatenateArrayBuffersFromArray(sources);
159
159
  }
@@ -171,12 +171,12 @@ function concatenateArrayBuffersFromArray(sources) {
171
171
  return result.buffer;
172
172
  }
173
173
  var init_array_buffer_utils = __esm({
174
- "../loader-utils/src/lib/binary-utils/array-buffer-utils.ts"() {
174
+ "../core/src/loader-utils/lib/binary-utils/array-buffer-utils.ts"() {
175
175
  "use strict";
176
176
  }
177
177
  });
178
178
 
179
- // ../loader-utils/src/lib/iterators/async-iteration.ts
179
+ // ../core/src/loader-utils/lib/iterators/async-iteration.ts
180
180
  async function concatenateArrayBuffersAsync(asyncIterator) {
181
181
  const arrayBuffers = [];
182
182
  for await (const chunk of asyncIterator) {
@@ -201,13 +201,13 @@ function copyFromBuffer(buffer, byteOffset = 0, byteLength = buffer.byteLength -
201
201
  return copy.buffer;
202
202
  }
203
203
  var init_async_iteration = __esm({
204
- "../loader-utils/src/lib/iterators/async-iteration.ts"() {
204
+ "../core/src/loader-utils/lib/iterators/async-iteration.ts"() {
205
205
  "use strict";
206
206
  init_array_buffer_utils();
207
207
  }
208
208
  });
209
209
 
210
- // ../loader-utils/src/lib/request-utils/authentication.ts
210
+ // ../core/src/loader-utils/lib/request-utils/authentication.ts
211
211
  function resolveCredentials(credentials, authentications = []) {
212
212
  if (credentials.every(isAuthentication)) return credentials;
213
213
  return credentials.map((credential, index) => {
@@ -244,12 +244,12 @@ function isAuthentication(credential) {
244
244
  return (credential.type === "header" || credential.type === "query-parameter") && typeof credential.name === "string" && (typeof credential.token === "string" || typeof credential.token === "function") && Array.isArray(credential.refreshStatusCodes);
245
245
  }
246
246
  var init_authentication = __esm({
247
- "../loader-utils/src/lib/request-utils/authentication.ts"() {
247
+ "../core/src/loader-utils/lib/request-utils/authentication.ts"() {
248
248
  "use strict";
249
249
  }
250
250
  });
251
251
 
252
- // ../loader-utils/src/lib/request-utils/request-credentials.ts
252
+ // ../core/src/loader-utils/lib/request-utils/request-credentials.ts
253
253
  function createAuthenticatedFetch(options) {
254
254
  const suppliedFetch = options.fetch || ((url, requestOptions) => fetch(url, requestOptions));
255
255
  const existingMetadata = suppliedFetch[AUTHENTICATED_FETCH];
@@ -479,7 +479,7 @@ function createAbortError() {
479
479
  }
480
480
  var AUTHENTICATED_FETCH, refreshPromises;
481
481
  var init_request_credentials = __esm({
482
- "../loader-utils/src/lib/request-utils/request-credentials.ts"() {
482
+ "../core/src/loader-utils/lib/request-utils/request-credentials.ts"() {
483
483
  "use strict";
484
484
  init_authentication();
485
485
  AUTHENTICATED_FETCH = /* @__PURE__ */ Symbol("loaders.gl.authenticated-fetch");
@@ -487,7 +487,7 @@ var init_request_credentials = __esm({
487
487
  }
488
488
  });
489
489
 
490
- // ../loader-utils/src/lib/path-utils/file-aliases.ts
490
+ // ../core/src/loader-utils/lib/path-utils/file-aliases.ts
491
491
  function resolvePath(filename) {
492
492
  for (const alias in fileAliases) {
493
493
  if (filename.startsWith(alias)) {
@@ -502,14 +502,14 @@ function resolvePath(filename) {
502
502
  }
503
503
  var pathPrefix, fileAliases;
504
504
  var init_file_aliases = __esm({
505
- "../loader-utils/src/lib/path-utils/file-aliases.ts"() {
505
+ "../core/src/loader-utils/lib/path-utils/file-aliases.ts"() {
506
506
  "use strict";
507
507
  pathPrefix = "";
508
508
  fileAliases = {};
509
509
  }
510
510
  });
511
511
 
512
- // ../loader-utils/src/lib/sources/data-source.ts
512
+ // ../core/src/loader-utils/lib/sources/data-source.ts
513
513
  function getFetchFunction(options) {
514
514
  return getAuthenticatedFetch(options);
515
515
  }
@@ -561,7 +561,7 @@ function unavailableCoreApiMethod(methodName) {
561
561
  }
562
562
  var UNAVAILABLE_CORE_API, DataSource;
563
563
  var init_data_source = __esm({
564
- "../loader-utils/src/lib/sources/data-source.ts"() {
564
+ "../core/src/loader-utils/lib/sources/data-source.ts"() {
565
565
  "use strict";
566
566
  init_merge_options();
567
567
  init_file_aliases();
@@ -652,9 +652,9 @@ var init_data_source = __esm({
652
652
  }
653
653
  });
654
654
 
655
- // ../loader-utils/src/index.ts
656
- var init_src = __esm({
657
- "../loader-utils/src/index.ts"() {
655
+ // ../core/src/loader-utils/index.ts
656
+ var init_loader_utils = __esm({
657
+ "../core/src/loader-utils/index.ts"() {
658
658
  "use strict";
659
659
  init_js_module_utils();
660
660
  init_async_iteration();
@@ -667,7 +667,7 @@ var CompressionTransform, Decompressor;
667
667
  var init_compression = __esm({
668
668
  "../compression/src/lib/compression.ts"() {
669
669
  "use strict";
670
- init_src();
670
+ init_loader_utils();
671
671
  CompressionTransform = class {
672
672
  /** Preloads any dynamic libraries. May enable sync functions */
673
673
  async preload(modules = {}) {
@@ -926,13 +926,19 @@ var init_lazy_compression = __esm({
926
926
  });
927
927
 
928
928
  // ../compression/src/lib/compress-utils-compression.ts
929
- async function* transformBatches(stream, inputBatches) {
929
+ async function* transformBatches(stream, inputBatches, maximumOutputByteLength = Number.POSITIVE_INFINITY) {
930
+ let outputByteLength = 0;
930
931
  try {
931
932
  for await (const input of inputBatches) {
932
933
  const output2 = stream.write(new Uint8Array(input));
934
+ if (output2.byteLength > maximumOutputByteLength - outputByteLength)
935
+ throw new RangeError("Decompressed output exceeds maxOutputByteLength");
936
+ outputByteLength += output2.byteLength;
933
937
  if (output2.byteLength > 0) yield copyArrayBuffer(output2);
934
938
  }
935
939
  const output = stream.finish();
940
+ if (output.byteLength > maximumOutputByteLength - outputByteLength)
941
+ throw new RangeError("Decompressed output exceeds maxOutputByteLength");
936
942
  if (output.byteLength > 0) yield copyArrayBuffer(output);
937
943
  } finally {
938
944
  stream.destroy();
@@ -947,14 +953,23 @@ function getDecompressOptions(options, size) {
947
953
  ...size === void 0 ? {} : { expectedSize: size }
948
954
  };
949
955
  const capacity = decodeOptions.expectedSize;
950
- const maximum = options.maxOutputByteLength ?? 512 * 1024 * 1024;
951
- if (!Number.isSafeInteger(maximum) || maximum < 0 || maximum > 2147483647)
952
- throw new RangeError("Invalid maxOutputByteLength");
956
+ const maximum = getMaximumOutputByteLength(options);
953
957
  if (capacity !== void 0 && (!Number.isSafeInteger(capacity) || capacity < 0 || capacity > maximum)) {
954
958
  throw new RangeError("expectedSize exceeds the configured output capacity limit");
955
959
  }
956
960
  return decodeOptions;
957
961
  }
962
+ function getMaximumOutputByteLength(options) {
963
+ const maximum = options.maxOutputByteLength ?? 512 * 1024 * 1024;
964
+ if (!Number.isSafeInteger(maximum) || maximum < 0 || maximum > 2147483647)
965
+ throw new RangeError("Invalid maxOutputByteLength");
966
+ return maximum;
967
+ }
968
+ function copyDecompressedOutput(bytes, options) {
969
+ if (bytes.byteLength > getMaximumOutputByteLength(options))
970
+ throw new RangeError("Decompressed output exceeds maxOutputByteLength");
971
+ return copyArrayBuffer(bytes);
972
+ }
958
973
  var CompressUtilsDecompressor;
959
974
  var init_compress_utils_compression = __esm({
960
975
  "../compression/src/lib/compress-utils-compression.ts"() {
@@ -1000,8 +1015,9 @@ var init_compress_utils_compression = __esm({
1000
1015
  var _a;
1001
1016
  if (!((_a = this.module) == null ? void 0 : _a.decompressSync))
1002
1017
  throw new Error(`${this.name}: call preload() before decompressSync()`);
1003
- return copyArrayBuffer(
1004
- this.module.decompressSync(new Uint8Array(input), getDecompressOptions(this.options, size))
1018
+ return copyDecompressedOutput(
1019
+ this.module.decompressSync(new Uint8Array(input), getDecompressOptions(this.options, size)),
1020
+ this.options
1005
1021
  );
1006
1022
  }
1007
1023
  /** Decompresses one buffer with the selected compress-utils decoder. */
@@ -1010,7 +1026,7 @@ var init_compress_utils_compression = __esm({
1010
1026
  await this.preload();
1011
1027
  const module2 = this.module;
1012
1028
  const output = await module2.decompress(new Uint8Array(input), decodeOptions);
1013
- return copyArrayBuffer(output);
1029
+ return copyDecompressedOutput(output, this.options);
1014
1030
  }
1015
1031
  /** Incrementally decompresses input batches with compress-utils. */
1016
1032
  async *decompressBatches(inputBatches) {
@@ -1020,8 +1036,9 @@ var init_compress_utils_compression = __esm({
1020
1036
  yield await this.decompress(await this.concatenate(inputBatches));
1021
1037
  return;
1022
1038
  }
1039
+ const maximum = getMaximumOutputByteLength(this.options);
1023
1040
  const stream = await module2.createDecompressStream();
1024
- yield* transformBatches(stream, inputBatches);
1041
+ yield* transformBatches(stream, inputBatches, maximum);
1025
1042
  }
1026
1043
  };
1027
1044
  }
@@ -1165,7 +1182,7 @@ var init_default_codecs = __esm({
1165
1182
  });
1166
1183
 
1167
1184
  // ../compression/src/index.ts
1168
- var init_src2 = __esm({
1185
+ var init_src = __esm({
1169
1186
  "../compression/src/index.ts"() {
1170
1187
  "use strict";
1171
1188
  init_default_codecs();
@@ -1703,7 +1720,7 @@ var SPZ_HEADER_BYTE_LENGTH, SPZ_MAGIC, SPZ_VERSION, SPZ_EXTENSION_FLAG, SPZ_COLO
1703
1720
  var init_parse_spz = __esm({
1704
1721
  "dist/lib/parse-spz.js"() {
1705
1722
  "use strict";
1706
- init_src2();
1723
+ init_src();
1707
1724
  init_splats_arrow_table();
1708
1725
  init_splat_utils();
1709
1726
  SPZ_HEADER_BYTE_LENGTH = 32;
@@ -1806,7 +1823,7 @@ var init_splat_loader_types = __esm({
1806
1823
  "dist/splat-loader-types.js"() {
1807
1824
  "use strict";
1808
1825
  init_splats_format();
1809
- VERSION2 = true ? "5.0.0-alpha.12" : "latest";
1826
+ VERSION2 = true ? "5.0.0-alpha.13" : "latest";
1810
1827
  SPLATLoader = {
1811
1828
  dataType: null,
1812
1829
  batchType: null,
@@ -2131,7 +2148,7 @@ var init_ksplat_loader_types = __esm({
2131
2148
  "dist/ksplat-loader-types.js"() {
2132
2149
  "use strict";
2133
2150
  init_splats_format();
2134
- VERSION3 = true ? "5.0.0-alpha.12" : "latest";
2151
+ VERSION3 = true ? "5.0.0-alpha.13" : "latest";
2135
2152
  KSPLATLoader = {
2136
2153
  dataType: null,
2137
2154
  batchType: null,
@@ -2176,7 +2193,7 @@ var init_spz_loader_types = __esm({
2176
2193
  "dist/spz-loader-types.js"() {
2177
2194
  "use strict";
2178
2195
  init_splats_format();
2179
- VERSION4 = true ? "5.0.0-alpha.12" : "latest";
2196
+ VERSION4 = true ? "5.0.0-alpha.13" : "latest";
2180
2197
  SPZLoader = {
2181
2198
  dataType: null,
2182
2199
  batchType: null,
@@ -2917,7 +2934,7 @@ var init_rad_loader_types = __esm({
2917
2934
  "dist/rad-loader-types.js"() {
2918
2935
  "use strict";
2919
2936
  init_splats_format();
2920
- VERSION5 = true ? "5.0.0-alpha.12" : "latest";
2937
+ VERSION5 = true ? "5.0.0-alpha.13" : "latest";
2921
2938
  RADLoader = {
2922
2939
  dataType: null,
2923
2940
  batchType: null,
@@ -2955,14 +2972,14 @@ init_spz_loader_types();
2955
2972
  init_rad_loader_types();
2956
2973
 
2957
2974
  // dist/rad-source-loader.js
2958
- init_src();
2975
+ init_loader_utils();
2959
2976
  init_splats_format();
2960
2977
  init_parse_rad();
2961
2978
  init_parse_rad_chunk();
2962
2979
  init_splats_arrow_table();
2963
2980
  var DEFAULT_RAD_HEADER_BYTE_LENGTHS = [64 * 1024, 256 * 1024, 1024 * 1024];
2964
2981
  var DEFAULT_RAD_MAX_CONCURRENT_CHUNK_REQUESTS = 4;
2965
- var VERSION6 = true ? "5.0.0-alpha.12" : "latest";
2982
+ var VERSION6 = true ? "5.0.0-alpha.13" : "latest";
2966
2983
  var RADSourceLoader = {
2967
2984
  dataType: null,
2968
2985
  batchType: null,