@loaders.gl/ogc 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.
@@ -4,7 +4,7 @@
4
4
  import { CSWCapabilitiesFormat } from "./wms-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
  /** Preloads the parser-bearing CSW capabilities loader implementation. */
9
9
  async function preload() {
10
10
  const { CSWCapabilitiesLoaderWithParser } = await import("./csw-capabilities-loader-with-parser.js");
@@ -4,7 +4,7 @@
4
4
  import { CSWDomainFormat } from "./wms-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
  /** Preloads the parser-bearing CSW domain loader implementation. */
9
9
  async function preload() {
10
10
  const { CSWDomainLoaderWithParser } = await import("./csw-domain-loader-with-parser.js");
@@ -4,7 +4,7 @@
4
4
  import { CSWRecordsFormat } from "./wms-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
  /** Preloads the parser-bearing CSW records loader implementation. */
9
9
  async function preload() {
10
10
  const { CSWRecordsLoaderWithParser } = await import("./csw-records-loader-with-parser.js");
@@ -8,7 +8,7 @@ import { CSWDomainLoaderWithParser } from "./csw-domain-loader-with-parser.js";
8
8
  import { WMSErrorLoaderWithParser } from "./wms-error-loader-with-parser.js";
9
9
  // __VERSION__ is injected by babel-plugin-version-inline
10
10
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
11
- const VERSION = typeof "5.0.0-beta.5" !== 'undefined' ? "5.0.0-beta.5" : 'latest';
11
+ const VERSION = typeof "5.0.0-beta.6" !== 'undefined' ? "5.0.0-beta.6" : 'latest';
12
12
  export const CSWSourceLoader = {
13
13
  dataType: null,
14
14
  batchType: null,
@@ -4,7 +4,7 @@
4
4
  import { GMLFormat } from "./wms-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
  /** Preloads the parser-bearing GML loader implementation. */
9
9
  async function preload() {
10
10
  const { GMLLoaderWithParser } = await import('@loaders.gl/ogc/gml-loader');
@@ -1865,7 +1865,7 @@ var init_csw_capabilities_loader = __esm({
1865
1865
  "dist/wms/csw-capabilities-loader.js"() {
1866
1866
  "use strict";
1867
1867
  init_wms_format();
1868
- VERSION2 = true ? "5.0.0-beta.5" : "latest";
1868
+ VERSION2 = true ? "5.0.0-beta.6" : "latest";
1869
1869
  CSWCapabilitiesLoader = {
1870
1870
  ...CSWCapabilitiesFormat,
1871
1871
  dataType: null,
@@ -1953,7 +1953,7 @@ var init_csw_domain_loader = __esm({
1953
1953
  "dist/wms/csw-domain-loader.js"() {
1954
1954
  "use strict";
1955
1955
  init_wms_format();
1956
- VERSION3 = true ? "5.0.0-beta.5" : "latest";
1956
+ VERSION3 = true ? "5.0.0-beta.6" : "latest";
1957
1957
  CSWDomainLoader = {
1958
1958
  ...CSWDomainFormat,
1959
1959
  dataType: null,
@@ -2084,7 +2084,7 @@ var init_csw_records_loader = __esm({
2084
2084
  "dist/wms/csw-records-loader.js"() {
2085
2085
  "use strict";
2086
2086
  init_wms_format();
2087
- VERSION4 = true ? "5.0.0-beta.5" : "latest";
2087
+ VERSION4 = true ? "5.0.0-beta.6" : "latest";
2088
2088
  CSWRecordsLoader = {
2089
2089
  ...CSWRecordsFormat,
2090
2090
  dataType: null,
@@ -2171,7 +2171,7 @@ var init_wms_error_loader = __esm({
2171
2171
  "dist/wms/wms-error-loader.js"() {
2172
2172
  "use strict";
2173
2173
  init_wms_format();
2174
- VERSION5 = true ? "5.0.0-beta.5" : "latest";
2174
+ VERSION5 = true ? "5.0.0-beta.6" : "latest";
2175
2175
  WMSErrorLoader = {
2176
2176
  ...WMSErrorFormat,
2177
2177
  dataType: null,
@@ -2494,7 +2494,7 @@ var init_wms_capabilities_loader = __esm({
2494
2494
  "dist/wms/wms-capabilities-loader.js"() {
2495
2495
  "use strict";
2496
2496
  init_wms_format();
2497
- VERSION6 = true ? "5.0.0-beta.5" : "latest";
2497
+ VERSION6 = true ? "5.0.0-beta.6" : "latest";
2498
2498
  WMSCapabilitiesLoader = {
2499
2499
  ...WMSCapabilitiesFormat,
2500
2500
  dataType: null,
@@ -2995,7 +2995,7 @@ var init_wfs_capabilities_loader = __esm({
2995
2995
  "dist/wms/wfs-capabilities-loader.js"() {
2996
2996
  "use strict";
2997
2997
  init_wms_format();
2998
- VERSION7 = true ? "5.0.0-beta.5" : "latest";
2998
+ VERSION7 = true ? "5.0.0-beta.6" : "latest";
2999
2999
  WFSCapabilitiesLoader = {
3000
3000
  ...WFSCapabilitiesFormat,
3001
3001
  dataType: null,
@@ -3032,7 +3032,7 @@ var init_gml_loader_types = __esm({
3032
3032
  "dist/wms/gml-loader-types.js"() {
3033
3033
  "use strict";
3034
3034
  init_wms_format();
3035
- VERSION8 = true ? "5.0.0-beta.5" : "latest";
3035
+ VERSION8 = true ? "5.0.0-beta.6" : "latest";
3036
3036
  GMLLoader = {
3037
3037
  ...GMLFormat,
3038
3038
  dataType: null,
@@ -3480,7 +3480,7 @@ function getSourceLoaderOptions(options) {
3480
3480
  if (options == null ? void 0 : options.core) {
3481
3481
  loadOptions.core = { ...options.core };
3482
3482
  const parserCore = loadOptions.core;
3483
- for (const key of ["type", "attributions", "loaders", "onError", "loadOptions"]) {
3483
+ for (const key of ["type", "name", "attributions", "loaders", "onError", "loadOptions"]) {
3484
3484
  delete parserCore[key];
3485
3485
  }
3486
3486
  if (Object.keys(parserCore).length === 0) {
@@ -3515,6 +3515,44 @@ function unavailableCoreApiMethod(methodName) {
3515
3515
  );
3516
3516
  };
3517
3517
  }
3518
+ function getDataSourceName(data, options) {
3519
+ var _a2, _b, _c;
3520
+ const explicitName = (_a2 = options.core) == null ? void 0 : _a2.name;
3521
+ if (explicitName !== void 0) {
3522
+ if (typeof explicitName !== "string" || !explicitName.trim())
3523
+ throw new Error("Data source name must be a non-empty string.");
3524
+ return explicitName;
3525
+ }
3526
+ if (data && typeof data === "object") {
3527
+ const named = data;
3528
+ if (typeof named.name === "string" && named.name.trim())
3529
+ return data instanceof Blob ? removeFileExtension(named.name) : named.name;
3530
+ const metadata2 = (_b = named.schema) == null ? void 0 : _b.metadata;
3531
+ const embeddedName = metadata2 instanceof Map ? metadata2.get("name") : metadata2 == null ? void 0 : metadata2.name;
3532
+ if (typeof embeddedName === "string" && embeddedName.trim()) return embeddedName;
3533
+ }
3534
+ if (typeof data === "string") {
3535
+ try {
3536
+ const url = new URL(data.replace(/\\/g, "/"), "https://source.invalid/");
3537
+ if (!["data:", "blob:"].includes(url.protocol)) {
3538
+ let basename = url.pathname.split("/").filter(Boolean).pop();
3539
+ if (basename) {
3540
+ try {
3541
+ basename = decodeURIComponent(basename);
3542
+ } catch {
3543
+ }
3544
+ return removeFileExtension(basename);
3545
+ }
3546
+ }
3547
+ } catch {
3548
+ }
3549
+ }
3550
+ return ((_c = options.core) == null ? void 0 : _c.type) && options.core.type !== "auto" ? options.core.type : "source";
3551
+ }
3552
+ function removeFileExtension(name) {
3553
+ const extension = name.lastIndexOf(".");
3554
+ return extension > 0 ? name.slice(0, extension) : name;
3555
+ }
3518
3556
  var UNAVAILABLE_CORE_API, DataSource;
3519
3557
  var init_data_source = __esm({
3520
3558
  "../core/src/loader-utils/lib/sources/data-source.ts"() {
@@ -3546,6 +3584,8 @@ var init_data_source = __esm({
3546
3584
  options;
3547
3585
  data;
3548
3586
  url;
3587
+ /** Stable query-visible name, resolved without fetching source data. */
3588
+ name;
3549
3589
  /** Shared parser options derived from the source options, excluding source-only core controls. */
3550
3590
  loadOptions;
3551
3591
  /** A resolved fetch function extracted from the shared core options. */
@@ -3562,6 +3602,7 @@ var init_data_source = __esm({
3562
3602
  );
3563
3603
  this.data = data;
3564
3604
  this.url = typeof data === "string" ? resolvePath(data) : "";
3605
+ this.name = getDataSourceName(data, this.options);
3565
3606
  const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(this.options));
3566
3607
  this.loadOptions = loadOptions;
3567
3608
  const fetch2 = getFetchFunction(loadOptions);
@@ -3570,6 +3611,9 @@ var init_data_source = __esm({
3570
3611
  this.fetch = fetch2;
3571
3612
  }
3572
3613
  setProps(options) {
3614
+ var _a2;
3615
+ if (((_a2 = options.core) == null ? void 0 : _a2.name) !== void 0 && options.core.name !== this.name)
3616
+ throw new Error("Data source names are fixed at creation.");
3573
3617
  const mergedOptions = mergeOptions(this.options, options);
3574
3618
  const loadOptions = resolveAuthenticationOptions(getSourceLoaderOptions(mergedOptions));
3575
3619
  this.options = mergedOptions;
@@ -7817,7 +7861,7 @@ init_csw_capabilities_loader_with_parser();
7817
7861
  init_csw_records_loader_with_parser();
7818
7862
  init_csw_domain_loader_with_parser();
7819
7863
  init_wms_error_loader_with_parser();
7820
- var VERSION10 = true ? "5.0.0-beta.5" : "latest";
7864
+ var VERSION10 = true ? "5.0.0-beta.6" : "latest";
7821
7865
  var CSWSourceLoader = {
7822
7866
  dataType: null,
7823
7867
  batchType: null,