@walkthru-earth/objex-utils 1.4.0 → 1.5.0

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.
package/dist/index.d.cts CHANGED
@@ -32,6 +32,12 @@ declare const VIEWER_DIR_EXTENSIONS: Set<string>;
32
32
  declare const LAYER_HUE_MULTIPLIER = 137;
33
33
  /** Duration (ms) to show "Copied!" feedback before resetting. */
34
34
  declare const COPY_FEEDBACK_MS = 2000;
35
+ /** Region assumed when a connection or bucket name yields none. AWS's global default. */
36
+ declare const DEFAULT_AWS_REGION = "us-east-1";
37
+ /** deck.gl tile-layer debounce (ms) before fetching after a viewport change. */
38
+ declare const TILE_DEBOUNCE_MS = 200;
39
+ /** Zoom level used when flying to the first feature of a vector dataset. */
40
+ declare const FIRST_FEATURE_FLY_ZOOM = 14;
35
41
 
36
42
  /**
37
43
  * Centralized file type detection module.
@@ -891,6 +897,12 @@ declare function connectionIdentityKey(input: ConnectionIdentityInput): string;
891
897
  /** Convenience: true when both inputs share the same non-empty identity. */
892
898
  declare function isSameConnectionIdentity(a: ConnectionIdentityInput, b: ConnectionIdentityInput): boolean;
893
899
 
900
+ /**
901
+ * True when the given CRS is WGS84 lon/lat (no ST_Transform needed).
902
+ * Accepts a numeric EPSG code or a string like "EPSG:4326" / "OGC:CRS84".
903
+ */
904
+ declare function isWgs84(crs: number | string | null | undefined): boolean;
905
+
894
906
  /**
895
907
  * Shared error handling for async viewer load operations.
896
908
  */
@@ -2257,4 +2269,4 @@ declare function findGeoColumnFromRows(rows: Record<string, unknown>[], schema:
2257
2269
  type: string;
2258
2270
  }[]): string | null;
2259
2271
 
2260
- export { type AccessMode, type AccessModeInput, type AppConfig, type AppConfigDefaults, type AppConfigUi, type AttachPixelInspectorOptions, type BandMap, type BandSlot, type BasemapConfig, COPY_FEEDBACK_MS, type ChannelComposite, type ChannelRef, type CogAsset, type CogInfo, type Connection, type ConnectionConfig, type ConnectionIdentityInput, type ConnectionSeed, DATETIME_HISTOGRAM_BINS, DATETIME_HISTOGRAM_BINS_MAX, DEFAULT_APP_CONFIG, DEFAULT_TARGET_CRS, DUCKDB_INIT_TIMEOUT_MS, type DatetimeFacet, type DatetimeGranularity, type Defaults, type DetectedHost, type DuckDbReadFn, type EnumFacet, type EnumFacetField, type Facet, type FacetSet, type FacetSort, type FacetState, type FileCategory, type FileEntry, type FileTypeInfo, type GeoArrowGeomType, type GeoArrowResult, type GeoBounds, type GeoColumnMeta, type GeoParquetMeta, type GeoType, type GeometryTypeInfo, type HexRow, type HydrateOptions, type HydrateResult, LAYER_HUE_MULTIPLIER, type ListPage, LruCache, type LruCacheOptions, MAX_QUERY_HISTORY_ENTRIES, type MapLike, type MapQueryHandle, type MapQueryResult, MarkdownSqlContext, type MosaicSourceMeta, type NotebookConfig, type NotebookMeta, type NumericFacet, type NumericFacetField, PRESETS, PROVIDERS, PROVIDER_IDS, type ParquetFileMetadata, type ParsedGeometry, type ParsedMarkdownDocument, type ParsedStorageUrl, type PixelInspectCallbacks, type PixelInspectClickEvent, type PixelInspectClickHandler, type PixelInspectProbe, type PixelInspectProbeRequest, type PresetDef, type ProviderDef, type ProviderId, type ProviderRegion, QueryCancelledError, type QueryEngine, type QueryHandle, type QueryResult, type QuerySource, type RasterBandAsset, SF_LABELS, SQL_PREVIEW_LENGTH, STAC_API_PATH_RE, STAC_COG_ASSET_KEYS, STAC_GEOPARQUET_REQUIRED_COLUMNS, STORAGE_KEYS, type SchemaField, type SmokeTestResult, type SortConfig, type SortDirection, type SortField, type SqlBlock, type StacApiCapabilities, type StacApiSourceDeps, type StacAsset, type StacBboxStruct, type StacCatalog, type StacCollection, type StacFeatureCollection, type StacGeoparquetRow, type StacGeoparquetSchemaColumn, type StacItem, type StacItemView, type StacItemsQuery, type StacLink, type StacNativeQuery, type StacRoutableKind, type StacRowToItemOptions, type StacSource, type StacSourceBatch, type StacSourceCapabilities, type StacSourceKind, type StacSourceRequest, type StacStaticSourceDeps, type StorageAdapter, type StorageExtensionVersion, type StorageHints, type StorageProvider, type Tab, type Theme, type ToNativeQueryOptions, type TypeCategory, UrlAdapter, type UrlClassification, VIEWER_DIR_EXTENSIONS, type ViewerKind, WGS84_CODES, type WriteResult, absolutizeHref, allChannelsBand0, applyFacets, applyPreset, applyStacItemStorageHints, applyStorageHintsToConnection, attachPixelInspector, availablePresets, buildDataTypeLabel, buildDuckDbSource, buildEndpointFromTemplate, buildFacets, buildGeoArrowTables, buildMosaicSourceMeta, buildProviderBaseUrl, buildTransformExpr, clampBounds, classifyStac, classifyType, classifyUrl, coerceBool, coercePositiveInt, coerceString, coerceTheme, compositeFromUrl, compositeToUrl, connectionIdentityKey, copyToClipboard, createApiSource, createStaticSource, describeParseResult, detectHostBucket, detectMosaicCapable, detectMultiCogCapable, detectStorageExtensionVersion, emptyFacetState, emptyPushdown, emptyStorageHints, escapeCsvField, exportToCsv, exportToJson, extractBounds, extractCogAssets, extractEpsgFromGeoMeta, extractGeometryTypes, extractItemView, extractMosaicAssets, extractRasterBandAssets, extractSentinelBandAssets, extractStorageHints, findGeoColumn, findGeoColumnFromRows, flattenStacBbox, formatDate, formatFileSize, formatValue, generateHexDump, getAccessMode, getDuckDbReadFn, getFileExtension, getFileTypeInfo, getMimeType, getNativeScheme, getProvider, getViewerKind, handleLoadError, hasActiveFilters, hasCompositableBands, hasRgbBands, hasStacItemsEndpoint, hydrateStacItems, interpolateTemplates, isAbortError, isCloudNativeFormat, isGcsProvider, isKnownBucketHost, isPubliclyStreamable, isQueryable, isSameConnectionIdentity, isSingleAssetComposite, isStacCatalog, isStacCollection, isStacFeatureCollection, isStacGeoparquetSchema, isStacItem, isWgs84Crs, jsonReplacerBigInt, loadFromStorage, looksLikeUrl, markSqlBlocks, mergeAppConfig, normalizeEndpoint, normalizeGeomType, normalizeProvider, parseGeometryTypeCrs, parseMarkdownDocument, parseStorageUrl, parseVisibilityParam, parseWKB, persistToStorage, pickCogAssetHref, pickGranularity, pickNaturalColorComposite, pickStacPrimaryAsset, presetMatchesComposite, readParquetMetadata, renderNotebook, residualState, resolveBandSlotAssetKey, resolveBasemap, resolveCloudUrl, resolvePresetComposite, resolveProviderEndpoint, resolveSetting, resolveStacAssetHref, safeClamp, safeDecodeURIComponent, serializeToCsv, serializeToJson, smokeTestHref, sniffApiCapabilities, sortFileEntries, sortViews, spatialCellKey, stacItemBbox, stacRowToItem, syntheticSelfAsset, toBinary, toCql2Filter, toNativeQuery, toggleSortField, typeBadgeClass, typeColor, typeLabel, wireCodeCopyButtons, wrapWkbWithCrs };
2272
+ export { type AccessMode, type AccessModeInput, type AppConfig, type AppConfigDefaults, type AppConfigUi, type AttachPixelInspectorOptions, type BandMap, type BandSlot, type BasemapConfig, COPY_FEEDBACK_MS, type ChannelComposite, type ChannelRef, type CogAsset, type CogInfo, type Connection, type ConnectionConfig, type ConnectionIdentityInput, type ConnectionSeed, DATETIME_HISTOGRAM_BINS, DATETIME_HISTOGRAM_BINS_MAX, DEFAULT_APP_CONFIG, DEFAULT_AWS_REGION, DEFAULT_TARGET_CRS, DUCKDB_INIT_TIMEOUT_MS, type DatetimeFacet, type DatetimeGranularity, type Defaults, type DetectedHost, type DuckDbReadFn, type EnumFacet, type EnumFacetField, FIRST_FEATURE_FLY_ZOOM, type Facet, type FacetSet, type FacetSort, type FacetState, type FileCategory, type FileEntry, type FileTypeInfo, type GeoArrowGeomType, type GeoArrowResult, type GeoBounds, type GeoColumnMeta, type GeoParquetMeta, type GeoType, type GeometryTypeInfo, type HexRow, type HydrateOptions, type HydrateResult, LAYER_HUE_MULTIPLIER, type ListPage, LruCache, type LruCacheOptions, MAX_QUERY_HISTORY_ENTRIES, type MapLike, type MapQueryHandle, type MapQueryResult, MarkdownSqlContext, type MosaicSourceMeta, type NotebookConfig, type NotebookMeta, type NumericFacet, type NumericFacetField, PRESETS, PROVIDERS, PROVIDER_IDS, type ParquetFileMetadata, type ParsedGeometry, type ParsedMarkdownDocument, type ParsedStorageUrl, type PixelInspectCallbacks, type PixelInspectClickEvent, type PixelInspectClickHandler, type PixelInspectProbe, type PixelInspectProbeRequest, type PresetDef, type ProviderDef, type ProviderId, type ProviderRegion, QueryCancelledError, type QueryEngine, type QueryHandle, type QueryResult, type QuerySource, type RasterBandAsset, SF_LABELS, SQL_PREVIEW_LENGTH, STAC_API_PATH_RE, STAC_COG_ASSET_KEYS, STAC_GEOPARQUET_REQUIRED_COLUMNS, STORAGE_KEYS, type SchemaField, type SmokeTestResult, type SortConfig, type SortDirection, type SortField, type SqlBlock, type StacApiCapabilities, type StacApiSourceDeps, type StacAsset, type StacBboxStruct, type StacCatalog, type StacCollection, type StacFeatureCollection, type StacGeoparquetRow, type StacGeoparquetSchemaColumn, type StacItem, type StacItemView, type StacItemsQuery, type StacLink, type StacNativeQuery, type StacRoutableKind, type StacRowToItemOptions, type StacSource, type StacSourceBatch, type StacSourceCapabilities, type StacSourceKind, type StacSourceRequest, type StacStaticSourceDeps, type StorageAdapter, type StorageExtensionVersion, type StorageHints, type StorageProvider, TILE_DEBOUNCE_MS, type Tab, type Theme, type ToNativeQueryOptions, type TypeCategory, UrlAdapter, type UrlClassification, VIEWER_DIR_EXTENSIONS, type ViewerKind, WGS84_CODES, type WriteResult, absolutizeHref, allChannelsBand0, applyFacets, applyPreset, applyStacItemStorageHints, applyStorageHintsToConnection, attachPixelInspector, availablePresets, buildDataTypeLabel, buildDuckDbSource, buildEndpointFromTemplate, buildFacets, buildGeoArrowTables, buildMosaicSourceMeta, buildProviderBaseUrl, buildTransformExpr, clampBounds, classifyStac, classifyType, classifyUrl, coerceBool, coercePositiveInt, coerceString, coerceTheme, compositeFromUrl, compositeToUrl, connectionIdentityKey, copyToClipboard, createApiSource, createStaticSource, describeParseResult, detectHostBucket, detectMosaicCapable, detectMultiCogCapable, detectStorageExtensionVersion, emptyFacetState, emptyPushdown, emptyStorageHints, escapeCsvField, exportToCsv, exportToJson, extractBounds, extractCogAssets, extractEpsgFromGeoMeta, extractGeometryTypes, extractItemView, extractMosaicAssets, extractRasterBandAssets, extractSentinelBandAssets, extractStorageHints, findGeoColumn, findGeoColumnFromRows, flattenStacBbox, formatDate, formatFileSize, formatValue, generateHexDump, getAccessMode, getDuckDbReadFn, getFileExtension, getFileTypeInfo, getMimeType, getNativeScheme, getProvider, getViewerKind, handleLoadError, hasActiveFilters, hasCompositableBands, hasRgbBands, hasStacItemsEndpoint, hydrateStacItems, interpolateTemplates, isAbortError, isCloudNativeFormat, isGcsProvider, isKnownBucketHost, isPubliclyStreamable, isQueryable, isSameConnectionIdentity, isSingleAssetComposite, isStacCatalog, isStacCollection, isStacFeatureCollection, isStacGeoparquetSchema, isStacItem, isWgs84, isWgs84Crs, jsonReplacerBigInt, loadFromStorage, looksLikeUrl, markSqlBlocks, mergeAppConfig, normalizeEndpoint, normalizeGeomType, normalizeProvider, parseGeometryTypeCrs, parseMarkdownDocument, parseStorageUrl, parseVisibilityParam, parseWKB, persistToStorage, pickCogAssetHref, pickGranularity, pickNaturalColorComposite, pickStacPrimaryAsset, presetMatchesComposite, readParquetMetadata, renderNotebook, residualState, resolveBandSlotAssetKey, resolveBasemap, resolveCloudUrl, resolvePresetComposite, resolveProviderEndpoint, resolveSetting, resolveStacAssetHref, safeClamp, safeDecodeURIComponent, serializeToCsv, serializeToJson, smokeTestHref, sniffApiCapabilities, sortFileEntries, sortViews, spatialCellKey, stacItemBbox, stacRowToItem, syntheticSelfAsset, toBinary, toCql2Filter, toNativeQuery, toggleSortField, typeBadgeClass, typeColor, typeLabel, wireCodeCopyButtons, wrapWkbWithCrs };
package/dist/index.d.ts CHANGED
@@ -32,6 +32,12 @@ declare const VIEWER_DIR_EXTENSIONS: Set<string>;
32
32
  declare const LAYER_HUE_MULTIPLIER = 137;
33
33
  /** Duration (ms) to show "Copied!" feedback before resetting. */
34
34
  declare const COPY_FEEDBACK_MS = 2000;
35
+ /** Region assumed when a connection or bucket name yields none. AWS's global default. */
36
+ declare const DEFAULT_AWS_REGION = "us-east-1";
37
+ /** deck.gl tile-layer debounce (ms) before fetching after a viewport change. */
38
+ declare const TILE_DEBOUNCE_MS = 200;
39
+ /** Zoom level used when flying to the first feature of a vector dataset. */
40
+ declare const FIRST_FEATURE_FLY_ZOOM = 14;
35
41
 
36
42
  /**
37
43
  * Centralized file type detection module.
@@ -891,6 +897,12 @@ declare function connectionIdentityKey(input: ConnectionIdentityInput): string;
891
897
  /** Convenience: true when both inputs share the same non-empty identity. */
892
898
  declare function isSameConnectionIdentity(a: ConnectionIdentityInput, b: ConnectionIdentityInput): boolean;
893
899
 
900
+ /**
901
+ * True when the given CRS is WGS84 lon/lat (no ST_Transform needed).
902
+ * Accepts a numeric EPSG code or a string like "EPSG:4326" / "OGC:CRS84".
903
+ */
904
+ declare function isWgs84(crs: number | string | null | undefined): boolean;
905
+
894
906
  /**
895
907
  * Shared error handling for async viewer load operations.
896
908
  */
@@ -2257,4 +2269,4 @@ declare function findGeoColumnFromRows(rows: Record<string, unknown>[], schema:
2257
2269
  type: string;
2258
2270
  }[]): string | null;
2259
2271
 
2260
- export { type AccessMode, type AccessModeInput, type AppConfig, type AppConfigDefaults, type AppConfigUi, type AttachPixelInspectorOptions, type BandMap, type BandSlot, type BasemapConfig, COPY_FEEDBACK_MS, type ChannelComposite, type ChannelRef, type CogAsset, type CogInfo, type Connection, type ConnectionConfig, type ConnectionIdentityInput, type ConnectionSeed, DATETIME_HISTOGRAM_BINS, DATETIME_HISTOGRAM_BINS_MAX, DEFAULT_APP_CONFIG, DEFAULT_TARGET_CRS, DUCKDB_INIT_TIMEOUT_MS, type DatetimeFacet, type DatetimeGranularity, type Defaults, type DetectedHost, type DuckDbReadFn, type EnumFacet, type EnumFacetField, type Facet, type FacetSet, type FacetSort, type FacetState, type FileCategory, type FileEntry, type FileTypeInfo, type GeoArrowGeomType, type GeoArrowResult, type GeoBounds, type GeoColumnMeta, type GeoParquetMeta, type GeoType, type GeometryTypeInfo, type HexRow, type HydrateOptions, type HydrateResult, LAYER_HUE_MULTIPLIER, type ListPage, LruCache, type LruCacheOptions, MAX_QUERY_HISTORY_ENTRIES, type MapLike, type MapQueryHandle, type MapQueryResult, MarkdownSqlContext, type MosaicSourceMeta, type NotebookConfig, type NotebookMeta, type NumericFacet, type NumericFacetField, PRESETS, PROVIDERS, PROVIDER_IDS, type ParquetFileMetadata, type ParsedGeometry, type ParsedMarkdownDocument, type ParsedStorageUrl, type PixelInspectCallbacks, type PixelInspectClickEvent, type PixelInspectClickHandler, type PixelInspectProbe, type PixelInspectProbeRequest, type PresetDef, type ProviderDef, type ProviderId, type ProviderRegion, QueryCancelledError, type QueryEngine, type QueryHandle, type QueryResult, type QuerySource, type RasterBandAsset, SF_LABELS, SQL_PREVIEW_LENGTH, STAC_API_PATH_RE, STAC_COG_ASSET_KEYS, STAC_GEOPARQUET_REQUIRED_COLUMNS, STORAGE_KEYS, type SchemaField, type SmokeTestResult, type SortConfig, type SortDirection, type SortField, type SqlBlock, type StacApiCapabilities, type StacApiSourceDeps, type StacAsset, type StacBboxStruct, type StacCatalog, type StacCollection, type StacFeatureCollection, type StacGeoparquetRow, type StacGeoparquetSchemaColumn, type StacItem, type StacItemView, type StacItemsQuery, type StacLink, type StacNativeQuery, type StacRoutableKind, type StacRowToItemOptions, type StacSource, type StacSourceBatch, type StacSourceCapabilities, type StacSourceKind, type StacSourceRequest, type StacStaticSourceDeps, type StorageAdapter, type StorageExtensionVersion, type StorageHints, type StorageProvider, type Tab, type Theme, type ToNativeQueryOptions, type TypeCategory, UrlAdapter, type UrlClassification, VIEWER_DIR_EXTENSIONS, type ViewerKind, WGS84_CODES, type WriteResult, absolutizeHref, allChannelsBand0, applyFacets, applyPreset, applyStacItemStorageHints, applyStorageHintsToConnection, attachPixelInspector, availablePresets, buildDataTypeLabel, buildDuckDbSource, buildEndpointFromTemplate, buildFacets, buildGeoArrowTables, buildMosaicSourceMeta, buildProviderBaseUrl, buildTransformExpr, clampBounds, classifyStac, classifyType, classifyUrl, coerceBool, coercePositiveInt, coerceString, coerceTheme, compositeFromUrl, compositeToUrl, connectionIdentityKey, copyToClipboard, createApiSource, createStaticSource, describeParseResult, detectHostBucket, detectMosaicCapable, detectMultiCogCapable, detectStorageExtensionVersion, emptyFacetState, emptyPushdown, emptyStorageHints, escapeCsvField, exportToCsv, exportToJson, extractBounds, extractCogAssets, extractEpsgFromGeoMeta, extractGeometryTypes, extractItemView, extractMosaicAssets, extractRasterBandAssets, extractSentinelBandAssets, extractStorageHints, findGeoColumn, findGeoColumnFromRows, flattenStacBbox, formatDate, formatFileSize, formatValue, generateHexDump, getAccessMode, getDuckDbReadFn, getFileExtension, getFileTypeInfo, getMimeType, getNativeScheme, getProvider, getViewerKind, handleLoadError, hasActiveFilters, hasCompositableBands, hasRgbBands, hasStacItemsEndpoint, hydrateStacItems, interpolateTemplates, isAbortError, isCloudNativeFormat, isGcsProvider, isKnownBucketHost, isPubliclyStreamable, isQueryable, isSameConnectionIdentity, isSingleAssetComposite, isStacCatalog, isStacCollection, isStacFeatureCollection, isStacGeoparquetSchema, isStacItem, isWgs84Crs, jsonReplacerBigInt, loadFromStorage, looksLikeUrl, markSqlBlocks, mergeAppConfig, normalizeEndpoint, normalizeGeomType, normalizeProvider, parseGeometryTypeCrs, parseMarkdownDocument, parseStorageUrl, parseVisibilityParam, parseWKB, persistToStorage, pickCogAssetHref, pickGranularity, pickNaturalColorComposite, pickStacPrimaryAsset, presetMatchesComposite, readParquetMetadata, renderNotebook, residualState, resolveBandSlotAssetKey, resolveBasemap, resolveCloudUrl, resolvePresetComposite, resolveProviderEndpoint, resolveSetting, resolveStacAssetHref, safeClamp, safeDecodeURIComponent, serializeToCsv, serializeToJson, smokeTestHref, sniffApiCapabilities, sortFileEntries, sortViews, spatialCellKey, stacItemBbox, stacRowToItem, syntheticSelfAsset, toBinary, toCql2Filter, toNativeQuery, toggleSortField, typeBadgeClass, typeColor, typeLabel, wireCodeCopyButtons, wrapWkbWithCrs };
2272
+ export { type AccessMode, type AccessModeInput, type AppConfig, type AppConfigDefaults, type AppConfigUi, type AttachPixelInspectorOptions, type BandMap, type BandSlot, type BasemapConfig, COPY_FEEDBACK_MS, type ChannelComposite, type ChannelRef, type CogAsset, type CogInfo, type Connection, type ConnectionConfig, type ConnectionIdentityInput, type ConnectionSeed, DATETIME_HISTOGRAM_BINS, DATETIME_HISTOGRAM_BINS_MAX, DEFAULT_APP_CONFIG, DEFAULT_AWS_REGION, DEFAULT_TARGET_CRS, DUCKDB_INIT_TIMEOUT_MS, type DatetimeFacet, type DatetimeGranularity, type Defaults, type DetectedHost, type DuckDbReadFn, type EnumFacet, type EnumFacetField, FIRST_FEATURE_FLY_ZOOM, type Facet, type FacetSet, type FacetSort, type FacetState, type FileCategory, type FileEntry, type FileTypeInfo, type GeoArrowGeomType, type GeoArrowResult, type GeoBounds, type GeoColumnMeta, type GeoParquetMeta, type GeoType, type GeometryTypeInfo, type HexRow, type HydrateOptions, type HydrateResult, LAYER_HUE_MULTIPLIER, type ListPage, LruCache, type LruCacheOptions, MAX_QUERY_HISTORY_ENTRIES, type MapLike, type MapQueryHandle, type MapQueryResult, MarkdownSqlContext, type MosaicSourceMeta, type NotebookConfig, type NotebookMeta, type NumericFacet, type NumericFacetField, PRESETS, PROVIDERS, PROVIDER_IDS, type ParquetFileMetadata, type ParsedGeometry, type ParsedMarkdownDocument, type ParsedStorageUrl, type PixelInspectCallbacks, type PixelInspectClickEvent, type PixelInspectClickHandler, type PixelInspectProbe, type PixelInspectProbeRequest, type PresetDef, type ProviderDef, type ProviderId, type ProviderRegion, QueryCancelledError, type QueryEngine, type QueryHandle, type QueryResult, type QuerySource, type RasterBandAsset, SF_LABELS, SQL_PREVIEW_LENGTH, STAC_API_PATH_RE, STAC_COG_ASSET_KEYS, STAC_GEOPARQUET_REQUIRED_COLUMNS, STORAGE_KEYS, type SchemaField, type SmokeTestResult, type SortConfig, type SortDirection, type SortField, type SqlBlock, type StacApiCapabilities, type StacApiSourceDeps, type StacAsset, type StacBboxStruct, type StacCatalog, type StacCollection, type StacFeatureCollection, type StacGeoparquetRow, type StacGeoparquetSchemaColumn, type StacItem, type StacItemView, type StacItemsQuery, type StacLink, type StacNativeQuery, type StacRoutableKind, type StacRowToItemOptions, type StacSource, type StacSourceBatch, type StacSourceCapabilities, type StacSourceKind, type StacSourceRequest, type StacStaticSourceDeps, type StorageAdapter, type StorageExtensionVersion, type StorageHints, type StorageProvider, TILE_DEBOUNCE_MS, type Tab, type Theme, type ToNativeQueryOptions, type TypeCategory, UrlAdapter, type UrlClassification, VIEWER_DIR_EXTENSIONS, type ViewerKind, WGS84_CODES, type WriteResult, absolutizeHref, allChannelsBand0, applyFacets, applyPreset, applyStacItemStorageHints, applyStorageHintsToConnection, attachPixelInspector, availablePresets, buildDataTypeLabel, buildDuckDbSource, buildEndpointFromTemplate, buildFacets, buildGeoArrowTables, buildMosaicSourceMeta, buildProviderBaseUrl, buildTransformExpr, clampBounds, classifyStac, classifyType, classifyUrl, coerceBool, coercePositiveInt, coerceString, coerceTheme, compositeFromUrl, compositeToUrl, connectionIdentityKey, copyToClipboard, createApiSource, createStaticSource, describeParseResult, detectHostBucket, detectMosaicCapable, detectMultiCogCapable, detectStorageExtensionVersion, emptyFacetState, emptyPushdown, emptyStorageHints, escapeCsvField, exportToCsv, exportToJson, extractBounds, extractCogAssets, extractEpsgFromGeoMeta, extractGeometryTypes, extractItemView, extractMosaicAssets, extractRasterBandAssets, extractSentinelBandAssets, extractStorageHints, findGeoColumn, findGeoColumnFromRows, flattenStacBbox, formatDate, formatFileSize, formatValue, generateHexDump, getAccessMode, getDuckDbReadFn, getFileExtension, getFileTypeInfo, getMimeType, getNativeScheme, getProvider, getViewerKind, handleLoadError, hasActiveFilters, hasCompositableBands, hasRgbBands, hasStacItemsEndpoint, hydrateStacItems, interpolateTemplates, isAbortError, isCloudNativeFormat, isGcsProvider, isKnownBucketHost, isPubliclyStreamable, isQueryable, isSameConnectionIdentity, isSingleAssetComposite, isStacCatalog, isStacCollection, isStacFeatureCollection, isStacGeoparquetSchema, isStacItem, isWgs84, isWgs84Crs, jsonReplacerBigInt, loadFromStorage, looksLikeUrl, markSqlBlocks, mergeAppConfig, normalizeEndpoint, normalizeGeomType, normalizeProvider, parseGeometryTypeCrs, parseMarkdownDocument, parseStorageUrl, parseVisibilityParam, parseWKB, persistToStorage, pickCogAssetHref, pickGranularity, pickNaturalColorComposite, pickStacPrimaryAsset, presetMatchesComposite, readParquetMetadata, renderNotebook, residualState, resolveBandSlotAssetKey, resolveBasemap, resolveCloudUrl, resolvePresetComposite, resolveProviderEndpoint, resolveSetting, resolveStacAssetHref, safeClamp, safeDecodeURIComponent, serializeToCsv, serializeToJson, smokeTestHref, sniffApiCapabilities, sortFileEntries, sortViews, spatialCellKey, stacItemBbox, stacRowToItem, syntheticSelfAsset, toBinary, toCql2Filter, toNativeQuery, toggleSortField, typeBadgeClass, typeColor, typeLabel, wireCodeCopyButtons, wrapWkbWithCrs };
package/dist/index.js CHANGED
@@ -14,6 +14,9 @@ var SQL_PREVIEW_LENGTH = 120;
14
14
  var VIEWER_DIR_EXTENSIONS = /* @__PURE__ */ new Set(["zarr", "zr3"]);
15
15
  var LAYER_HUE_MULTIPLIER = 137;
16
16
  var COPY_FEEDBACK_MS = 2e3;
17
+ var DEFAULT_AWS_REGION = "us-east-1";
18
+ var TILE_DEBOUNCE_MS = 200;
19
+ var FIRST_FEATURE_FLY_ZOOM = 14;
17
20
 
18
21
  // ../../src/lib/file-icons/index.ts
19
22
  var DEFAULT_INFO = {
@@ -1364,7 +1367,7 @@ function buildProviderBaseUrl(provider, endpoint, bucket, region) {
1364
1367
  const resolved = def.endpointTemplate.replace("{region}", region || def.defaultRegion);
1365
1368
  return `${resolved}/${bucket}`;
1366
1369
  }
1367
- return `https://s3.${region || "us-east-1"}.amazonaws.com/${bucket}`;
1370
+ return `https://s3.${region || DEFAULT_AWS_REGION}.amazonaws.com/${bucket}`;
1368
1371
  }
1369
1372
  function isGcsProvider(provider, endpoint) {
1370
1373
  return provider === "gcs" || !!endpoint && /storage\.googleapis\.com/i.test(endpoint);
@@ -1428,8 +1431,23 @@ var UrlAdapter = class {
1428
1431
  var DEFAULT_APP_CONFIG = {
1429
1432
  defaults: { theme: "system", locale: "en", featureLimit: 1e3, mosaicItemLimit: 2e3 },
1430
1433
  ui: { showConnectionRail: true, showFileTree: true, showSettings: true },
1431
- basemaps: [],
1432
- defaultBasemap: {},
1434
+ basemaps: [
1435
+ {
1436
+ id: "positron",
1437
+ label: "Positron",
1438
+ type: "vector",
1439
+ url: "https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",
1440
+ variant: "light"
1441
+ },
1442
+ {
1443
+ id: "dark-matter",
1444
+ label: "Dark Matter",
1445
+ type: "vector",
1446
+ url: "https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json",
1447
+ variant: "dark"
1448
+ }
1449
+ ],
1450
+ defaultBasemap: { light: "positron", dark: "dark-matter" },
1433
1451
  connections: []
1434
1452
  };
1435
1453
  function asObject(v) {
@@ -1896,7 +1914,7 @@ function resolveCloudUrl(url) {
1896
1914
  if (s3Match) {
1897
1915
  const [, bucket, key] = s3Match;
1898
1916
  const regionMatch = bucket.match(AWS_REGION_RE);
1899
- const region = regionMatch ? regionMatch[0] : "us-east-1";
1917
+ const region = regionMatch ? regionMatch[0] : DEFAULT_AWS_REGION;
1900
1918
  const base = buildProviderBaseUrl("s3", "", bucket, region);
1901
1919
  return key ? `${base}/${key}` : base;
1902
1920
  }
@@ -2227,6 +2245,18 @@ function isSameConnectionIdentity(a, b) {
2227
2245
  return key !== "" && key === connectionIdentityKey(b);
2228
2246
  }
2229
2247
 
2248
+ // src/crs.ts
2249
+ var WGS84_STRINGS = /* @__PURE__ */ new Set(["epsg:4326", "epsg:4979", DEFAULT_TARGET_CRS.toLowerCase()]);
2250
+ function isWgs84(crs) {
2251
+ if (crs === null || crs === void 0) return false;
2252
+ if (typeof crs === "number") return Number.isFinite(crs) && WGS84_CODES.has(crs);
2253
+ const s = crs.trim().toLowerCase();
2254
+ if (s.length === 0) return false;
2255
+ if (WGS84_STRINGS.has(s)) return true;
2256
+ const m = s.match(/(?:epsg:)?(\d+)/);
2257
+ return m ? WGS84_CODES.has(Number(m[1])) : false;
2258
+ }
2259
+
2230
2260
  // src/error.ts
2231
2261
  function isAbortError(err) {
2232
2262
  if (!err) return false;
@@ -2955,12 +2985,19 @@ function buildGeoArrowTables(wkbArrays, attributes, knownGeomType) {
2955
2985
  }
2956
2986
 
2957
2987
  // src/geometry-type.ts
2958
- var GEOMETRY_PREFIX = /^GEOMETRY(\s*\(\s*'?([^')]+)'?\s*\))?/i;
2988
+ var GEOMETRY_PREFIX = /^GEOMETRY(?:\s*\(([^)]*)\))?/i;
2989
+ function stripCrsQuotes(inner) {
2990
+ let crs = inner.trim();
2991
+ if (crs.length >= 2 && crs.startsWith("'") && crs.endsWith("'")) {
2992
+ crs = crs.slice(1, -1).trim();
2993
+ }
2994
+ return crs || null;
2995
+ }
2959
2996
  function parseGeometryTypeCrs(typeStr) {
2960
2997
  if (!typeStr) return { isGeometry: false, hasCrs: false, rawCrs: null, nonWgs84Crs: null };
2961
2998
  const match = typeStr.match(GEOMETRY_PREFIX);
2962
2999
  if (!match) return { isGeometry: false, hasCrs: false, rawCrs: null, nonWgs84Crs: null };
2963
- const rawCrs = match[2]?.trim() ?? null;
3000
+ const rawCrs = match[1] != null ? stripCrsQuotes(match[1]) : null;
2964
3001
  if (!rawCrs) return { isGeometry: true, hasCrs: false, rawCrs: null, nonWgs84Crs: null };
2965
3002
  return {
2966
3003
  isGeometry: true,
@@ -3210,7 +3247,7 @@ function isKnownBucketHost(host) {
3210
3247
  function defaultResult(defaults) {
3211
3248
  return {
3212
3249
  bucket: "",
3213
- region: defaults.region || "us-east-1",
3250
+ region: defaults.region || DEFAULT_AWS_REGION,
3214
3251
  endpoint: defaults.endpoint || "",
3215
3252
  provider: defaults.provider || "s3",
3216
3253
  prefix: ""
@@ -3235,7 +3272,7 @@ function parseStorageUrl(input, defaults = {}) {
3235
3272
  const { bucket, prefix } = splitBucketPrefix(rest);
3236
3273
  return {
3237
3274
  bucket,
3238
- region: defaults.region || "us-east-1",
3275
+ region: defaults.region || DEFAULT_AWS_REGION,
3239
3276
  endpoint: defaults.endpoint || "",
3240
3277
  provider,
3241
3278
  prefix
@@ -3270,7 +3307,7 @@ function parseStorageUrl(input, defaults = {}) {
3270
3307
  if (host === AWS_GLOBAL_HOST && pathParts.length > 0) {
3271
3308
  return {
3272
3309
  bucket: pathParts[0],
3273
- region: defaults.region || "us-east-1",
3310
+ region: defaults.region || DEFAULT_AWS_REGION,
3274
3311
  endpoint: "",
3275
3312
  provider: "s3",
3276
3313
  prefix: pathParts.slice(1).join("/")
@@ -3437,7 +3474,7 @@ function parseStorageUrl(input, defaults = {}) {
3437
3474
  if (isMinioLikeHost(host) && pathParts.length > 0) {
3438
3475
  return {
3439
3476
  bucket: pathParts[0],
3440
- region: defaults.region || "us-east-1",
3477
+ region: defaults.region || DEFAULT_AWS_REGION,
3441
3478
  endpoint: `${url.protocol}//${url.host}`,
3442
3479
  provider: "minio",
3443
3480
  prefix: pathParts.slice(1).join("/")
@@ -3483,7 +3520,7 @@ function parseStorageUrl(input, defaults = {}) {
3483
3520
  const endpoint = `${url.protocol}//${url.host}`;
3484
3521
  return {
3485
3522
  bucket: pathParts[0],
3486
- region: defaults.region || "us-east-1",
3523
+ region: defaults.region || DEFAULT_AWS_REGION,
3487
3524
  endpoint,
3488
3525
  provider: defaults.provider || "s3",
3489
3526
  prefix: pathParts.slice(1).join("/")
@@ -3499,7 +3536,7 @@ function parseStorageUrl(input, defaults = {}) {
3499
3536
  const cleaned = stripEdgeSlashes2(trimmed);
3500
3537
  return {
3501
3538
  bucket: cleaned,
3502
- region: defaults.region || "us-east-1",
3539
+ region: defaults.region || DEFAULT_AWS_REGION,
3503
3540
  endpoint: defaults.endpoint || "",
3504
3541
  provider: defaults.provider || "s3",
3505
3542
  prefix: ""
@@ -3517,7 +3554,8 @@ function describeParseResult(parsed) {
3517
3554
  const parts = [];
3518
3555
  if (parsed.bucket) parts.push(`bucket="${parsed.bucket}"`);
3519
3556
  if (parsed.endpoint) parts.push(`endpoint="${parsed.endpoint}"`);
3520
- if (parsed.region && parsed.region !== "us-east-1") parts.push(`region="${parsed.region}"`);
3557
+ if (parsed.region && parsed.region !== DEFAULT_AWS_REGION)
3558
+ parts.push(`region="${parsed.region}"`);
3521
3559
  if (parsed.provider !== "s3") parts.push(`provider=${parsed.provider}`);
3522
3560
  if (parsed.prefix) parts.push(`prefix="${parsed.prefix}"`);
3523
3561
  return parts.length > 0 ? `Detected: ${parts.join(", ")}` : "";
@@ -5700,17 +5738,29 @@ function looksLikeWKB(value) {
5700
5738
  const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
5701
5739
  let typeInt = view.getUint32(1, le);
5702
5740
  typeInt = (typeInt & 65535) % 1e3;
5703
- return typeInt >= 1 && typeInt <= 7;
5741
+ return typeInt >= 1 && typeInt <= 6;
5704
5742
  }
5705
5743
  function findGeoColumnFromRows(rows, schema) {
5706
5744
  if (rows.length === 0) return null;
5707
- const sample = rows[0];
5745
+ const MAX_SCAN = 50;
5746
+ const scan = rows.slice(0, MAX_SCAN);
5747
+ const firstNonNull = (key) => {
5748
+ for (const row of scan) {
5749
+ const v = row[key];
5750
+ if (v !== null && v !== void 0) return v;
5751
+ }
5752
+ return void 0;
5753
+ };
5708
5754
  for (const f of schema) {
5709
5755
  const t = f.type.toLowerCase();
5710
5756
  const isBinary = t.includes("blob") || t.includes("binary") || t.includes("bytea");
5711
- if (isBinary && looksLikeWKB(sample[f.name])) return f.name;
5757
+ if (isBinary && looksLikeWKB(firstNonNull(f.name))) return f.name;
5712
5758
  }
5713
- for (const [key, value] of Object.entries(sample)) {
5759
+ const keys = /* @__PURE__ */ new Set();
5760
+ for (const row of scan) for (const k of Object.keys(row)) keys.add(k);
5761
+ for (const key of keys) {
5762
+ const value = firstNonNull(key);
5763
+ if (value === void 0) continue;
5714
5764
  if (value instanceof Uint8Array || value instanceof ArrayBuffer) {
5715
5765
  if (looksLikeWKB(value)) return key;
5716
5766
  }
@@ -5744,6 +5794,6 @@ function isWKT(value) {
5744
5794
  return WKT_TYPES.some((t) => s.startsWith(t) || s.startsWith(`MULTI${t}`));
5745
5795
  }
5746
5796
 
5747
- export { COPY_FEEDBACK_MS, DATETIME_HISTOGRAM_BINS, DATETIME_HISTOGRAM_BINS_MAX, DEFAULT_APP_CONFIG, DEFAULT_TARGET_CRS, DUCKDB_INIT_TIMEOUT_MS, LAYER_HUE_MULTIPLIER, LruCache, MAX_QUERY_HISTORY_ENTRIES, MarkdownSqlContext, PRESETS, PROVIDERS, PROVIDER_IDS, QueryCancelledError, SF_LABELS, SQL_PREVIEW_LENGTH, STAC_API_PATH_RE, STAC_COG_ASSET_KEYS, STAC_GEOPARQUET_REQUIRED_COLUMNS, STORAGE_KEYS, UrlAdapter, VIEWER_DIR_EXTENSIONS, WGS84_CODES, absolutizeHref, allChannelsBand0, applyFacets, applyPreset, applyStacItemStorageHints, applyStorageHintsToConnection, attachPixelInspector, availablePresets, buildDataTypeLabel, buildDuckDbSource, buildEndpointFromTemplate, buildFacets, buildGeoArrowTables, buildMosaicSourceMeta, buildProviderBaseUrl, buildTransformExpr, clampBounds, classifyStac, classifyType, classifyUrl, coerceBool, coercePositiveInt, coerceString, coerceTheme, compositeFromUrl, compositeToUrl, connectionIdentityKey, copyToClipboard, createApiSource, createStaticSource, describeParseResult, detectHostBucket, detectMosaicCapable, detectMultiCogCapable, detectStorageExtensionVersion, emptyFacetState, emptyPushdown, emptyStorageHints, escapeCsvField, exportToCsv, exportToJson, extractBounds, extractCogAssets, extractEpsgFromGeoMeta, extractGeometryTypes, extractItemView, extractMosaicAssets, extractRasterBandAssets, extractSentinelBandAssets, extractStorageHints, findGeoColumn, findGeoColumnFromRows, flattenStacBbox, formatDate, formatFileSize, formatValue, generateHexDump, getAccessMode, getDuckDbReadFn, getFileExtension, getFileTypeInfo, getMimeType, getNativeScheme, getProvider, getViewerKind, handleLoadError, hasActiveFilters, hasCompositableBands, hasRgbBands, hasStacItemsEndpoint, hydrateStacItems, interpolateTemplates, isAbortError, isCloudNativeFormat, isGcsProvider, isKnownBucketHost, isPubliclyStreamable, isQueryable, isSameConnectionIdentity, isSingleAssetComposite, isStacCatalog, isStacCollection, isStacFeatureCollection, isStacGeoparquetSchema, isStacItem, isWgs84Crs, jsonReplacerBigInt, loadFromStorage, looksLikeUrl, markSqlBlocks, mergeAppConfig, normalizeEndpoint, normalizeGeomType, normalizeProvider, parseGeometryTypeCrs, parseMarkdownDocument, parseStorageUrl, parseVisibilityParam, parseWKB, persistToStorage, pickCogAssetHref, pickGranularity, pickNaturalColorComposite, pickStacPrimaryAsset, presetMatchesComposite, readParquetMetadata, renderNotebook, residualState, resolveBandSlotAssetKey, resolveBasemap, resolveCloudUrl, resolvePresetComposite, resolveProviderEndpoint, resolveSetting, resolveStacAssetHref, safeClamp, safeDecodeURIComponent, serializeToCsv, serializeToJson, smokeTestHref, sniffApiCapabilities, sortFileEntries, sortViews, spatialCellKey, stacItemBbox, stacRowToItem, syntheticSelfAsset, toBinary, toCql2Filter, toNativeQuery, toggleSortField, typeBadgeClass, typeColor, typeLabel, wireCodeCopyButtons, wrapWkbWithCrs };
5797
+ export { COPY_FEEDBACK_MS, DATETIME_HISTOGRAM_BINS, DATETIME_HISTOGRAM_BINS_MAX, DEFAULT_APP_CONFIG, DEFAULT_AWS_REGION, DEFAULT_TARGET_CRS, DUCKDB_INIT_TIMEOUT_MS, FIRST_FEATURE_FLY_ZOOM, LAYER_HUE_MULTIPLIER, LruCache, MAX_QUERY_HISTORY_ENTRIES, MarkdownSqlContext, PRESETS, PROVIDERS, PROVIDER_IDS, QueryCancelledError, SF_LABELS, SQL_PREVIEW_LENGTH, STAC_API_PATH_RE, STAC_COG_ASSET_KEYS, STAC_GEOPARQUET_REQUIRED_COLUMNS, STORAGE_KEYS, TILE_DEBOUNCE_MS, UrlAdapter, VIEWER_DIR_EXTENSIONS, WGS84_CODES, absolutizeHref, allChannelsBand0, applyFacets, applyPreset, applyStacItemStorageHints, applyStorageHintsToConnection, attachPixelInspector, availablePresets, buildDataTypeLabel, buildDuckDbSource, buildEndpointFromTemplate, buildFacets, buildGeoArrowTables, buildMosaicSourceMeta, buildProviderBaseUrl, buildTransformExpr, clampBounds, classifyStac, classifyType, classifyUrl, coerceBool, coercePositiveInt, coerceString, coerceTheme, compositeFromUrl, compositeToUrl, connectionIdentityKey, copyToClipboard, createApiSource, createStaticSource, describeParseResult, detectHostBucket, detectMosaicCapable, detectMultiCogCapable, detectStorageExtensionVersion, emptyFacetState, emptyPushdown, emptyStorageHints, escapeCsvField, exportToCsv, exportToJson, extractBounds, extractCogAssets, extractEpsgFromGeoMeta, extractGeometryTypes, extractItemView, extractMosaicAssets, extractRasterBandAssets, extractSentinelBandAssets, extractStorageHints, findGeoColumn, findGeoColumnFromRows, flattenStacBbox, formatDate, formatFileSize, formatValue, generateHexDump, getAccessMode, getDuckDbReadFn, getFileExtension, getFileTypeInfo, getMimeType, getNativeScheme, getProvider, getViewerKind, handleLoadError, hasActiveFilters, hasCompositableBands, hasRgbBands, hasStacItemsEndpoint, hydrateStacItems, interpolateTemplates, isAbortError, isCloudNativeFormat, isGcsProvider, isKnownBucketHost, isPubliclyStreamable, isQueryable, isSameConnectionIdentity, isSingleAssetComposite, isStacCatalog, isStacCollection, isStacFeatureCollection, isStacGeoparquetSchema, isStacItem, isWgs84, isWgs84Crs, jsonReplacerBigInt, loadFromStorage, looksLikeUrl, markSqlBlocks, mergeAppConfig, normalizeEndpoint, normalizeGeomType, normalizeProvider, parseGeometryTypeCrs, parseMarkdownDocument, parseStorageUrl, parseVisibilityParam, parseWKB, persistToStorage, pickCogAssetHref, pickGranularity, pickNaturalColorComposite, pickStacPrimaryAsset, presetMatchesComposite, readParquetMetadata, renderNotebook, residualState, resolveBandSlotAssetKey, resolveBasemap, resolveCloudUrl, resolvePresetComposite, resolveProviderEndpoint, resolveSetting, resolveStacAssetHref, safeClamp, safeDecodeURIComponent, serializeToCsv, serializeToJson, smokeTestHref, sniffApiCapabilities, sortFileEntries, sortViews, spatialCellKey, stacItemBbox, stacRowToItem, syntheticSelfAsset, toBinary, toCql2Filter, toNativeQuery, toggleSortField, typeBadgeClass, typeColor, typeLabel, wireCodeCopyButtons, wrapWkbWithCrs };
5748
5798
  //# sourceMappingURL=index.js.map
5749
5799
  //# sourceMappingURL=index.js.map