@honua/react 0.0.20-alpha.0 → 0.1.1-beta.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/contract/discovery.d.ts +231 -0
- package/contract/discovery.d.ts.map +1 -0
- package/contract/discovery.js +554 -0
- package/contract/edit-sketch.d.ts +8 -0
- package/contract/edit-sketch.d.ts.map +1 -1
- package/contract/edit-sketch.js +15 -0
- package/contract/edit-snapping.d.ts +160 -0
- package/contract/edit-snapping.d.ts.map +1 -0
- package/contract/edit-snapping.js +675 -0
- package/contract/generated/projjson-v0.7-crs-validator.d.ts +35 -0
- package/contract/generated/projjson-v0.7-crs-validator.d.ts.map +1 -0
- package/contract/generated/projjson-v0.7-crs-validator.js +3941 -0
- package/contract/index.d.ts +12 -1
- package/contract/index.d.ts.map +1 -1
- package/contract/index.js +4 -0
- package/contract/pmtiles.d.ts +193 -0
- package/contract/pmtiles.d.ts.map +1 -0
- package/contract/pmtiles.js +195 -0
- package/contract/protocol-module.d.ts +70 -0
- package/contract/protocol-module.d.ts.map +1 -0
- package/contract/protocol-module.js +1 -0
- package/contract/schema-envelope.d.ts +26 -0
- package/contract/schema-envelope.d.ts.map +1 -0
- package/contract/schema-envelope.js +25 -0
- package/contract/schema.d.ts +582 -0
- package/contract/schema.d.ts.map +1 -0
- package/contract/schema.js +2483 -0
- package/contract/source-capability-support.d.ts +6 -0
- package/contract/source-capability-support.d.ts.map +1 -0
- package/contract/source-capability-support.js +154 -0
- package/contract/source.d.ts +57 -15
- package/contract/source.d.ts.map +1 -1
- package/contract/source.js +368 -65
- package/contract/types.d.ts +171 -6
- package/contract/types.d.ts.map +1 -1
- package/contract/types.js +14 -14
- package/core/auth/client-credentials-provider.d.ts +51 -0
- package/core/auth/client-credentials-provider.d.ts.map +1 -0
- package/core/auth/client-credentials-provider.js +115 -0
- package/core/auth/credential-store.d.ts +52 -0
- package/core/auth/credential-store.d.ts.map +1 -0
- package/core/auth/credential-store.js +82 -0
- package/core/auth/index.d.ts +23 -0
- package/core/auth/index.d.ts.map +1 -0
- package/core/auth/index.js +20 -0
- package/core/auth/oauth2-provider.d.ts +114 -0
- package/core/auth/oauth2-provider.d.ts.map +1 -0
- package/core/auth/oauth2-provider.js +408 -0
- package/core/auth/pkce.d.ts +25 -0
- package/core/auth/pkce.d.ts.map +1 -0
- package/core/auth/pkce.js +46 -0
- package/core/auth/static-providers.d.ts +20 -0
- package/core/auth/static-providers.d.ts.map +1 -0
- package/core/auth/static-providers.js +26 -0
- package/core/auth/token-endpoint.d.ts +40 -0
- package/core/auth/token-endpoint.d.ts.map +1 -0
- package/core/auth/token-endpoint.js +133 -0
- package/core/auth/types.d.ts +144 -0
- package/core/auth/types.d.ts.map +1 -0
- package/core/auth/types.js +8 -0
- package/core/bounded-json.d.ts +4 -0
- package/core/bounded-json.d.ts.map +1 -0
- package/core/bounded-json.js +38 -0
- package/core/cache-state.d.ts +9 -0
- package/core/cache-state.d.ts.map +1 -1
- package/core/cache-state.js +10 -0
- package/core/capabilities-xml.d.ts +33 -0
- package/core/capabilities-xml.d.ts.map +1 -0
- package/core/capabilities-xml.js +331 -0
- package/core/client.d.ts +35 -2
- package/core/client.d.ts.map +1 -1
- package/core/client.js +167 -29
- package/core/error-classifications.d.ts +153 -0
- package/core/error-classifications.d.ts.map +1 -0
- package/core/error-classifications.js +140 -0
- package/core/error-code-registry.d.ts +158 -0
- package/core/error-code-registry.d.ts.map +1 -0
- package/core/error-code-registry.js +143 -0
- package/core/error-envelope.d.ts +68 -0
- package/core/error-envelope.d.ts.map +1 -0
- package/core/error-envelope.js +357 -0
- package/core/errors.d.ts +73 -25
- package/core/errors.d.ts.map +1 -1
- package/core/errors.js +113 -46
- package/core/geoparquet-sql.d.ts +190 -0
- package/core/geoparquet-sql.d.ts.map +1 -0
- package/core/geoparquet-sql.js +368 -0
- package/core/odata-key-path.d.ts +12 -0
- package/core/odata-key-path.d.ts.map +1 -0
- package/core/odata-key-path.js +28 -0
- package/core/odata-write-codec.d.ts +66 -0
- package/core/odata-write-codec.d.ts.map +1 -0
- package/core/odata-write-codec.js +1083 -0
- package/core/odata.d.ts +59 -7
- package/core/odata.d.ts.map +1 -1
- package/core/odata.js +431 -99
- package/core/ogc-endpoint-layout.d.ts +70 -0
- package/core/ogc-endpoint-layout.d.ts.map +1 -0
- package/core/ogc-endpoint-layout.js +173 -0
- package/core/ogc-features.d.ts.map +1 -1
- package/core/ogc-features.js +35 -17
- package/core/ogc-maps.d.ts +7 -0
- package/core/ogc-maps.d.ts.map +1 -1
- package/core/ogc-maps.js +46 -7
- package/core/ogc-processes.d.ts +2 -1
- package/core/ogc-processes.d.ts.map +1 -1
- package/core/ogc-processes.js +33 -5
- package/core/ogc-records.d.ts +9 -0
- package/core/ogc-records.d.ts.map +1 -1
- package/core/ogc-records.js +78 -29
- package/core/ogc-tiles.d.ts +10 -1
- package/core/ogc-tiles.d.ts.map +1 -1
- package/core/ogc-tiles.js +56 -17
- package/core/path-utils.d.ts +9 -0
- package/core/path-utils.d.ts.map +1 -1
- package/core/path-utils.js +19 -0
- package/core/protocol-transport.d.ts +1 -0
- package/core/protocol-transport.d.ts.map +1 -1
- package/core/request-pipeline.d.ts.map +1 -1
- package/core/request-pipeline.js +1 -1
- package/core/spatial-filter.d.ts +8 -4
- package/core/spatial-filter.d.ts.map +1 -1
- package/core/spatial-filter.js +206 -16
- package/core/stac-static.d.ts +55 -0
- package/core/stac-static.d.ts.map +1 -0
- package/core/stac-static.js +386 -0
- package/core/stac.d.ts +12 -0
- package/core/stac.d.ts.map +1 -1
- package/core/stac.js +45 -15
- package/core/surfaces.d.ts +13 -0
- package/core/surfaces.d.ts.map +1 -1
- package/core/surfaces.js +127 -16
- package/core/types.d.ts +174 -7
- package/core/types.d.ts.map +1 -1
- package/core/wfs-capabilities.d.ts +12 -0
- package/core/wfs-capabilities.d.ts.map +1 -1
- package/core/wfs-capabilities.js +22 -3
- package/core/wfs.d.ts +13 -0
- package/core/wfs.d.ts.map +1 -1
- package/core/wfs.js +35 -5
- package/core/wms-capabilities.d.ts +56 -84
- package/core/wms-capabilities.d.ts.map +1 -1
- package/core/wms-capabilities.js +212 -509
- package/core/wmts-capabilities.d.ts +62 -62
- package/core/wmts-capabilities.d.ts.map +1 -1
- package/core/wmts-capabilities.js +224 -371
- package/esri-compat/editor.d.ts +8 -0
- package/esri-compat/editor.d.ts.map +1 -1
- package/esri-compat/editor.js +13 -0
- package/esri-compat/feature-layer.d.ts +2 -0
- package/esri-compat/feature-layer.d.ts.map +1 -1
- package/esri-compat/feature-layer.js +1 -0
- package/esri-compat/identity-manager.d.ts +43 -0
- package/esri-compat/identity-manager.d.ts.map +1 -1
- package/esri-compat/identity-manager.js +131 -1
- package/esri-compat/layer-list.d.ts +11 -0
- package/esri-compat/layer-list.d.ts.map +1 -1
- package/esri-compat/layer-list.js +49 -0
- package/esri-compat/legend.d.ts +10 -0
- package/esri-compat/legend.d.ts.map +1 -1
- package/esri-compat/legend.js +27 -0
- package/esri-compat/oauth-info.d.ts +15 -0
- package/esri-compat/oauth-info.d.ts.map +1 -1
- package/esri-compat/oauth-info.js +27 -0
- package/esri-compat/portal.d.ts +197 -0
- package/esri-compat/portal.d.ts.map +1 -0
- package/esri-compat/portal.js +251 -0
- package/esri-compat/renderer-objects.d.ts +40 -0
- package/esri-compat/renderer-objects.d.ts.map +1 -0
- package/esri-compat/renderer-objects.js +62 -0
- package/esri-compat/sketch.d.ts +43 -0
- package/esri-compat/sketch.d.ts.map +1 -1
- package/esri-compat/sketch.js +46 -0
- package/esri-compat/snapping.d.ts +43 -0
- package/esri-compat/snapping.d.ts.map +1 -0
- package/esri-compat/snapping.js +45 -0
- package/esri-compat/url.d.ts.map +1 -1
- package/esri-compat/url.js +1 -1
- package/esri-compat/widget-host.d.ts +84 -0
- package/esri-compat/widget-host.d.ts.map +1 -0
- package/esri-compat/widget-host.js +159 -0
- package/filter-registry/index.d.ts +145 -0
- package/filter-registry/index.d.ts.map +1 -0
- package/filter-registry/index.js +531 -0
- package/generated-app/errors.d.ts +18 -2
- package/generated-app/errors.d.ts.map +1 -1
- package/generated-app/errors.js +44 -11
- package/map/automatic-mount-integration.d.ts +134 -0
- package/map/automatic-mount-integration.d.ts.map +1 -0
- package/map/automatic-mount-integration.js +305 -0
- package/map/automatic-source-strategy.d.ts +125 -0
- package/map/automatic-source-strategy.d.ts.map +1 -0
- package/map/automatic-source-strategy.js +494 -0
- package/map/data-to-map-bridge.d.ts +293 -0
- package/map/data-to-map-bridge.d.ts.map +1 -0
- package/map/data-to-map-bridge.js +817 -0
- package/map/geojson-projection.d.ts +33 -0
- package/map/geojson-projection.d.ts.map +1 -0
- package/map/geojson-projection.js +118 -0
- package/map/index.d.ts +14 -0
- package/map/index.d.ts.map +1 -1
- package/map/index.js +8 -0
- package/map/raster-source-spec.d.ts +30 -0
- package/map/raster-source-spec.d.ts.map +1 -0
- package/map/raster-source-spec.js +190 -0
- package/map/raster-source-strategy.d.ts +65 -0
- package/map/raster-source-strategy.d.ts.map +1 -0
- package/map/raster-source-strategy.js +232 -0
- package/map/source-to-maplibre.d.ts +91 -0
- package/map/source-to-maplibre.d.ts.map +1 -0
- package/map/source-to-maplibre.js +454 -0
- package/map/temporal-playback.d.ts +139 -0
- package/map/temporal-playback.d.ts.map +1 -0
- package/map/temporal-playback.js +247 -0
- package/package.json +19 -1
- package/query-planner/canonical.d.ts +7 -0
- package/query-planner/canonical.d.ts.map +1 -0
- package/query-planner/canonical.js +145 -0
- package/query-planner/cql2-json.d.ts +17 -0
- package/query-planner/cql2-json.d.ts.map +1 -0
- package/query-planner/cql2-json.js +646 -0
- package/query-planner/diagnostics.d.ts +35 -0
- package/query-planner/diagnostics.d.ts.map +1 -0
- package/query-planner/diagnostics.js +373 -0
- package/query-planner/duckdb.d.ts +79 -0
- package/query-planner/duckdb.d.ts.map +1 -0
- package/query-planner/duckdb.js +758 -0
- package/query-planner/execution-context.d.ts +5 -0
- package/query-planner/execution-context.d.ts.map +1 -0
- package/query-planner/execution-context.js +50 -0
- package/query-planner/executor.d.ts +5 -0
- package/query-planner/executor.d.ts.map +1 -0
- package/query-planner/executor.js +223 -0
- package/query-planner/geoservices.d.ts +91 -0
- package/query-planner/geoservices.d.ts.map +1 -0
- package/query-planner/geoservices.js +667 -0
- package/query-planner/grpc.d.ts +100 -0
- package/query-planner/grpc.d.ts.map +1 -0
- package/query-planner/grpc.js +736 -0
- package/query-planner/index.d.ts +44 -0
- package/query-planner/index.d.ts.map +1 -0
- package/query-planner/index.js +30 -0
- package/query-planner/ir.d.ts +20 -0
- package/query-planner/ir.d.ts.map +1 -0
- package/query-planner/ir.js +417 -0
- package/query-planner/local-aggregate.d.ts +5 -0
- package/query-planner/local-aggregate.d.ts.map +1 -0
- package/query-planner/local-aggregate.js +126 -0
- package/query-planner/odata.d.ts +48 -0
- package/query-planner/odata.d.ts.map +1 -0
- package/query-planner/odata.js +662 -0
- package/query-planner/ogc-compiler.d.ts +55 -0
- package/query-planner/ogc-compiler.d.ts.map +1 -0
- package/query-planner/ogc-compiler.js +480 -0
- package/query-planner/ogc-features.d.ts +53 -0
- package/query-planner/ogc-features.d.ts.map +1 -0
- package/query-planner/ogc-features.js +617 -0
- package/query-planner/planner.d.ts +17 -0
- package/query-planner/planner.d.ts.map +1 -0
- package/query-planner/planner.js +818 -0
- package/query-planner/resource.d.ts +94 -0
- package/query-planner/resource.d.ts.map +1 -0
- package/query-planner/resource.js +526 -0
- package/query-planner/semantic-canonical.d.ts +15 -0
- package/query-planner/semantic-canonical.d.ts.map +1 -0
- package/query-planner/semantic-canonical.js +62 -0
- package/query-planner/semantic-compat.d.ts +10 -0
- package/query-planner/semantic-compat.d.ts.map +1 -0
- package/query-planner/semantic-compat.js +35 -0
- package/query-planner/semantic-compiler.d.ts +64 -0
- package/query-planner/semantic-compiler.d.ts.map +1 -0
- package/query-planner/semantic-compiler.js +81 -0
- package/query-planner/semantic-literals.d.ts +30 -0
- package/query-planner/semantic-literals.d.ts.map +1 -0
- package/query-planner/semantic-literals.js +133 -0
- package/query-planner/semantic-types.d.ts +265 -0
- package/query-planner/semantic-types.d.ts.map +1 -0
- package/query-planner/semantic-types.js +1 -0
- package/query-planner/semantic.d.ts +54 -0
- package/query-planner/semantic.d.ts.map +1 -0
- package/query-planner/semantic.js +1421 -0
- package/query-planner/types.d.ts +560 -0
- package/query-planner/types.d.ts.map +1 -0
- package/query-planner/types.js +49 -0
- package/query-planner/wfs-semantic.d.ts +58 -0
- package/query-planner/wfs-semantic.d.ts.map +1 -0
- package/query-planner/wfs-semantic.js +547 -0
- package/query-planner/wfs.d.ts +6 -0
- package/query-planner/wfs.d.ts.map +1 -0
- package/query-planner/wfs.js +71 -0
- package/react/external-map.d.ts +67 -0
- package/react/external-map.d.ts.map +1 -0
- package/react/external-map.js +63 -0
- package/react/honua-map.d.ts.map +1 -1
- package/react/honua-map.js +3 -2
- package/react/honua-source-layer.d.ts +110 -0
- package/react/honua-source-layer.d.ts.map +1 -0
- package/react/honua-source-layer.js +101 -0
- package/react/hooks.d.ts +28 -0
- package/react/hooks.d.ts.map +1 -1
- package/react/hooks.js +26 -4
- package/react/index.d.ts +8 -0
- package/react/index.d.ts.map +1 -1
- package/react/index.js +5 -0
- package/react/query-cache.d.ts +26 -4
- package/react/query-cache.d.ts.map +1 -1
- package/react/query-cache.js +51 -8
- package/react/selection.d.ts +177 -0
- package/react/selection.d.ts.map +1 -0
- package/react/selection.js +0 -0
- package/react/use-mounted-source.d.ts +69 -0
- package/react/use-mounted-source.d.ts.map +1 -0
- package/react/use-mounted-source.js +346 -0
- package/runtime/edit-snapping.d.ts +107 -0
- package/runtime/edit-snapping.d.ts.map +1 -0
- package/runtime/edit-snapping.js +190 -0
- package/runtime/errors.d.ts +3 -2
- package/runtime/errors.d.ts.map +1 -1
- package/runtime/errors.js +19 -2
- package/runtime/index.d.ts +8 -2
- package/runtime/index.d.ts.map +1 -1
- package/runtime/index.js +4 -4
- package/runtime/load-package.d.ts.map +1 -1
- package/runtime/load-package.js +8 -0
- package/runtime/map-package-validation.d.ts +0 -13
- package/runtime/map-package-validation.d.ts.map +1 -1
- package/runtime/map-package-validation.js +0 -12
- package/runtime/map-package.d.ts +1 -1
- package/runtime/map-package.d.ts.map +1 -1
- package/runtime/maplibre-renderer.d.ts +41 -0
- package/runtime/maplibre-renderer.d.ts.map +1 -0
- package/runtime/maplibre-renderer.js +322 -0
- package/runtime/pmtiles-protocol.d.ts +77 -0
- package/runtime/pmtiles-protocol.d.ts.map +1 -0
- package/runtime/pmtiles-protocol.js +120 -0
- package/runtime/query-tiles.d.ts +2 -1
- package/runtime/query-tiles.d.ts.map +1 -1
- package/runtime/query-tiles.js +6 -2
- package/runtime/source-bridge.d.ts +4 -4
- package/runtime/source-bridge.d.ts.map +1 -1
- package/runtime/source-bridge.js +36 -56
- package/runtime/style-interactions.d.ts +3 -2
- package/runtime/style-interactions.d.ts.map +1 -1
- package/runtime/style-interactions.js +11 -3
- package/runtime/terra-draw-sketch.d.ts +275 -0
- package/runtime/terra-draw-sketch.d.ts.map +1 -0
- package/runtime/terra-draw-sketch.js +404 -0
- package/source-capability-registry.d.ts +1 -0
- package/source-capability-registry.js +1 -0
- package/source-capability-types.d.ts +186 -0
- package/source-capability-types.js +7 -0
- package/style/index.d.ts +2 -0
- package/style/index.d.ts.map +1 -1
- package/style/index.js +2 -0
- package/style/renderers.d.ts +326 -0
- package/style/renderers.d.ts.map +1 -0
- package/style/renderers.js +517 -0
- package/webmap/convert-renderer.d.ts +24 -3
- package/webmap/convert-renderer.d.ts.map +1 -1
- package/webmap/convert-renderer.js +93 -112
- package/webmap/index.d.ts +1 -1
- package/webmap/index.d.ts.map +1 -1
- package/webmap/index.js +1 -1
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared, serialization-safe error contract for public Honua SDK failures.
|
|
3
|
+
*
|
|
4
|
+
* Error instances retain their original `message`, `cause`, and legacy detail
|
|
5
|
+
* fields for local debugging. Use {@link serializeHonuaError} at telemetry or
|
|
6
|
+
* process boundaries: it emits only registered classifications and sanitized
|
|
7
|
+
* context, never messages, stacks, response bodies, or cause payloads.
|
|
8
|
+
*/
|
|
9
|
+
import { HONUA_ERROR_RUNTIME_CLASSIFICATIONS } from "./error-classifications.js";
|
|
10
|
+
export const HONUA_ERROR_KIND = "honua.sdk.error.v1";
|
|
11
|
+
/** Base class for every migrated public SDK error. */
|
|
12
|
+
export class HonuaSdkError extends Error {
|
|
13
|
+
kind = HONUA_ERROR_KIND;
|
|
14
|
+
domain;
|
|
15
|
+
/** Globally unique registry code. Legacy subclasses may retain a separate `.code`. */
|
|
16
|
+
sdkCode;
|
|
17
|
+
category;
|
|
18
|
+
retryable;
|
|
19
|
+
operationId;
|
|
20
|
+
requestId;
|
|
21
|
+
context;
|
|
22
|
+
constructor(code, message, options = {}) {
|
|
23
|
+
const [domain, category, retryable] = errorCodeClassification(code);
|
|
24
|
+
super(message, "cause" in options ? { cause: options.cause } : undefined);
|
|
25
|
+
this.name = "HonuaSdkError";
|
|
26
|
+
this.domain = domain;
|
|
27
|
+
this.sdkCode = code;
|
|
28
|
+
this.category = category;
|
|
29
|
+
this.retryable = retryable;
|
|
30
|
+
this.operationId = sanitizeIdentifier(options.operationId);
|
|
31
|
+
this.requestId = sanitizeIdentifier(options.requestId);
|
|
32
|
+
this.context = sanitizeHonuaErrorContext(options.context);
|
|
33
|
+
}
|
|
34
|
+
/** Safe JSON projection. Raw messages, stacks, details, bodies, and causes are intentionally omitted. */
|
|
35
|
+
toJSON() {
|
|
36
|
+
return serializeHonuaError(this);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/** Cross-realm type guard backed by the public tag and registered code. */
|
|
40
|
+
export function isHonuaSdkError(error) {
|
|
41
|
+
try {
|
|
42
|
+
if (!isRecord(error) || Array.isArray(error))
|
|
43
|
+
return false;
|
|
44
|
+
const kind = ownDataProperty(error, "kind");
|
|
45
|
+
const sdkCode = ownDataProperty(error, "sdkCode");
|
|
46
|
+
if (kind !== HONUA_ERROR_KIND || typeof sdkCode !== "string" || !isHonuaErrorCode(sdkCode))
|
|
47
|
+
return false;
|
|
48
|
+
const [domain, category, retryable] = HONUA_ERROR_RUNTIME_CLASSIFICATIONS[sdkCode];
|
|
49
|
+
const context = ownDataProperty(error, "context");
|
|
50
|
+
const name = ownDataProperty(error, "name");
|
|
51
|
+
return (ownDataProperty(error, "domain") === domain &&
|
|
52
|
+
ownDataProperty(error, "retryable") === retryable &&
|
|
53
|
+
ownDataProperty(error, "category") === category &&
|
|
54
|
+
typeof name === "string" &&
|
|
55
|
+
isRecord(context) &&
|
|
56
|
+
!Array.isArray(context));
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/** Serialize a tagged SDK error without crossing its redaction boundary. */
|
|
63
|
+
export function serializeHonuaError(error) {
|
|
64
|
+
const sdkCode = ownDataProperty(error, "sdkCode");
|
|
65
|
+
if (typeof sdkCode !== "string" || !isHonuaErrorCode(sdkCode)) {
|
|
66
|
+
throw new TypeError("Cannot serialize an SDK error with an unregistered code");
|
|
67
|
+
}
|
|
68
|
+
const [domain, category, retryable] = HONUA_ERROR_RUNTIME_CLASSIFICATIONS[sdkCode];
|
|
69
|
+
const cause = serializeCause(ownDataProperty(error, "cause"));
|
|
70
|
+
const operationId = sanitizeIdentifier(asOptionalString(ownDataProperty(error, "operationId")));
|
|
71
|
+
const requestId = sanitizeIdentifier(asOptionalString(ownDataProperty(error, "requestId")));
|
|
72
|
+
const context = ownDataProperty(error, "context");
|
|
73
|
+
return {
|
|
74
|
+
kind: HONUA_ERROR_KIND,
|
|
75
|
+
name: sanitizeErrorName(ownDataProperty(error, "name")),
|
|
76
|
+
domain,
|
|
77
|
+
code: sdkCode,
|
|
78
|
+
category,
|
|
79
|
+
retryable,
|
|
80
|
+
...(operationId ? { operationId } : {}),
|
|
81
|
+
...(requestId ? { requestId } : {}),
|
|
82
|
+
context: isRecord(context) && !Array.isArray(context) ? sanitizeHonuaErrorContext(context) : emptyContext(),
|
|
83
|
+
...(cause ? { cause } : {}),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/** Redact structured context before it is stored on an SDK error. */
|
|
87
|
+
export function sanitizeHonuaErrorContext(context) {
|
|
88
|
+
if (!context)
|
|
89
|
+
return emptyContext();
|
|
90
|
+
try {
|
|
91
|
+
const seen = new WeakSet();
|
|
92
|
+
const sanitized = sanitizeRecord(context, seen, 0);
|
|
93
|
+
return Object.freeze(sanitized);
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return frozenRecord("value", "[UNSERIALIZABLE]");
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/** Merge context inputs without invoking enumerable accessors or honoring prototype-manipulation keys. */
|
|
100
|
+
export function mergeHonuaErrorContext(...contexts) {
|
|
101
|
+
const merged = Object.create(null);
|
|
102
|
+
let unsafeKeyCount = 0;
|
|
103
|
+
for (const context of contexts) {
|
|
104
|
+
if (!context)
|
|
105
|
+
continue;
|
|
106
|
+
for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(context))) {
|
|
107
|
+
if (!descriptor.enumerable)
|
|
108
|
+
continue;
|
|
109
|
+
if (UNSAFE_PROPERTY_KEY.test(key)) {
|
|
110
|
+
unsafeKeyCount += 1;
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
merged[key] = "value" in descriptor ? descriptor.value : "[ACCESSOR]";
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (unsafeKeyCount > 0)
|
|
117
|
+
merged.__redacted_keys__ = unsafeKeyCount;
|
|
118
|
+
return merged;
|
|
119
|
+
}
|
|
120
|
+
export function isHonuaErrorCode(code) {
|
|
121
|
+
return Object.hasOwn(HONUA_ERROR_RUNTIME_CLASSIFICATIONS, code);
|
|
122
|
+
}
|
|
123
|
+
/** @internal True only for a valid tagged retryable network or timeout classification. */
|
|
124
|
+
export function isRetryableNetworkOrTimeoutHonuaError(error) {
|
|
125
|
+
try {
|
|
126
|
+
if (!isHonuaSdkError(error))
|
|
127
|
+
return false;
|
|
128
|
+
const sdkCode = ownDataProperty(error, "sdkCode");
|
|
129
|
+
if (typeof sdkCode !== "string" || !isHonuaErrorCode(sdkCode))
|
|
130
|
+
return false;
|
|
131
|
+
const [, category, retryable] = HONUA_ERROR_RUNTIME_CLASSIFICATIONS[sdkCode];
|
|
132
|
+
return retryable && (category === "network" || category === "timeout");
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function errorCodeClassification(code) {
|
|
139
|
+
if (!isHonuaErrorCode(code))
|
|
140
|
+
throw new TypeError(`Unregistered Honua SDK error code: ${code}`);
|
|
141
|
+
return HONUA_ERROR_RUNTIME_CLASSIFICATIONS[code];
|
|
142
|
+
}
|
|
143
|
+
const REDACTED = "[REDACTED]";
|
|
144
|
+
const TRUNCATED = "[TRUNCATED]";
|
|
145
|
+
const MAX_DEPTH = 6;
|
|
146
|
+
const MAX_PROPERTIES = 100;
|
|
147
|
+
const MAX_ARRAY_ITEMS = 100;
|
|
148
|
+
const MAX_STRING_LENGTH = 2_048;
|
|
149
|
+
const SENSITIVE_KEY = /(?:authorization|proxy-authorization|cookie|set-cookie|credential|password|passwd|secret|token|api[-_]?key|access[-_]?key|access[-_]?id|signature|cursor|resume[-_]?token|where|filter|query|sql|cql|body|payload|form|parameters?)/i;
|
|
150
|
+
const STORAGE_LOCATOR_KEY = /^(?:local[-_]?storage|storage|cache(?:[-_]?file)?|file|filesystem)[-_]?(?:path|directory|url|uri|location)$/i;
|
|
151
|
+
const URL_KEY = /(?:url|uri|href|endpoint|location)$/i;
|
|
152
|
+
function sanitizeRecord(value, seen, depth) {
|
|
153
|
+
if (depth >= MAX_DEPTH)
|
|
154
|
+
return frozenRecord("value", TRUNCATED);
|
|
155
|
+
if (seen.has(value))
|
|
156
|
+
return frozenRecord("value", "[CIRCULAR]");
|
|
157
|
+
seen.add(value);
|
|
158
|
+
const output = Object.create(null);
|
|
159
|
+
const descriptors = Object.entries(Object.getOwnPropertyDescriptors(value))
|
|
160
|
+
.filter(([, descriptor]) => descriptor.enumerable)
|
|
161
|
+
.slice(0, MAX_PROPERTIES);
|
|
162
|
+
let unsafeKeyCount = 0;
|
|
163
|
+
for (const [key, descriptor] of descriptors) {
|
|
164
|
+
if (UNSAFE_PROPERTY_KEY.test(key)) {
|
|
165
|
+
unsafeKeyCount += 1;
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
const item = "value" in descriptor ? descriptor.value : "[ACCESSOR]";
|
|
169
|
+
output[key] =
|
|
170
|
+
SENSITIVE_KEY.test(key) || STORAGE_LOCATOR_KEY.test(key) ? REDACTED : sanitizeValue(item, key, seen, depth + 1);
|
|
171
|
+
}
|
|
172
|
+
if (unsafeKeyCount > 0)
|
|
173
|
+
output.__redacted_keys__ = unsafeKeyCount;
|
|
174
|
+
if (Reflect.ownKeys(value).length > descriptors.length)
|
|
175
|
+
output.__truncated__ = TRUNCATED;
|
|
176
|
+
seen.delete(value);
|
|
177
|
+
return Object.freeze(output);
|
|
178
|
+
}
|
|
179
|
+
function sanitizeValue(value, key, seen, depth) {
|
|
180
|
+
if (value === null || typeof value === "boolean")
|
|
181
|
+
return value;
|
|
182
|
+
if (typeof value === "number")
|
|
183
|
+
return Number.isFinite(value) ? value : String(value);
|
|
184
|
+
if (typeof value === "string")
|
|
185
|
+
return sanitizeString(value, URL_KEY.test(key));
|
|
186
|
+
if (typeof value === "bigint")
|
|
187
|
+
return value.toString();
|
|
188
|
+
if (typeof value === "undefined")
|
|
189
|
+
return "[UNDEFINED]";
|
|
190
|
+
if (typeof value === "function" || typeof value === "symbol")
|
|
191
|
+
return "[UNSERIALIZABLE]";
|
|
192
|
+
if (value instanceof Error)
|
|
193
|
+
return frozenRecord("name", errorNameWithoutGetters(value));
|
|
194
|
+
if (ArrayBuffer.isView(value) || value instanceof ArrayBuffer)
|
|
195
|
+
return "[BINARY]";
|
|
196
|
+
if (value instanceof Date) {
|
|
197
|
+
const time = Date.prototype.getTime.call(value);
|
|
198
|
+
return Number.isNaN(time) ? "[INVALID_DATE]" : Date.prototype.toISOString.call(value);
|
|
199
|
+
}
|
|
200
|
+
if (Array.isArray(value)) {
|
|
201
|
+
if (depth >= MAX_DEPTH)
|
|
202
|
+
return TRUNCATED;
|
|
203
|
+
if (seen.has(value))
|
|
204
|
+
return "[CIRCULAR]";
|
|
205
|
+
seen.add(value);
|
|
206
|
+
const result = value
|
|
207
|
+
.slice(0, MAX_ARRAY_ITEMS)
|
|
208
|
+
.map((item) => sanitizeValue(item, key, seen, depth + 1));
|
|
209
|
+
if (value.length > result.length)
|
|
210
|
+
result.push(TRUNCATED);
|
|
211
|
+
seen.delete(value);
|
|
212
|
+
return Object.freeze(result);
|
|
213
|
+
}
|
|
214
|
+
if (isRecord(value))
|
|
215
|
+
return sanitizeRecord(value, seen, depth);
|
|
216
|
+
return "[UNSERIALIZABLE]";
|
|
217
|
+
}
|
|
218
|
+
function sanitizeString(value, urlExpected) {
|
|
219
|
+
const bounded = value.length > MAX_STRING_LENGTH ? `${value.slice(0, MAX_STRING_LENGTH)}${TRUNCATED}` : value;
|
|
220
|
+
if (urlExpected || /^https?:\/\//i.test(bounded)) {
|
|
221
|
+
try {
|
|
222
|
+
const url = new URL(bounded);
|
|
223
|
+
url.username = "";
|
|
224
|
+
url.password = "";
|
|
225
|
+
for (const key of [...url.searchParams.keys()]) {
|
|
226
|
+
if (isSensitiveQueryParameter(key))
|
|
227
|
+
url.searchParams.set(key, REDACTED);
|
|
228
|
+
}
|
|
229
|
+
url.hash = "";
|
|
230
|
+
return url.toString();
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
if (urlExpected)
|
|
234
|
+
return REDACTED;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return bounded
|
|
238
|
+
.replace(/\bBearer\s+[^\s,;]+/gi, `Bearer ${REDACTED}`)
|
|
239
|
+
.replace(/\b(access_token|refresh_token|api[-_]?key|password|passwd|secret|token|cursor|resume[-_]?token)\s*[:=]\s*([^\s,;&]+)/gi, (_match, name) => `${name}=${REDACTED}`);
|
|
240
|
+
}
|
|
241
|
+
function sanitizeIdentifier(value) {
|
|
242
|
+
if (value === undefined)
|
|
243
|
+
return undefined;
|
|
244
|
+
return /^[A-Za-z0-9][A-Za-z0-9._:/-]{0,255}$/.test(value) ? value : REDACTED;
|
|
245
|
+
}
|
|
246
|
+
function asOptionalString(value) {
|
|
247
|
+
return typeof value === "string" ? value : undefined;
|
|
248
|
+
}
|
|
249
|
+
function serializeCause(cause) {
|
|
250
|
+
if (cause === undefined)
|
|
251
|
+
return undefined;
|
|
252
|
+
try {
|
|
253
|
+
if (isHonuaSdkError(cause)) {
|
|
254
|
+
const sdkCode = ownDataProperty(cause, "sdkCode");
|
|
255
|
+
if (typeof sdkCode !== "string" || !isHonuaErrorCode(sdkCode))
|
|
256
|
+
return { name: "Error" };
|
|
257
|
+
const [domain, category, retryable] = HONUA_ERROR_RUNTIME_CLASSIFICATIONS[sdkCode];
|
|
258
|
+
return {
|
|
259
|
+
name: sanitizeErrorName(ownDataProperty(cause, "name")),
|
|
260
|
+
domain,
|
|
261
|
+
code: sdkCode,
|
|
262
|
+
category,
|
|
263
|
+
retryable,
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
if (cause instanceof Error)
|
|
267
|
+
return { name: errorNameWithoutGetters(cause) };
|
|
268
|
+
return { name: typeof cause };
|
|
269
|
+
}
|
|
270
|
+
catch {
|
|
271
|
+
return { name: "Error" };
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
function isRecord(value) {
|
|
275
|
+
return value !== null && typeof value === "object";
|
|
276
|
+
}
|
|
277
|
+
function ownDataProperty(value, key) {
|
|
278
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
279
|
+
return descriptor && "value" in descriptor ? descriptor.value : undefined;
|
|
280
|
+
}
|
|
281
|
+
function sanitizeErrorName(value) {
|
|
282
|
+
return typeof value === "string" && SAFE_ERROR_NAMES.has(value) ? value : "Error";
|
|
283
|
+
}
|
|
284
|
+
function errorNameWithoutGetters(error) {
|
|
285
|
+
try {
|
|
286
|
+
const ownName = ownDataProperty(error, "name");
|
|
287
|
+
if (typeof ownName === "string")
|
|
288
|
+
return sanitizeErrorName(ownName);
|
|
289
|
+
const prototype = Object.getPrototypeOf(error);
|
|
290
|
+
return prototype ? sanitizeErrorName(ownDataProperty(prototype, "name")) : "Error";
|
|
291
|
+
}
|
|
292
|
+
catch {
|
|
293
|
+
return "Error";
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
function isSensitiveQueryParameter(key) {
|
|
297
|
+
const normalized = key.toLocaleLowerCase("en-US").replace(/[^a-z0-9]+/g, "");
|
|
298
|
+
return (normalized === "key" ||
|
|
299
|
+
/(?:accesstoken|refreshtoken|securitytoken|accesskeyid|accessid|credential|authorization|apikey|signature|password|passwd|secret|cursor|resumetoken|continuationtoken|filter|where|query|sql|cql|auth|sig)$/.test(normalized));
|
|
300
|
+
}
|
|
301
|
+
const UNSAFE_PROPERTY_KEY = /^(?:__proto__|prototype|constructor)$/;
|
|
302
|
+
const SAFE_ERROR_NAMES = new Set([
|
|
303
|
+
"AbortError",
|
|
304
|
+
"AggregateError",
|
|
305
|
+
"ConnectError",
|
|
306
|
+
"DOMException",
|
|
307
|
+
"Error",
|
|
308
|
+
"EvalError",
|
|
309
|
+
"HonuaAbortError",
|
|
310
|
+
"HonuaAgentExecutionError",
|
|
311
|
+
"HonuaAgentSafetyError",
|
|
312
|
+
"HonuaAgentToolError",
|
|
313
|
+
"HonuaAuthError",
|
|
314
|
+
"HonuaAutomaticMapLibreIntegrationError",
|
|
315
|
+
"HonuaAutomaticMapLibreStrategyError",
|
|
316
|
+
"HonuaCapabilityNotSupportedError",
|
|
317
|
+
"HonuaDataToMapBridgeError",
|
|
318
|
+
"HonuaDiscoveryError",
|
|
319
|
+
"HonuaExplorationContextError",
|
|
320
|
+
"HonuaGeneratedAppError",
|
|
321
|
+
"HonuaGrpcError",
|
|
322
|
+
"HonuaHttpError",
|
|
323
|
+
"HonuaJobFailedError",
|
|
324
|
+
"HonuaMapLibreRasterStrategyError",
|
|
325
|
+
"HonuaMapLibreSourceAdapterError",
|
|
326
|
+
"HonuaMapPackageError",
|
|
327
|
+
"HonuaNetworkError",
|
|
328
|
+
"HonuaOfflineRegionError",
|
|
329
|
+
"HonuaPluginRegistryError",
|
|
330
|
+
"HonuaQueryPlanExecutionError",
|
|
331
|
+
"HonuaQueryPlanningError",
|
|
332
|
+
"HonuaRealtimeResumeError",
|
|
333
|
+
"HonuaReplicaSyncError",
|
|
334
|
+
"HonuaRuntimeDiagnosticError",
|
|
335
|
+
"HonuaSdkError",
|
|
336
|
+
"HonuaTemporalPlaybackError",
|
|
337
|
+
"HonuaTimeoutError",
|
|
338
|
+
"HonuaWfsExceptionError",
|
|
339
|
+
"HonuaWmsCapabilitiesParseError",
|
|
340
|
+
"HonuaWmtsCapabilitiesParseError",
|
|
341
|
+
"NetworkError",
|
|
342
|
+
"QueryTileServerResponseError",
|
|
343
|
+
"RangeError",
|
|
344
|
+
"ReferenceError",
|
|
345
|
+
"SyntaxError",
|
|
346
|
+
"TimeoutError",
|
|
347
|
+
"TypeError",
|
|
348
|
+
"URIError",
|
|
349
|
+
]);
|
|
350
|
+
function emptyContext() {
|
|
351
|
+
return Object.freeze(Object.create(null));
|
|
352
|
+
}
|
|
353
|
+
function frozenRecord(key, value) {
|
|
354
|
+
const record = Object.create(null);
|
|
355
|
+
record[key] = value;
|
|
356
|
+
return Object.freeze(record);
|
|
357
|
+
}
|
package/core/errors.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Tagged hierarchy for the migrated Honua SDK error domains. The common
|
|
3
|
+
* `isHonuaError(error)` guard also recognizes migrated query, map, runtime,
|
|
4
|
+
* realtime, offline, and plugin subclasses. See
|
|
5
|
+
* [`docs/errors.md`](../../docs/errors.md) for exact coverage, residual domains,
|
|
6
|
+
* recovery hints, and the retryability classification.
|
|
6
7
|
*
|
|
7
8
|
* @example
|
|
8
9
|
* ```ts
|
|
@@ -29,9 +30,26 @@
|
|
|
29
30
|
*
|
|
30
31
|
* @packageDocumentation
|
|
31
32
|
*/
|
|
32
|
-
import {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
import { type HonuaErrorMetadata, type HonuaErrorOptions, HonuaSdkError } from "./error-envelope.js";
|
|
34
|
+
export type HonuaDiscoveryErrorCode = "ambiguous-protocol" | "ambiguous-source" | "invalid-endpoint" | "invalid-cache-identity" | "invalid-discovery-cache" | "invalid-capability" | "unsupported-protocol" | "protocol-mismatch";
|
|
35
|
+
/** Discovery input, metadata, or cache identity is invalid or inconsistent. */
|
|
36
|
+
export declare class HonuaDiscoveryError extends HonuaSdkError {
|
|
37
|
+
readonly code: HonuaDiscoveryErrorCode;
|
|
38
|
+
readonly detail?: Readonly<Record<string, unknown>> | undefined;
|
|
39
|
+
constructor(code: HonuaDiscoveryErrorCode, message: string, detail?: Readonly<Record<string, unknown>> | undefined, options?: HonuaErrorOptions);
|
|
40
|
+
}
|
|
41
|
+
/** Stable reason codes for geometry inputs that cannot be classified safely. */
|
|
42
|
+
export type HonuaGeometryErrorCode = "unknown-geometry" | "malformed-geometry";
|
|
43
|
+
/**
|
|
44
|
+
* Thrown when a geometry cannot be classified without guessing. The structured
|
|
45
|
+
* `code` and `detail` fields let callers distinguish an unsupported shape from
|
|
46
|
+
* a recognized-but-malformed Esri geometry without parsing the message.
|
|
47
|
+
*/
|
|
48
|
+
export declare class HonuaGeometryError extends HonuaSdkError {
|
|
49
|
+
readonly code: HonuaGeometryErrorCode;
|
|
50
|
+
readonly detail?: Readonly<Record<string, unknown>> | undefined;
|
|
51
|
+
constructor(code: HonuaGeometryErrorCode, message: string, detail?: Readonly<Record<string, unknown>> | undefined, options?: HonuaErrorOptions);
|
|
52
|
+
}
|
|
35
53
|
/**
|
|
36
54
|
* Thrown when the server returns a non-2xx HTTP status. Branch on
|
|
37
55
|
* `.statusCode` to decide recovery: refresh credentials on 401/403, respect
|
|
@@ -39,30 +57,30 @@ import { HonuaWmtsCapabilitiesParseError } from "./wmts-capabilities.js";
|
|
|
39
57
|
*
|
|
40
58
|
* @see [`docs/errors.md`](../../docs/errors.md)
|
|
41
59
|
*/
|
|
42
|
-
export declare class HonuaHttpError extends
|
|
60
|
+
export declare class HonuaHttpError extends HonuaSdkError {
|
|
43
61
|
readonly statusCode: number;
|
|
44
62
|
readonly body: unknown;
|
|
45
|
-
constructor(statusCode: number, message: string, body: unknown);
|
|
63
|
+
constructor(statusCode: number, message: string, body: unknown, options?: HonuaErrorOptions);
|
|
46
64
|
}
|
|
47
65
|
/** Thrown when a request exceeds the configured timeout. */
|
|
48
|
-
export declare class HonuaTimeoutError extends
|
|
66
|
+
export declare class HonuaTimeoutError extends HonuaSdkError {
|
|
49
67
|
readonly timeoutMs: number;
|
|
50
|
-
constructor(timeoutMs: number);
|
|
68
|
+
constructor(timeoutMs: number, options?: HonuaErrorOptions);
|
|
51
69
|
}
|
|
52
70
|
/** Thrown when a network-level failure occurs (DNS, connection refused, etc.). */
|
|
53
|
-
export declare class HonuaNetworkError extends
|
|
71
|
+
export declare class HonuaNetworkError extends HonuaSdkError {
|
|
54
72
|
readonly cause: unknown;
|
|
55
|
-
constructor(message: string, cause: unknown);
|
|
73
|
+
constructor(message: string, cause: unknown, metadata?: HonuaErrorMetadata);
|
|
56
74
|
}
|
|
57
75
|
/** Thrown when a request is aborted via a caller-provided AbortSignal. */
|
|
58
|
-
export declare class HonuaAbortError extends
|
|
59
|
-
constructor(message?: string);
|
|
76
|
+
export declare class HonuaAbortError extends HonuaSdkError {
|
|
77
|
+
constructor(message?: string, options?: HonuaErrorOptions);
|
|
60
78
|
}
|
|
61
79
|
/** Thrown when a gRPC-Web request fails, wrapping the underlying ConnectError. */
|
|
62
|
-
export declare class HonuaGrpcError extends
|
|
80
|
+
export declare class HonuaGrpcError extends HonuaSdkError {
|
|
63
81
|
readonly code: number;
|
|
64
82
|
readonly details: unknown;
|
|
65
|
-
constructor(code: number, message: string, details?: unknown);
|
|
83
|
+
constructor(code: number, message: string, details?: unknown, options?: HonuaErrorOptions);
|
|
66
84
|
}
|
|
67
85
|
/**
|
|
68
86
|
* Thrown when a `Source` is asked to perform an operation that the underlying
|
|
@@ -71,11 +89,41 @@ export declare class HonuaGrpcError extends Error {
|
|
|
71
89
|
* decide whether to swap protocols, fall back to a degraded strategy, or
|
|
72
90
|
* surface the limitation to the user.
|
|
73
91
|
*/
|
|
74
|
-
export declare class HonuaCapabilityNotSupportedError extends
|
|
92
|
+
export declare class HonuaCapabilityNotSupportedError extends HonuaSdkError {
|
|
75
93
|
readonly capability: string;
|
|
76
94
|
readonly protocol: string;
|
|
77
95
|
readonly sourceId: string | undefined;
|
|
78
|
-
constructor(capability: string, protocol: string, sourceId?: string);
|
|
96
|
+
constructor(capability: string, protocol: string, sourceId?: string, options?: HonuaErrorOptions);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Cause codes for {@link HonuaAuthError}. They classify *why* an auth flow
|
|
100
|
+
* could not produce a usable credential so callers can branch without parsing
|
|
101
|
+
* message strings:
|
|
102
|
+
*
|
|
103
|
+
* - `interaction_required` — no cached credential and no way to obtain one
|
|
104
|
+
* silently (no refresh token, or the refresh token is gone). The app must
|
|
105
|
+
* start an interactive sign-in (`oauth2(...).signIn()`).
|
|
106
|
+
* - `refresh_failed` — a silent refresh attempt failed for a transient reason
|
|
107
|
+
* (network/5xx/timeout at the token endpoint). Retrying later may succeed.
|
|
108
|
+
* - `invalid_grant` — the authorization server rejected the grant
|
|
109
|
+
* (`error: "invalid_grant"`): the refresh token or authorization code is
|
|
110
|
+
* expired/revoked/invalid. The stored credential is cleared and interactive
|
|
111
|
+
* sign-in is required.
|
|
112
|
+
*/
|
|
113
|
+
export type HonuaAuthErrorCode = "interaction_required" | "refresh_failed" | "invalid_grant";
|
|
114
|
+
/**
|
|
115
|
+
* Thrown by the auth providers (`oauth2`, `clientCredentials`, …) when a
|
|
116
|
+
* credential cannot be produced. Branch on `.code` (see {@link HonuaAuthErrorCode})
|
|
117
|
+
* to decide whether to start interactive sign-in, retry the refresh later, or
|
|
118
|
+
* surface the failure to the user. The underlying transport/parse failure, when
|
|
119
|
+
* present, is preserved on `.cause`.
|
|
120
|
+
*
|
|
121
|
+
* @see [`docs/errors.md`](../../docs/errors.md)
|
|
122
|
+
*/
|
|
123
|
+
export declare class HonuaAuthError extends HonuaSdkError {
|
|
124
|
+
readonly code: HonuaAuthErrorCode;
|
|
125
|
+
readonly cause: unknown;
|
|
126
|
+
constructor(code: HonuaAuthErrorCode, message: string, options?: HonuaErrorOptions);
|
|
79
127
|
}
|
|
80
128
|
/**
|
|
81
129
|
* Thrown when an `ExplorationContext` operation is invalid — for example,
|
|
@@ -83,9 +131,9 @@ export declare class HonuaCapabilityNotSupportedError extends Error {
|
|
|
83
131
|
* an incompatible snapshot, or binding a view that requests a slice that is
|
|
84
132
|
* not exposed by the current dataset.
|
|
85
133
|
*/
|
|
86
|
-
export declare class HonuaExplorationContextError extends
|
|
134
|
+
export declare class HonuaExplorationContextError extends HonuaSdkError {
|
|
87
135
|
readonly code: string;
|
|
88
|
-
constructor(code: string, message: string);
|
|
136
|
+
constructor(code: string, message: string, options?: HonuaErrorOptions);
|
|
89
137
|
}
|
|
90
138
|
/**
|
|
91
139
|
* Thrown when a WFS server replies with an `ows:ExceptionReport`. Carries the
|
|
@@ -95,13 +143,13 @@ export declare class HonuaExplorationContextError extends Error {
|
|
|
95
143
|
* `src/core/wfs-capabilities.ts`; raw access lives behind the `protocol("wfs")`
|
|
96
144
|
* escape hatch.
|
|
97
145
|
*/
|
|
98
|
-
export declare class HonuaWfsExceptionError extends
|
|
146
|
+
export declare class HonuaWfsExceptionError extends HonuaSdkError {
|
|
99
147
|
readonly exceptionCode: string;
|
|
100
148
|
readonly locator: string | undefined;
|
|
101
|
-
constructor(exceptionCode: string, message: string, locator?: string);
|
|
149
|
+
constructor(exceptionCode: string, message: string, locator?: string, options?: HonuaErrorOptions);
|
|
102
150
|
}
|
|
103
|
-
/**
|
|
104
|
-
export type HonuaError =
|
|
151
|
+
/** Any public SDK error participating in the tagged envelope. */
|
|
152
|
+
export type HonuaError = HonuaSdkError;
|
|
105
153
|
/** Type guard that narrows any value to one of the Honua SDK error types. */
|
|
106
154
|
export declare function isHonuaError(error: unknown): error is HonuaError;
|
|
107
155
|
//# sourceMappingURL=errors.d.ts.map
|
package/core/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/core/errors.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/core/errors.ts"],"names":[],"mappings":"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"}
|