@honua/sdk-esri-compat 0.0.6-alpha.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 +5 -0
- package/contract/edit-session.d.ts +203 -0
- package/contract/edit-session.d.ts.map +1 -0
- package/contract/edit-session.js +717 -0
- package/contract/index.d.ts +20 -0
- package/contract/index.d.ts.map +1 -0
- package/contract/index.js +15 -0
- package/contract/jobs.d.ts +115 -0
- package/contract/jobs.d.ts.map +1 -0
- package/contract/jobs.js +22 -0
- package/contract/source.d.ts +138 -0
- package/contract/source.d.ts.map +1 -0
- package/contract/source.js +3364 -0
- package/contract/spatial-aggregation.d.ts +312 -0
- package/contract/spatial-aggregation.d.ts.map +1 -0
- package/contract/spatial-aggregation.js +196 -0
- package/contract/types.d.ts +542 -0
- package/contract/types.d.ts.map +1 -0
- package/contract/types.js +171 -0
- package/core/batch.d.ts +37 -0
- package/core/batch.d.ts.map +1 -0
- package/core/batch.js +78 -0
- package/core/cache-state.d.ts +76 -0
- package/core/cache-state.d.ts.map +1 -0
- package/core/cache-state.js +84 -0
- package/core/client.d.ts +289 -0
- package/core/client.d.ts.map +1 -0
- package/core/client.js +2625 -0
- package/core/errors.d.ts +68 -0
- package/core/errors.d.ts.map +1 -0
- package/core/errors.js +116 -0
- package/core/grpc-adapter.d.ts +23 -0
- package/core/grpc-adapter.d.ts.map +1 -0
- package/core/grpc-adapter.js +704 -0
- package/core/odata.d.ts +347 -0
- package/core/odata.d.ts.map +1 -0
- package/core/odata.js +837 -0
- package/core/ogc-conformance.d.ts +35 -0
- package/core/ogc-conformance.d.ts.map +1 -0
- package/core/ogc-conformance.js +121 -0
- package/core/ogc-maps.d.ts +45 -0
- package/core/ogc-maps.d.ts.map +1 -0
- package/core/ogc-maps.js +53 -0
- package/core/ogc-processes.d.ts +92 -0
- package/core/ogc-processes.d.ts.map +1 -0
- package/core/ogc-processes.js +325 -0
- package/core/ogc-tiles.d.ts +55 -0
- package/core/ogc-tiles.d.ts.map +1 -0
- package/core/ogc-tiles.js +81 -0
- package/core/pbf-decoder.d.ts +28 -0
- package/core/pbf-decoder.d.ts.map +1 -0
- package/core/pbf-decoder.js +627 -0
- package/core/query-builder.d.ts +261 -0
- package/core/query-builder.d.ts.map +1 -0
- package/core/query-builder.js +538 -0
- package/core/spatial-filter.d.ts +93 -0
- package/core/spatial-filter.d.ts.map +1 -0
- package/core/spatial-filter.js +153 -0
- package/core/stac.d.ts +43 -0
- package/core/stac.d.ts.map +1 -0
- package/core/stac.js +116 -0
- package/core/surfaces.d.ts +464 -0
- package/core/surfaces.d.ts.map +1 -0
- package/core/surfaces.js +1322 -0
- package/core/types.d.ts +1238 -0
- package/core/types.d.ts.map +1 -0
- package/core/types.js +13 -0
- package/core/wfs-capabilities.d.ts +143 -0
- package/core/wfs-capabilities.d.ts.map +1 -0
- package/core/wfs-capabilities.js +478 -0
- package/core/wfs-filter.d.ts +118 -0
- package/core/wfs-filter.d.ts.map +1 -0
- package/core/wfs-filter.js +586 -0
- package/core/wfs.d.ts +219 -0
- package/core/wfs.d.ts.map +1 -0
- package/core/wfs.js +406 -0
- package/core/wms-capabilities.d.ts +110 -0
- package/core/wms-capabilities.d.ts.map +1 -0
- package/core/wms-capabilities.js +566 -0
- package/core/wms-types.d.ts +128 -0
- package/core/wms-types.d.ts.map +1 -0
- package/core/wms-types.js +32 -0
- package/core/wms.d.ts +108 -0
- package/core/wms.d.ts.map +1 -0
- package/core/wms.js +182 -0
- package/core/wmts-capabilities.d.ts +82 -0
- package/core/wmts-capabilities.d.ts.map +1 -0
- package/core/wmts-capabilities.js +409 -0
- package/core/wmts.d.ts +80 -0
- package/core/wmts.d.ts.map +1 -0
- package/core/wmts.js +173 -0
- package/esri-compat/basemap-gallery.d.ts +38 -0
- package/esri-compat/basemap-gallery.d.ts.map +1 -0
- package/esri-compat/basemap-gallery.js +159 -0
- package/esri-compat/basemap-layer-list.d.ts +35 -0
- package/esri-compat/basemap-layer-list.d.ts.map +1 -0
- package/esri-compat/basemap-layer-list.js +139 -0
- package/esri-compat/basemap.d.ts +32 -0
- package/esri-compat/basemap.d.ts.map +1 -0
- package/esri-compat/basemap.js +84 -0
- package/esri-compat/bookmarks.d.ts +36 -0
- package/esri-compat/bookmarks.d.ts.map +1 -0
- package/esri-compat/bookmarks.js +108 -0
- package/esri-compat/class-breaks-renderer.d.ts +50 -0
- package/esri-compat/class-breaks-renderer.d.ts.map +1 -0
- package/esri-compat/class-breaks-renderer.js +164 -0
- package/esri-compat/color.d.ts +22 -0
- package/esri-compat/color.d.ts.map +1 -0
- package/esri-compat/color.js +106 -0
- package/esri-compat/controls.d.ts +174 -0
- package/esri-compat/controls.d.ts.map +1 -0
- package/esri-compat/controls.js +479 -0
- package/esri-compat/coordinate-conversion.d.ts +41 -0
- package/esri-compat/coordinate-conversion.d.ts.map +1 -0
- package/esri-compat/coordinate-conversion.js +125 -0
- package/esri-compat/directions.d.ts +45 -0
- package/esri-compat/directions.d.ts.map +1 -0
- package/esri-compat/directions.js +123 -0
- package/esri-compat/editor.d.ts +47 -0
- package/esri-compat/editor.d.ts.map +1 -0
- package/esri-compat/editor.js +170 -0
- package/esri-compat/esri-config.d.ts +16 -0
- package/esri-compat/esri-config.d.ts.map +1 -0
- package/esri-compat/esri-config.js +23 -0
- package/esri-compat/esri-request.d.ts +17 -0
- package/esri-compat/esri-request.d.ts.map +1 -0
- package/esri-compat/esri-request.js +66 -0
- package/esri-compat/event-bus.d.ts +106 -0
- package/esri-compat/event-bus.d.ts.map +1 -0
- package/esri-compat/event-bus.js +90 -0
- package/esri-compat/expand.d.ts +36 -0
- package/esri-compat/expand.d.ts.map +1 -0
- package/esri-compat/expand.js +97 -0
- package/esri-compat/extent.d.ts +43 -0
- package/esri-compat/extent.d.ts.map +1 -0
- package/esri-compat/extent.js +140 -0
- package/esri-compat/feature-form.d.ts +64 -0
- package/esri-compat/feature-form.d.ts.map +1 -0
- package/esri-compat/feature-form.js +137 -0
- package/esri-compat/feature-layer.d.ts +173 -0
- package/esri-compat/feature-layer.d.ts.map +1 -0
- package/esri-compat/feature-layer.js +655 -0
- package/esri-compat/feature-set.d.ts +32 -0
- package/esri-compat/feature-set.d.ts.map +1 -0
- package/esri-compat/feature-set.js +80 -0
- package/esri-compat/feature-table.d.ts +141 -0
- package/esri-compat/feature-table.d.ts.map +1 -0
- package/esri-compat/feature-table.js +500 -0
- package/esri-compat/feature-templates.d.ts +41 -0
- package/esri-compat/feature-templates.d.ts.map +1 -0
- package/esri-compat/feature-templates.js +97 -0
- package/esri-compat/feature.d.ts +33 -0
- package/esri-compat/feature.d.ts.map +1 -0
- package/esri-compat/feature.js +83 -0
- package/esri-compat/graphic.d.ts +46 -0
- package/esri-compat/graphic.d.ts.map +1 -0
- package/esri-compat/graphic.js +103 -0
- package/esri-compat/graphics-layer.d.ts +49 -0
- package/esri-compat/graphics-layer.d.ts.map +1 -0
- package/esri-compat/graphics-layer.js +185 -0
- package/esri-compat/group-layer.d.ts +48 -0
- package/esri-compat/group-layer.d.ts.map +1 -0
- package/esri-compat/group-layer.js +212 -0
- package/esri-compat/identify.d.ts +71 -0
- package/esri-compat/identify.d.ts.map +1 -0
- package/esri-compat/identify.js +299 -0
- package/esri-compat/identity-manager.d.ts +31 -0
- package/esri-compat/identity-manager.d.ts.map +1 -0
- package/esri-compat/identity-manager.js +115 -0
- package/esri-compat/label-class.d.ts +31 -0
- package/esri-compat/label-class.d.ts.map +1 -0
- package/esri-compat/label-class.js +102 -0
- package/esri-compat/layer-list.d.ts +77 -0
- package/esri-compat/layer-list.d.ts.map +1 -0
- package/esri-compat/layer-list.js +342 -0
- package/esri-compat/legend.d.ts +53 -0
- package/esri-compat/legend.d.ts.map +1 -0
- package/esri-compat/legend.js +254 -0
- package/esri-compat/map-image-layer.d.ts +162 -0
- package/esri-compat/map-image-layer.d.ts.map +1 -0
- package/esri-compat/map-image-layer.js +704 -0
- package/esri-compat/map-view.d.ts +315 -0
- package/esri-compat/map-view.d.ts.map +1 -0
- package/esri-compat/map-view.js +1110 -0
- package/esri-compat/map.d.ts +47 -0
- package/esri-compat/map.d.ts.map +1 -0
- package/esri-compat/map.js +209 -0
- package/esri-compat/measurement-2d.d.ts +61 -0
- package/esri-compat/measurement-2d.d.ts.map +1 -0
- package/esri-compat/measurement-2d.js +184 -0
- package/esri-compat/measurement.d.ts +45 -0
- package/esri-compat/measurement.d.ts.map +1 -0
- package/esri-compat/measurement.js +193 -0
- package/esri-compat/oauth-info.d.ts +35 -0
- package/esri-compat/oauth-info.d.ts.map +1 -0
- package/esri-compat/oauth-info.js +115 -0
- package/esri-compat/picture-marker-symbol.d.ts +35 -0
- package/esri-compat/picture-marker-symbol.d.ts.map +1 -0
- package/esri-compat/picture-marker-symbol.js +126 -0
- package/esri-compat/point.d.ts +31 -0
- package/esri-compat/point.d.ts.map +1 -0
- package/esri-compat/point.js +102 -0
- package/esri-compat/polygon.d.ts +31 -0
- package/esri-compat/polygon.d.ts.map +1 -0
- package/esri-compat/polygon.js +107 -0
- package/esri-compat/polyline.d.ts +31 -0
- package/esri-compat/polyline.d.ts.map +1 -0
- package/esri-compat/polyline.js +107 -0
- package/esri-compat/popup-template.d.ts +55 -0
- package/esri-compat/popup-template.d.ts.map +1 -0
- package/esri-compat/popup-template.js +128 -0
- package/esri-compat/popup.d.ts +54 -0
- package/esri-compat/popup.d.ts.map +1 -0
- package/esri-compat/popup.js +312 -0
- package/esri-compat/print.d.ts +47 -0
- package/esri-compat/print.d.ts.map +1 -0
- package/esri-compat/print.js +105 -0
- package/esri-compat/query.d.ts +46 -0
- package/esri-compat/query.d.ts.map +1 -0
- package/esri-compat/query.js +119 -0
- package/esri-compat/reactive-utils.d.ts +23 -0
- package/esri-compat/reactive-utils.d.ts.map +1 -0
- package/esri-compat/reactive-utils.js +178 -0
- package/esri-compat/request.d.ts +41 -0
- package/esri-compat/request.d.ts.map +1 -0
- package/esri-compat/request.js +253 -0
- package/esri-compat/route-layer.d.ts +59 -0
- package/esri-compat/route-layer.d.ts.map +1 -0
- package/esri-compat/route-layer.js +223 -0
- package/esri-compat/route-task.d.ts +88 -0
- package/esri-compat/route-task.d.ts.map +1 -0
- package/esri-compat/route-task.js +225 -0
- package/esri-compat/scene-view.d.ts +41 -0
- package/esri-compat/scene-view.d.ts.map +1 -0
- package/esri-compat/scene-view.js +68 -0
- package/esri-compat/search.d.ts +112 -0
- package/esri-compat/search.d.ts.map +1 -0
- package/esri-compat/search.js +820 -0
- package/esri-compat/simple-fill-symbol.d.ts +27 -0
- package/esri-compat/simple-fill-symbol.d.ts.map +1 -0
- package/esri-compat/simple-fill-symbol.js +85 -0
- package/esri-compat/simple-line-symbol.d.ts +27 -0
- package/esri-compat/simple-line-symbol.d.ts.map +1 -0
- package/esri-compat/simple-line-symbol.js +85 -0
- package/esri-compat/simple-marker-symbol.d.ts +29 -0
- package/esri-compat/simple-marker-symbol.d.ts.map +1 -0
- package/esri-compat/simple-marker-symbol.js +92 -0
- package/esri-compat/simple-renderer.d.ts +29 -0
- package/esri-compat/simple-renderer.d.ts.map +1 -0
- package/esri-compat/simple-renderer.js +92 -0
- package/esri-compat/sketch.d.ts +64 -0
- package/esri-compat/sketch.d.ts.map +1 -0
- package/esri-compat/sketch.js +227 -0
- package/esri-compat/spatial-reference.d.ts +31 -0
- package/esri-compat/spatial-reference.d.ts.map +1 -0
- package/esri-compat/spatial-reference.js +102 -0
- package/esri-compat/swipe.d.ts +34 -0
- package/esri-compat/swipe.d.ts.map +1 -0
- package/esri-compat/swipe.js +93 -0
- package/esri-compat/table-list.d.ts +36 -0
- package/esri-compat/table-list.d.ts.map +1 -0
- package/esri-compat/table-list.js +126 -0
- package/esri-compat/text-symbol.d.ts +37 -0
- package/esri-compat/text-symbol.d.ts.map +1 -0
- package/esri-compat/text-symbol.js +123 -0
- package/esri-compat/tile-layer.d.ts +52 -0
- package/esri-compat/tile-layer.d.ts.map +1 -0
- package/esri-compat/tile-layer.js +167 -0
- package/esri-compat/time-slider.d.ts +70 -0
- package/esri-compat/time-slider.d.ts.map +1 -0
- package/esri-compat/time-slider.js +208 -0
- package/esri-compat/track.d.ts +51 -0
- package/esri-compat/track.d.ts.map +1 -0
- package/esri-compat/track.js +174 -0
- package/esri-compat/unique-value-renderer.d.ts +41 -0
- package/esri-compat/unique-value-renderer.d.ts.map +1 -0
- package/esri-compat/unique-value-renderer.js +127 -0
- package/esri-compat/url.d.ts +12 -0
- package/esri-compat/url.d.ts.map +1 -0
- package/esri-compat/url.js +54 -0
- package/esri-compat/web-map.d.ts +14 -0
- package/esri-compat/web-map.d.ts.map +1 -0
- package/esri-compat/web-map.js +24 -0
- package/gen/honua/v1/feature_service_pb.d.ts +918 -0
- package/gen/honua/v1/feature_service_pb.d.ts.map +1 -0
- package/gen/honua/v1/feature_service_pb.js +375 -0
- package/index.d.ts +130 -0
- package/index.js +65 -0
- package/package.json +22 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create an envelope (bounding box) spatial filter.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* const req: QueryFeaturesRequest = {
|
|
7
|
+
* serviceId: "svc", layerId: 0,
|
|
8
|
+
* ...envelope(-118.5, 33.7, -117.5, 34.2),
|
|
9
|
+
* };
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export function envelope(xmin, ymin, xmax, ymax, spatialReference) {
|
|
13
|
+
const geometry = { xmin, ymin, xmax, ymax };
|
|
14
|
+
if (spatialReference)
|
|
15
|
+
geometry.spatialReference = spatialReference;
|
|
16
|
+
return {
|
|
17
|
+
geometry,
|
|
18
|
+
geometryType: "esriGeometryEnvelope",
|
|
19
|
+
spatialRel: "esriSpatialRelIntersects",
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Create a point spatial filter.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const req: QueryFeaturesRequest = {
|
|
28
|
+
* serviceId: "svc", layerId: 0,
|
|
29
|
+
* ...point(-118.24, 34.05),
|
|
30
|
+
* };
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export function point(x, y, spatialReference) {
|
|
34
|
+
const geometry = { x, y };
|
|
35
|
+
if (spatialReference)
|
|
36
|
+
geometry.spatialReference = spatialReference;
|
|
37
|
+
return {
|
|
38
|
+
geometry,
|
|
39
|
+
geometryType: "esriGeometryPoint",
|
|
40
|
+
spatialRel: "esriSpatialRelIntersects",
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Create a polygon spatial filter from an array of rings.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* const req: QueryFeaturesRequest = {
|
|
49
|
+
* serviceId: "svc", layerId: 0,
|
|
50
|
+
* ...polygon([[[-118, 34], [-117, 34], [-117, 35], [-118, 35], [-118, 34]]]),
|
|
51
|
+
* };
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export function polygon(rings, spatialReference) {
|
|
55
|
+
const geometry = { rings };
|
|
56
|
+
if (spatialReference)
|
|
57
|
+
geometry.spatialReference = spatialReference;
|
|
58
|
+
return {
|
|
59
|
+
geometry,
|
|
60
|
+
geometryType: "esriGeometryPolygon",
|
|
61
|
+
spatialRel: "esriSpatialRelIntersects",
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Create an envelope spatial filter centered on a point, approximating a
|
|
66
|
+
* circular buffer as a bounding box.
|
|
67
|
+
*
|
|
68
|
+
* @param x - Center x coordinate
|
|
69
|
+
* @param y - Center y coordinate
|
|
70
|
+
* @param distance - Half-width of the envelope in coordinate units
|
|
71
|
+
* @param spatialReference - Optional spatial reference
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* // 0.5-degree bounding box around a point
|
|
76
|
+
* const req: QueryFeaturesRequest = {
|
|
77
|
+
* serviceId: "svc", layerId: 0,
|
|
78
|
+
* ...buffer(-118.24, 34.05, 0.5),
|
|
79
|
+
* };
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export function buffer(x, y, distance, spatialReference) {
|
|
83
|
+
return envelope(x - distance, y - distance, x + distance, y + distance, spatialReference);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Wrap an existing geometry with `esriSpatialRelIntersects`.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```ts
|
|
90
|
+
* const filter = spatialIntersects({ xmin: -180, ymin: -90, xmax: 180, ymax: 90 });
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export function spatialIntersects(geometry) {
|
|
94
|
+
return {
|
|
95
|
+
geometry,
|
|
96
|
+
geometryType: detectGeometryType(geometry),
|
|
97
|
+
spatialRel: "esriSpatialRelIntersects",
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Wrap an existing geometry with `esriSpatialRelContains`.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* const filter = spatialContains({ rings: [[[-118, 34], [-117, 34], [-117, 35], [-118, 35], [-118, 34]]] });
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export function spatialContains(geometry) {
|
|
109
|
+
return {
|
|
110
|
+
geometry,
|
|
111
|
+
geometryType: detectGeometryType(geometry),
|
|
112
|
+
spatialRel: "esriSpatialRelContains",
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Wrap an existing geometry with `esriSpatialRelWithin`.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* const filter = spatialWithin({ rings: [[[-118, 34], [-117, 34], [-117, 35], [-118, 35], [-118, 34]]] });
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
export function spatialWithin(geometry) {
|
|
124
|
+
return {
|
|
125
|
+
geometry,
|
|
126
|
+
geometryType: detectGeometryType(geometry),
|
|
127
|
+
spatialRel: "esriSpatialRelWithin",
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Detect the Esri geometry type from a plain geometry object by inspecting
|
|
132
|
+
* its shape (duck-typing).
|
|
133
|
+
*
|
|
134
|
+
* @internal
|
|
135
|
+
*/
|
|
136
|
+
function detectGeometryType(geometry) {
|
|
137
|
+
if ("xmin" in geometry && "ymin" in geometry && "xmax" in geometry && "ymax" in geometry) {
|
|
138
|
+
return "esriGeometryEnvelope";
|
|
139
|
+
}
|
|
140
|
+
if ("rings" in geometry) {
|
|
141
|
+
return "esriGeometryPolygon";
|
|
142
|
+
}
|
|
143
|
+
if ("paths" in geometry) {
|
|
144
|
+
return "esriGeometryPolyline";
|
|
145
|
+
}
|
|
146
|
+
if ("points" in geometry) {
|
|
147
|
+
return "esriGeometryMultipoint";
|
|
148
|
+
}
|
|
149
|
+
if ("x" in geometry && "y" in geometry) {
|
|
150
|
+
return "esriGeometryPoint";
|
|
151
|
+
}
|
|
152
|
+
return "esriGeometryPoint";
|
|
153
|
+
}
|
package/core/stac.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* STAC API search surface. STAC builds on OGC API Features, so this
|
|
3
|
+
* class wraps the STAC catalog landing, collections listing, items, and
|
|
4
|
+
* cross-collection search endpoints. The wire calls live on
|
|
5
|
+
* `HonuaClient`; this class is the request-shaping layer on top.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type { HonuaClient } from "./client.js";
|
|
10
|
+
import type { HonuaOgcCollectionMetadata, HonuaOgcCollectionsResponse, HonuaStacItemCollectionResponse, HonuaStacItemResponse, HonuaStacLandingResponse, OgcCollectionRequest, OgcMetadataRequest, StacSearchRequest } from "./types.js";
|
|
11
|
+
export interface HonuaStacSearchOptions {
|
|
12
|
+
client: HonuaClient;
|
|
13
|
+
}
|
|
14
|
+
export interface HonuaStacSearchAllRequest extends StacSearchRequest {
|
|
15
|
+
/** Maximum number of items to materialize across pages. */
|
|
16
|
+
pageSize?: number;
|
|
17
|
+
/** Hard cap on the number of pages to fetch (defaults to 100). */
|
|
18
|
+
maxPages?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* STAC API entry point. Discovery (`landing`, `collections`,
|
|
22
|
+
* `collection`) plus search (`search`, `searchAll`, `searchStream`) and
|
|
23
|
+
* item fetch.
|
|
24
|
+
*/
|
|
25
|
+
export declare class HonuaStacSearch {
|
|
26
|
+
readonly client: HonuaClient;
|
|
27
|
+
constructor(options: HonuaStacSearchOptions);
|
|
28
|
+
landing(request?: OgcMetadataRequest): Promise<HonuaStacLandingResponse>;
|
|
29
|
+
collections(request?: OgcMetadataRequest): Promise<HonuaOgcCollectionsResponse>;
|
|
30
|
+
collection(request: OgcCollectionRequest): Promise<HonuaOgcCollectionMetadata>;
|
|
31
|
+
item(request: {
|
|
32
|
+
collectionId: string | number;
|
|
33
|
+
itemId: string | number;
|
|
34
|
+
signal?: AbortSignal;
|
|
35
|
+
responseFormat?: string;
|
|
36
|
+
extraParams?: Record<string, string | number | boolean>;
|
|
37
|
+
}): Promise<HonuaStacItemResponse>;
|
|
38
|
+
search(request?: StacSearchRequest): Promise<HonuaStacItemCollectionResponse>;
|
|
39
|
+
searchAll(request?: HonuaStacSearchAllRequest): Promise<HonuaStacItemResponse[]>;
|
|
40
|
+
searchStream(request?: HonuaStacSearchAllRequest): AsyncGenerator<HonuaStacItemResponse[], void, undefined>;
|
|
41
|
+
}
|
|
42
|
+
export declare function createHonuaStacSearch(client: HonuaClient): HonuaStacSearch;
|
|
43
|
+
//# sourceMappingURL=stac.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stac.d.ts","sourceRoot":"","sources":["../../../src/core/stac.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EACV,0BAA0B,EAC1B,2BAA2B,EAC3B,+BAA+B,EAC/B,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,yBAA0B,SAAQ,iBAAiB;IAClE,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAKD;;;;GAIG;AACH,qBAAa,eAAe;IAC1B,SAAgB,MAAM,EAAE,WAAW,CAAC;gBAEjB,OAAO,EAAE,sBAAsB;IAIrC,OAAO,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAI5E,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,2BAA2B,CAAC;IAInF,UAAU,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAI9E,IAAI,CAAC,OAAO,EAAE;QACzB,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;QAC9B,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;QACxB,MAAM,CAAC,EAAE,WAAW,CAAC;QACrB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;KACzD,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAIrB,MAAM,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,+BAA+B,CAAC;IAIjF,SAAS,CAAC,OAAO,GAAE,yBAA8B,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAsBnF,YAAY,CACxB,OAAO,GAAE,yBAA8B,GACtC,cAAc,CAAC,qBAAqB,EAAE,EAAE,IAAI,EAAE,SAAS,CAAC;CAmB5D;AAkCD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,WAAW,GAAG,eAAe,CAE1E"}
|
package/core/stac.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* STAC API search surface. STAC builds on OGC API Features, so this
|
|
3
|
+
* class wraps the STAC catalog landing, collections listing, items, and
|
|
4
|
+
* cross-collection search endpoints. The wire calls live on
|
|
5
|
+
* `HonuaClient`; this class is the request-shaping layer on top.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
const DEFAULT_STAC_PAGE_SIZE = 100;
|
|
10
|
+
const DEFAULT_STAC_MAX_PAGES = 100;
|
|
11
|
+
/**
|
|
12
|
+
* STAC API entry point. Discovery (`landing`, `collections`,
|
|
13
|
+
* `collection`) plus search (`search`, `searchAll`, `searchStream`) and
|
|
14
|
+
* item fetch.
|
|
15
|
+
*/
|
|
16
|
+
export class HonuaStacSearch {
|
|
17
|
+
client;
|
|
18
|
+
constructor(options) {
|
|
19
|
+
this.client = options.client;
|
|
20
|
+
}
|
|
21
|
+
async landing(request = {}) {
|
|
22
|
+
return this.client.getStacLanding(request);
|
|
23
|
+
}
|
|
24
|
+
async collections(request = {}) {
|
|
25
|
+
return this.client.listStacCollections(request);
|
|
26
|
+
}
|
|
27
|
+
async collection(request) {
|
|
28
|
+
return this.client.getStacCollection(request);
|
|
29
|
+
}
|
|
30
|
+
async item(request) {
|
|
31
|
+
return this.client.getStacItem(request);
|
|
32
|
+
}
|
|
33
|
+
async search(request = {}) {
|
|
34
|
+
return this.client.searchStac(request);
|
|
35
|
+
}
|
|
36
|
+
async searchAll(request = {}) {
|
|
37
|
+
const pageSize = request.pageSize ?? request.limit ?? DEFAULT_STAC_PAGE_SIZE;
|
|
38
|
+
const maxPages = request.maxPages ?? DEFAULT_STAC_MAX_PAGES;
|
|
39
|
+
const items = [];
|
|
40
|
+
let cursor = { offset: request.offset, next: request.next };
|
|
41
|
+
for (let page = 0; page < maxPages; page += 1) {
|
|
42
|
+
const response = await this.client.searchStac({
|
|
43
|
+
...request,
|
|
44
|
+
limit: pageSize,
|
|
45
|
+
offset: cursor.offset,
|
|
46
|
+
next: cursor.next,
|
|
47
|
+
});
|
|
48
|
+
const pageItems = response.features ?? [];
|
|
49
|
+
if (pageItems.length === 0)
|
|
50
|
+
break;
|
|
51
|
+
items.push(...pageItems);
|
|
52
|
+
cursor = nextStacCursor(response.links);
|
|
53
|
+
if (cursor.offset === undefined && cursor.next === undefined)
|
|
54
|
+
break;
|
|
55
|
+
if (pageItems.length < pageSize)
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
return items;
|
|
59
|
+
}
|
|
60
|
+
async *searchStream(request = {}) {
|
|
61
|
+
const pageSize = request.pageSize ?? request.limit ?? DEFAULT_STAC_PAGE_SIZE;
|
|
62
|
+
const maxPages = request.maxPages ?? DEFAULT_STAC_MAX_PAGES;
|
|
63
|
+
let cursor = { offset: request.offset, next: request.next };
|
|
64
|
+
for (let page = 0; page < maxPages; page += 1) {
|
|
65
|
+
const response = await this.client.searchStac({
|
|
66
|
+
...request,
|
|
67
|
+
limit: pageSize,
|
|
68
|
+
offset: cursor.offset,
|
|
69
|
+
next: cursor.next,
|
|
70
|
+
});
|
|
71
|
+
const pageItems = response.features ?? [];
|
|
72
|
+
if (pageItems.length === 0)
|
|
73
|
+
break;
|
|
74
|
+
yield pageItems;
|
|
75
|
+
cursor = nextStacCursor(response.links);
|
|
76
|
+
if (cursor.offset === undefined && cursor.next === undefined)
|
|
77
|
+
break;
|
|
78
|
+
if (pageItems.length < pageSize)
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Resolve the next-page cursor for STAC paging. honua-server emits a
|
|
85
|
+
* `rel=next` link with `?offset=N` on the href; some non-Honua STAC
|
|
86
|
+
* servers emit `?next=…` opaque tokens instead. Prefer `offset` when the
|
|
87
|
+
* link carries it, otherwise fall back to `next`. When the server omits
|
|
88
|
+
* a usable `rel=next` link, return an empty cursor so the caller stops.
|
|
89
|
+
*/
|
|
90
|
+
function nextStacCursor(links) {
|
|
91
|
+
if (!links)
|
|
92
|
+
return {};
|
|
93
|
+
for (const link of links) {
|
|
94
|
+
if (link.rel !== "next" || typeof link.href !== "string")
|
|
95
|
+
continue;
|
|
96
|
+
try {
|
|
97
|
+
const url = new URL(link.href, "https://placeholder.test");
|
|
98
|
+
const offsetParam = url.searchParams.get("offset");
|
|
99
|
+
if (offsetParam !== null) {
|
|
100
|
+
const offset = Number(offsetParam);
|
|
101
|
+
if (Number.isFinite(offset))
|
|
102
|
+
return { offset };
|
|
103
|
+
}
|
|
104
|
+
const nextParam = url.searchParams.get("next");
|
|
105
|
+
if (nextParam !== null)
|
|
106
|
+
return { next: nextParam };
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
// ignore unparsable hrefs; keep scanning for a usable link
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return {};
|
|
113
|
+
}
|
|
114
|
+
export function createHonuaStacSearch(client) {
|
|
115
|
+
return new HonuaStacSearch({ client });
|
|
116
|
+
}
|