@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.cjs +71 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +68 -18
- package/dist/index.js.map +1 -1
- package/docs/app-config.md +4 -4
- package/docs/cog-asset.md +3 -3
- package/docs/lru.md +2 -2
- package/docs/map-pixel-inspect.md +2 -2
- package/docs/stac-hydrate.md +19 -19
- package/docs/stac-source.md +15 -15
- package/package.json +1 -1
package/docs/app-config.md
CHANGED
|
@@ -178,10 +178,10 @@ function resolveBasemap(
|
|
|
178
178
|
|
|
179
179
|
Pick the basemap a map should render. Pick order:
|
|
180
180
|
|
|
181
|
-
1. **Explicit user pick**
|
|
182
|
-
2. **Configured default for the variant**
|
|
183
|
-
3. **First basemap matching the variant**
|
|
184
|
-
4. **First basemap of any variant**
|
|
181
|
+
1. **Explicit user pick** - the basemap whose `id` equals `userId`, but only if it still exists in the configured list (a stale `userId` from local storage is ignored).
|
|
182
|
+
2. **Configured default for the variant** - the basemap whose `id` equals `config.defaultBasemap[variant]`, when present and still in the list.
|
|
183
|
+
3. **First basemap matching the variant** - the first entry with `variant` equal to the requested variant.
|
|
184
|
+
4. **First basemap of any variant** - `config.basemaps[0]`.
|
|
185
185
|
|
|
186
186
|
Returns `undefined` only when no basemaps are configured (`config.basemaps` is empty), signalling the caller to fall back to its own hardcoded default.
|
|
187
187
|
|
package/docs/cog-asset.md
CHANGED
|
@@ -116,9 +116,9 @@ Pick the most natural and most performant default composite for an item.
|
|
|
116
116
|
|
|
117
117
|
**Priority** (first match wins):
|
|
118
118
|
|
|
119
|
-
1. **`'visual-asset'`**
|
|
120
|
-
2. **`'rgb-bands'`**
|
|
121
|
-
3. **`'fallback'`**
|
|
119
|
+
1. **`'visual-asset'`** - a 3-band pre-baked visual asset (`bandCount === 3` and either `roles` contains `visual` or `eoCommon` contains all of `red`/`green`/`blue`). All three channels bind to that one asset, using the `eoCommon` index for each color where present and falling back to bands 0/1/2. Single-layer path, one decoder, fastest.
|
|
120
|
+
2. **`'rgb-bands'`** - separate single-band assets resolvable by common name, where `eoCommon[0]` is `red`, `green`, and `blue` respectively across three distinct assets. Each channel binds to its asset at band 0.
|
|
121
|
+
3. **`'fallback'`** - the first three raster assets, band 0 each. When fewer than three assets exist, the single remaining asset is reused for all three channels: R at band 0, G at `min(1, last)`, B at `min(2, last)`, where `last = max(0, bandCount - 1)`.
|
|
122
122
|
|
|
123
123
|
**Returns** `{ composite, source }`, or `null` when `assets` is empty.
|
|
124
124
|
|
package/docs/lru.md
CHANGED
|
@@ -15,8 +15,8 @@ interface LruCacheOptions<K, V> {
|
|
|
15
15
|
}
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
- `max`
|
|
19
|
-
- `onEvict`
|
|
18
|
+
- `max` - maximum number of entries. Must be `> 0`. The constructor throws `Error('LruCache: max must be > 0')` for any non-positive value.
|
|
19
|
+
- `onEvict` - optional callback invoked whenever an entry leaves the cache, whether through LRU overflow, an explicit `delete()`, or `clear()`. Use it to release the cached resource (revoke a blob URL, null a GeoTIFF header, etc.).
|
|
20
20
|
|
|
21
21
|
## Class
|
|
22
22
|
|
|
@@ -54,8 +54,8 @@ interface PixelInspectCallbacks<T> {
|
|
|
54
54
|
}
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
- `onStart()`
|
|
58
|
-
- `onResult(result)`
|
|
57
|
+
- `onStart()` - called synchronously when a click is accepted, before the probe is awaited. Use it to set an "inspecting" flag.
|
|
58
|
+
- `onResult(result)` - called once per accepted click after the probe settles. Receives `null` when the probe returned `null` or threw a non-helper-driven error, including an `AbortError` that did NOT originate from this helper's own controller (for example a viewer-teardown or upstream cancel). It is NOT called when a newer click superseded this one via the helper's own controller.
|
|
59
59
|
|
|
60
60
|
### `AttachPixelInspectorOptions<T>`
|
|
61
61
|
|
package/docs/stac-hydrate.md
CHANGED
|
@@ -42,14 +42,14 @@ interface HydrateOptions {
|
|
|
42
42
|
}
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
- `signal`
|
|
46
|
-
- `concurrency`
|
|
47
|
-
- `limit`
|
|
48
|
-
- `followPagination`
|
|
49
|
-
- `onBatch`
|
|
50
|
-
- `onProgress`
|
|
51
|
-
- `urlToKey`
|
|
52
|
-
- `itemsQuery`
|
|
45
|
+
- `signal` - required abort signal, threaded into every adapter read and `fetch`.
|
|
46
|
+
- `concurrency` - max parallel fetches for item links and child walks. Default `12`.
|
|
47
|
+
- `limit` - hard cap on items, catalogs larger than this are truncated. Default `2000`.
|
|
48
|
+
- `followPagination` - follow `links[rel=next]` in FeatureCollections. Default `true`.
|
|
49
|
+
- `onBatch` - called with each newly fetched batch for progressive rendering. Items in a batch already have absolutized asset hrefs.
|
|
50
|
+
- `onProgress` - called after each emit with the running item count, `totalHinted` is always `undefined` in the current implementation.
|
|
51
|
+
- `urlToKey` - maps an absolute HTTPS URL to a bucket-relative key when it belongs to the caller's connection. When it returns a non-null string, the fetch routes through `adapter.read` (SigV4) instead of cross-origin `fetch`, so private-bucket catalogs can be walked. Return `null` for foreign origins.
|
|
52
|
+
- `itemsQuery` - optional native STAC API filters appended to the `rel="items"` endpoint and re-stamped on every `rel="next"` page. See `StacItemsQuery`.
|
|
53
53
|
|
|
54
54
|
### `StacItemsQuery`
|
|
55
55
|
|
|
@@ -64,10 +64,10 @@ interface StacItemsQuery {
|
|
|
64
64
|
|
|
65
65
|
Native filters supported by OGC API Features / STAC API on `/items`.
|
|
66
66
|
|
|
67
|
-
- `bbox`
|
|
68
|
-
- `datetime`
|
|
69
|
-
- `limit`
|
|
70
|
-
- `filter`
|
|
67
|
+
- `bbox` - WGS84 `[west, south, east, north]`, stamped as `?bbox=w,s,e,n`.
|
|
68
|
+
- `datetime` - RFC 3339 instant or interval `start/end` (use `..` for open ends).
|
|
69
|
+
- `limit` - per-page item count hint, floored to an integer, the server may cap it.
|
|
70
|
+
- `filter` - a CQL2-JSON filter expression (STAC API Filter extension). When set it is appended as `?filter=<json>&filter-lang=cql2-json` and re-stamped onto every `rel="next"` page so cursor URLs cannot strip it.
|
|
71
71
|
|
|
72
72
|
Each param is only stamped when the URL does not already carry it, so a server that echoes the original filter on its cursor links is not double-stamped (which would corrupt the JSON). `filter` is `JSON.stringify`-ed, a stringify failure (cyclic input) is swallowed and hydration continues without the filter.
|
|
73
73
|
|
|
@@ -98,16 +98,16 @@ function hydrateStacItems(
|
|
|
98
98
|
|
|
99
99
|
Walk `root` into a flat `StacItem[]`.
|
|
100
100
|
|
|
101
|
-
- `root`
|
|
102
|
-
- `baseHref`
|
|
103
|
-
- `adapter`
|
|
104
|
-
- `opts`
|
|
101
|
+
- `root` - the classified payload from `classifyStac`. A `kind: 'none'` root yields an empty, non-truncated result.
|
|
102
|
+
- `baseHref` - the URL `root` was fetched from. All relative hrefs (child links, item links, asset hrefs) resolve against this.
|
|
103
|
+
- `adapter` - the `StorageAdapter` every fetch routes through (see `urlToKey` for the routing rule).
|
|
104
|
+
- `opts` - see `HydrateOptions`.
|
|
105
105
|
|
|
106
106
|
Behavior by `root.kind`:
|
|
107
107
|
|
|
108
|
-
- `item`
|
|
109
|
-
- `item-collection`
|
|
110
|
-
- `collection` / `catalog`
|
|
108
|
+
- `item` - emits the single Item (asset hrefs absolutized against `baseHref`) and returns immediately, never truncated.
|
|
109
|
+
- `item-collection` - accepts every valid feature, then follows `rel="next"` recursively when `followPagination` and the running count is under `limit`. The `itemsQuery` is re-stamped on each next URL.
|
|
110
|
+
- `collection` / `catalog` - if the payload has static `rel="item"` links it fetches them with the worker pool. Otherwise, when no static item links exist, it tries the single `rel="items"` endpoint (with `itemsQuery` applied) and consumes it as a paginated FeatureCollection. A Catalog (or an item-link-less Collection) then also recurses into `rel="child"` links with up to `concurrency` workers, each child re-entering `hydrateStacItems` with a `limit` reduced by the count already gathered.
|
|
111
111
|
|
|
112
112
|
Aborting via `opts.signal` stops the walk, in-flight reads reject with the adapter's abort behavior. Dead links and unreachable children are skipped, not fatal, so a partial catalog still hydrates. The returned `items` is sliced to `limit`.
|
|
113
113
|
|
package/docs/stac-source.md
CHANGED
|
@@ -59,11 +59,11 @@ interface StacSourceCapabilities {
|
|
|
59
59
|
|
|
60
60
|
Read at construction (synchronous) and by the filter UI to decide which controls to disable or badge as "client-side only".
|
|
61
61
|
|
|
62
|
-
- `label`
|
|
63
|
-
- `countAvailable`
|
|
64
|
-
- `streaming`
|
|
65
|
-
- `hivePartitioned`
|
|
66
|
-
- `pushdown`
|
|
62
|
+
- `label` - human-readable HUD label, e.g. `"STAC API"`, `"stac-geoparquet"`, `"Static catalog"`.
|
|
63
|
+
- `countAvailable` - true when a cheap `count(filter, bbox)` exists, so the UI can surface "Y of X".
|
|
64
|
+
- `streaming` - true when `query()` yields multiple batches before completing.
|
|
65
|
+
- `hivePartitioned` - true when the source is a hive-partitioned parquet directory (set by the parquet source). Lets the viewer hint at the discovery model without inspecting `kind === 'parquet'` alone, since the same `kind` also covers single-file stac-geoparquet.
|
|
66
|
+
- `pushdown` - the *ceiling* of what this source kind can push. Exhaustive: every `FacetState` facet has a flag, so adding a new facet is a compile-time error in every consumer until handled. The actual per-request push-down is reported in each batch's `pushedDown`.
|
|
67
67
|
|
|
68
68
|
### `StacSourceRequest`
|
|
69
69
|
|
|
@@ -79,11 +79,11 @@ interface StacSourceRequest {
|
|
|
79
79
|
|
|
80
80
|
Per-query inputs.
|
|
81
81
|
|
|
82
|
-
- `bbox`
|
|
83
|
-
- `filter`
|
|
84
|
-
- `limit`
|
|
85
|
-
- `pageSize`
|
|
86
|
-
- `signal`
|
|
82
|
+
- `bbox` - WGS84 viewport `[west, south, east, north]`, required. Sources that cannot push bbox still receive it, they stream the whole set and rely on the caller's residual filter.
|
|
83
|
+
- `filter` - the active `FacetState` (from `stac-facets`).
|
|
84
|
+
- `limit` - hard item cap for the request.
|
|
85
|
+
- `pageSize` - optional per-page hint for paginating sources, the server may ignore it.
|
|
86
|
+
- `signal` - required. Sources MUST throw `DOMException("Aborted", "AbortError")` on abort, never silently complete.
|
|
87
87
|
|
|
88
88
|
### `StacSourceBatch`
|
|
89
89
|
|
|
@@ -99,11 +99,11 @@ interface StacSourceBatch {
|
|
|
99
99
|
|
|
100
100
|
One yielded batch.
|
|
101
101
|
|
|
102
|
-
- `items`
|
|
103
|
-
- `pushedDown`
|
|
104
|
-
- `residual`
|
|
105
|
-
- `done`
|
|
106
|
-
- `totalHinted`
|
|
102
|
+
- `items` - the items in this batch (empty on the terminal `done` batch).
|
|
103
|
+
- `pushedDown` - the subset of `filter` the source / engine already applied, reported so the UI can show "pushed".
|
|
104
|
+
- `residual` - the subset the caller must still apply via `applyFacets(views, residual)`.
|
|
105
|
+
- `done` - true on the final batch. The iterator's own end-of-iteration also signals completion, this flag lets a caller break the loop the moment a single-yield source finishes.
|
|
106
|
+
- `totalHinted` - best-effort total matching count, when the source knows it.
|
|
107
107
|
|
|
108
108
|
### `StacSource`
|
|
109
109
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkthru-earth/objex-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Pure TypeScript utilities from objex — WKB parser, GeoArrow builder, storage URL parser, file type registry",
|
|
5
5
|
"author": "Youssef Harby <yharby@walkthru.earth>",
|
|
6
6
|
"license": "CC-BY-4.0",
|