@walkthru-earth/objex-utils 0.1.0 → 1.1.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/README.md +92 -0
- package/dist/index.cjs +605 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +218 -4
- package/dist/index.d.ts +218 -4
- package/dist/index.js +571 -25
- package/dist/index.js.map +1 -1
- package/package.json +16 -3
package/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# @walkthru-earth/objex-utils
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@walkthru-earth/objex-utils)
|
|
4
|
+
[](https://creativecommons.org/licenses/by/4.0/)
|
|
5
|
+
|
|
6
|
+
Pure TypeScript utilities extracted from [objex](https://github.com/walkthru-earth/objex) — zero Svelte dependency. Works with any JS framework or Node.js.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pnpm add @walkthru-earth/objex-utils
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import {
|
|
18
|
+
// WKB / Geometry
|
|
19
|
+
parseWKB,
|
|
20
|
+
findGeoColumn,
|
|
21
|
+
buildGeoArrowTables,
|
|
22
|
+
|
|
23
|
+
// Storage URLs
|
|
24
|
+
parseStorageUrl,
|
|
25
|
+
looksLikeUrl,
|
|
26
|
+
|
|
27
|
+
// Parquet metadata
|
|
28
|
+
readParquetMetadata,
|
|
29
|
+
extractEpsgFromGeoMeta,
|
|
30
|
+
extractBounds,
|
|
31
|
+
|
|
32
|
+
// File type registry
|
|
33
|
+
getFileTypeInfo,
|
|
34
|
+
getViewerKind,
|
|
35
|
+
getMimeType,
|
|
36
|
+
isQueryable,
|
|
37
|
+
|
|
38
|
+
// Formatting
|
|
39
|
+
formatFileSize,
|
|
40
|
+
formatDate,
|
|
41
|
+
formatValue,
|
|
42
|
+
jsonReplacerBigInt,
|
|
43
|
+
|
|
44
|
+
// Column types
|
|
45
|
+
classifyType,
|
|
46
|
+
typeColor,
|
|
47
|
+
typeLabel,
|
|
48
|
+
|
|
49
|
+
// Hex dump
|
|
50
|
+
generateHexDump,
|
|
51
|
+
|
|
52
|
+
// Error handling
|
|
53
|
+
handleLoadError,
|
|
54
|
+
|
|
55
|
+
// Constants
|
|
56
|
+
WGS84_CODES,
|
|
57
|
+
DEFAULT_TARGET_CRS,
|
|
58
|
+
STORAGE_KEYS,
|
|
59
|
+
} from '@walkthru-earth/objex-utils';
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Exports
|
|
63
|
+
|
|
64
|
+
| Export | Description |
|
|
65
|
+
|--------|-------------|
|
|
66
|
+
| `parseWKB()` | Parse WKB binary into coordinates with geometry type classification |
|
|
67
|
+
| `findGeoColumn()` | 5-priority heuristic to detect geometry columns in tabular data |
|
|
68
|
+
| `buildGeoArrowTables()` | Convert WKB arrays to GeoArrow tables for deck.gl rendering |
|
|
69
|
+
| `parseStorageUrl()` | Parse S3/GCS/Azure/R2 URLs into provider, bucket, key |
|
|
70
|
+
| `readParquetMetadata()` | Read Parquet file metadata via HTTP range requests (hyparquet) |
|
|
71
|
+
| `getFileTypeInfo()` | Map file extensions to viewer kind, category, icon, and MIME type |
|
|
72
|
+
| `formatFileSize()` | Human-readable file sizes (1024-based: KB, MB, GB) |
|
|
73
|
+
| `formatValue()` | Format any value for display (handles BigInt, Date, objects, null) |
|
|
74
|
+
| `generateHexDump()` | Generate hex dump rows from binary data |
|
|
75
|
+
| `classifyType()` | Classify SQL/Arrow column types into categories |
|
|
76
|
+
| `handleLoadError()` | Normalize errors, silently skip AbortError |
|
|
77
|
+
| `WGS84_CODES` | Set of EPSG codes considered WGS84 (4326, 4979) |
|
|
78
|
+
|
|
79
|
+
## Optional Peer Dependencies
|
|
80
|
+
|
|
81
|
+
Heavy dependencies are optional — only install what you use:
|
|
82
|
+
|
|
83
|
+
- `apache-arrow` — required for `buildGeoArrowTables()`
|
|
84
|
+
- `hyparquet` + `hyparquet-compressors` — required for `readParquetMetadata()`
|
|
85
|
+
|
|
86
|
+
## Related
|
|
87
|
+
|
|
88
|
+
- [`@walkthru-earth/objex`](https://www.npmjs.com/package/@walkthru-earth/objex) — Full Svelte 5 component library with viewers, stores, and query engine
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
[CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
|