@honua/react 0.1.7-beta.0 → 0.1.10-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/control-plane/admin-client.d.ts +89 -0
- package/control-plane/admin-client.d.ts.map +1 -0
- package/control-plane/admin-client.js +200 -0
- package/control-plane/client.d.ts +1 -1
- package/control-plane/client.d.ts.map +1 -1
- package/control-plane/client.js +145 -11
- package/control-plane/commands/catalog.d.ts +133 -0
- package/control-plane/commands/catalog.d.ts.map +1 -0
- package/control-plane/commands/catalog.js +365 -0
- package/control-plane/commands/errors.d.ts +96 -0
- package/control-plane/commands/errors.d.ts.map +1 -0
- package/control-plane/commands/errors.js +130 -0
- package/control-plane/commands/identity.d.ts +71 -0
- package/control-plane/commands/identity.d.ts.map +1 -0
- package/control-plane/commands/identity.js +0 -0
- package/control-plane/commands/index.d.ts +39 -0
- package/control-plane/commands/index.d.ts.map +1 -0
- package/control-plane/commands/index.js +34 -0
- package/control-plane/commands/runtime.d.ts +146 -0
- package/control-plane/commands/runtime.d.ts.map +1 -0
- package/control-plane/commands/runtime.js +330 -0
- package/control-plane/commands/types.d.ts +228 -0
- package/control-plane/commands/types.d.ts.map +1 -0
- package/control-plane/commands/types.js +30 -0
- package/control-plane/commands/validate.d.ts +27 -0
- package/control-plane/commands/validate.d.ts.map +1 -0
- package/control-plane/commands/validate.js +132 -0
- package/control-plane/generated/admin-api.d.ts +30265 -0
- package/control-plane/generated/admin-api.d.ts.map +1 -0
- package/control-plane/generated/admin-api.js +5 -0
- package/control-plane/generated/admin-operations.d.ts +4053 -0
- package/control-plane/generated/admin-operations.d.ts.map +1 -0
- package/control-plane/generated/admin-operations.js +820 -0
- package/control-plane/index.d.ts +11 -0
- package/control-plane/index.d.ts.map +1 -1
- package/control-plane/index.js +8 -0
- package/control-plane/types.d.ts +14 -0
- package/control-plane/types.d.ts.map +1 -1
- package/core/client.d.ts.map +1 -1
- package/core/client.js +29 -31
- package/core/credential-redaction.d.ts +163 -0
- package/core/credential-redaction.d.ts.map +1 -0
- package/core/credential-redaction.js +389 -0
- package/core/error-classifications.d.ts +15 -0
- package/core/error-classifications.d.ts.map +1 -1
- package/core/error-classifications.js +15 -0
- package/core/error-code-registry.d.ts +15 -0
- package/core/error-code-registry.d.ts.map +1 -1
- package/core/error-code-registry.js +15 -0
- package/core/error-envelope.d.ts +31 -0
- package/core/error-envelope.d.ts.map +1 -1
- package/core/error-envelope.js +11 -0
- package/core/errors.d.ts +15 -3
- package/core/errors.d.ts.map +1 -1
- package/core/errors.js +254 -2
- package/core/geometry-input-sr.d.ts +3 -0
- package/core/geometry-input-sr.d.ts.map +1 -0
- package/core/geometry-input-sr.js +28 -0
- package/core/geoservices.d.ts.map +1 -1
- package/core/geoservices.js +33 -6
- package/core/grpc-adapter.d.ts +2 -2
- package/core/grpc-adapter.d.ts.map +1 -1
- package/core/grpc-adapter.js +41 -9
- package/core/job-run-errors.d.ts +10 -0
- package/core/job-run-errors.d.ts.map +1 -0
- package/core/job-run-errors.js +14 -0
- package/core/job-run-lifecycle.d.ts +34 -0
- package/core/job-run-lifecycle.d.ts.map +1 -0
- package/core/job-run-lifecycle.js +193 -0
- package/core/ogc-processes.d.ts +38 -31
- package/core/ogc-processes.d.ts.map +1 -1
- package/core/ogc-processes.js +123 -173
- package/core/pbf-decoder.d.ts.map +1 -1
- package/core/pbf-decoder.js +16 -4
- package/core/process-runner.js +15 -100
- package/core/protocol-transport.d.ts +6 -1
- package/core/protocol-transport.d.ts.map +1 -1
- package/core/request-pipeline.d.ts +6 -3
- package/core/request-pipeline.d.ts.map +1 -1
- package/core/request-pipeline.js +28 -11
- package/core/spatial-filter.d.ts +4 -4
- package/core/spatial-filter.d.ts.map +1 -1
- package/core/spatial-filter.js +7 -7
- package/core/surfaces.d.ts +2 -8
- package/core/surfaces.d.ts.map +1 -1
- package/core/surfaces.js +21 -112
- package/core/types.d.ts +21 -9
- package/core/types.d.ts.map +1 -1
- package/esri-compat/class-breaks-renderer.d.ts +2 -0
- package/esri-compat/class-breaks-renderer.d.ts.map +1 -1
- package/esri-compat/class-breaks-renderer.js +7 -0
- package/esri-compat/controls.d.ts +10 -1
- package/esri-compat/controls.d.ts.map +1 -1
- package/esri-compat/controls.js +86 -2
- package/esri-compat/directions.d.ts +35 -0
- package/esri-compat/directions.d.ts.map +1 -1
- package/esri-compat/directions.js +153 -2
- package/esri-compat/expand.d.ts +1 -0
- package/esri-compat/expand.d.ts.map +1 -1
- package/esri-compat/expand.js +61 -0
- package/esri-compat/feature-layer.d.ts +29 -4
- package/esri-compat/feature-layer.d.ts.map +1 -1
- package/esri-compat/feature-layer.js +335 -13
- package/esri-compat/geometry-engine.d.ts +4 -0
- package/esri-compat/geometry-engine.d.ts.map +1 -1
- package/esri-compat/geometry-engine.js +8 -1
- package/esri-compat/graphic.d.ts +7 -4
- package/esri-compat/graphic.d.ts.map +1 -1
- package/esri-compat/legend.d.ts +2 -1
- package/esri-compat/legend.d.ts.map +1 -1
- package/esri-compat/legend.js +15 -0
- package/esri-compat/map-view-mount.d.ts +48 -0
- package/esri-compat/map-view-mount.d.ts.map +1 -0
- package/esri-compat/map-view-mount.js +344 -0
- package/esri-compat/map-view.d.ts +38 -6
- package/esri-compat/map-view.d.ts.map +1 -1
- package/esri-compat/map-view.js +467 -33
- package/esri-compat/portal.d.ts +2 -0
- package/esri-compat/portal.d.ts.map +1 -1
- package/esri-compat/portal.js +7 -2
- package/esri-compat/renderer-objects.d.ts +7 -2
- package/esri-compat/renderer-objects.d.ts.map +1 -1
- package/esri-compat/renderer-objects.js +16 -5
- package/esri-compat/route-layer.d.ts +8 -0
- package/esri-compat/route-layer.d.ts.map +1 -1
- package/esri-compat/route-layer.js +24 -4
- package/esri-compat/route-task.d.ts +5 -1
- package/esri-compat/route-task.d.ts.map +1 -1
- package/esri-compat/route-task.js +119 -7
- package/esri-compat/scene-view.d.ts.map +1 -1
- package/esri-compat/scene-view.js +1 -0
- package/esri-compat/search.d.ts +2 -1
- package/esri-compat/search.d.ts.map +1 -1
- package/esri-compat/search.js +52 -2
- package/esri-compat/unique-value-renderer.d.ts +2 -0
- package/esri-compat/unique-value-renderer.d.ts.map +1 -1
- package/esri-compat/unique-value-renderer.js +7 -0
- package/esri-compat/web-map.d.ts +10 -0
- package/esri-compat/web-map.d.ts.map +1 -1
- package/esri-compat/web-map.js +102 -0
- package/gen/geospatial/v1/common_pb.d.ts +514 -0
- package/gen/geospatial/v1/common_pb.d.ts.map +1 -0
- package/gen/geospatial/v1/common_pb.js +335 -0
- package/gen/geospatial/v1/execution_types_pb.d.ts +1186 -0
- package/gen/geospatial/v1/execution_types_pb.d.ts.map +1 -0
- package/gen/geospatial/v1/execution_types_pb.js +396 -0
- package/gen/geospatial/v1/feature_service_pb.d.ts +403 -0
- package/gen/geospatial/v1/feature_service_pb.d.ts.map +1 -0
- package/gen/geospatial/v1/feature_service_pb.js +47 -0
- package/gen/geospatial/v1/index.d.ts +5 -0
- package/gen/geospatial/v1/index.d.ts.map +1 -0
- package/gen/geospatial/v1/index.js +9 -0
- package/gen/geospatial/v1/spatial_types_pb.d.ts +285 -0
- package/gen/geospatial/v1/spatial_types_pb.d.ts.map +1 -0
- package/gen/geospatial/v1/spatial_types_pb.js +58 -0
- package/gen/geospatial/v1/workspace_artifact_types_pb.d.ts +379 -0
- package/gen/geospatial/v1/workspace_artifact_types_pb.d.ts.map +1 -0
- package/gen/geospatial/v1/workspace_artifact_types_pb.js +151 -0
- package/generated-app/projection.d.ts.map +1 -1
- package/generated-app/projection.js +10 -1
- package/map/webmap-maplibre.d.ts +2 -1
- package/map/webmap-maplibre.d.ts.map +1 -1
- package/map/webmap-maplibre.js +3 -0
- package/package.json +3 -3
- package/query-planner/geoservices.d.ts.map +1 -1
- package/query-planner/geoservices.js +2 -0
- package/query-planner/grpc.d.ts +4 -4
- package/query-planner/grpc.d.ts.map +1 -1
- package/query-planner/grpc.js +11 -11
- package/query-planner/types.d.ts +6 -4
- package/query-planner/types.d.ts.map +1 -1
- package/realtime/honua-server.d.ts +4 -0
- package/realtime/honua-server.d.ts.map +1 -1
- package/realtime/honua-server.js +10 -0
- package/realtime/resumable.js +9 -0
- package/realtime/types.d.ts +8 -0
- package/realtime/types.d.ts.map +1 -1
- package/runtime/errors.d.ts +1 -1
- package/runtime/errors.d.ts.map +1 -1
- package/runtime/errors.js +2 -0
- package/runtime/generated/map-package-schema-meta.d.ts +11 -0
- package/runtime/generated/map-package-schema-meta.d.ts.map +1 -0
- package/runtime/generated/map-package-schema-meta.js +12 -0
- package/runtime/generated/map-package-schema-validator.d.ts +16 -0
- package/runtime/generated/map-package-schema-validator.d.ts.map +1 -0
- package/runtime/generated/map-package-schema-validator.js +1422 -0
- package/runtime/index.d.ts +5 -1
- package/runtime/index.d.ts.map +1 -1
- package/runtime/index.js +6 -0
- package/runtime/map-package-export.d.ts +151 -0
- package/runtime/map-package-export.d.ts.map +1 -0
- package/runtime/map-package-export.js +636 -0
- package/runtime/map-package-validation.d.ts +21 -1
- package/runtime/map-package-validation.d.ts.map +1 -1
- package/runtime/map-package-validation.js +132 -95
- package/runtime/map-package.d.ts +80 -0
- package/runtime/map-package.d.ts.map +1 -1
- package/studio/capability-manifest.d.ts +10 -0
- package/studio/capability-manifest.d.ts.map +1 -1
- package/studio/capability-manifest.js +38 -0
- package/studio/chart-spec.d.ts +6 -6
- package/studio/chart-spec.d.ts.map +1 -1
- package/studio/chart-spec.js +6 -6
- package/studio/command-adapter.d.ts +35 -0
- package/studio/command-adapter.d.ts.map +1 -0
- package/studio/command-adapter.js +36 -0
- package/studio/generated/studio-api.d.ts +1062 -0
- package/studio/generated/studio-api.d.ts.map +1 -0
- package/studio/generated/studio-api.js +4 -0
- package/studio/index.d.ts +25 -13
- package/studio/index.d.ts.map +1 -1
- package/studio/index.js +21 -10
- package/studio/lifecycle-client.d.ts +262 -22
- package/studio/lifecycle-client.d.ts.map +1 -1
- package/studio/lifecycle-client.js +543 -24
- package/studio/lifecycle-errors.d.ts +8 -2
- package/studio/lifecycle-errors.d.ts.map +1 -1
- package/studio/lifecycle-errors.js +6 -1
- package/studio/lifecycle-types.d.ts +237 -38
- package/studio/lifecycle-types.d.ts.map +1 -1
- package/studio/lifecycle-types.js +5 -12
- package/studio/publication-status.d.ts +55 -0
- package/studio/publication-status.d.ts.map +1 -0
- package/studio/publication-status.js +103 -0
- package/studio/types.d.ts +37 -7
- package/studio/types.d.ts.map +1 -1
- package/studio/types.js +5 -3
- package/studio/validate.d.ts.map +1 -1
- package/studio/validate.js +104 -7
- package/style/renderers.d.ts +6 -1
- package/style/renderers.d.ts.map +1 -1
- package/style/renderers.js +11 -6
- package/style/visual-variables.d.ts +43 -0
- package/style/visual-variables.d.ts.map +1 -0
- package/style/visual-variables.js +183 -0
- package/webmap/convert-layer.d.ts +2 -1
- package/webmap/convert-layer.d.ts.map +1 -1
- package/webmap/convert-layer.js +20 -3
- package/webmap/convert-renderer.d.ts +10 -3
- package/webmap/convert-renderer.d.ts.map +1 -1
- package/webmap/convert-renderer.js +190 -36
- package/webmap/index.d.ts +1 -0
- package/webmap/index.d.ts.map +1 -1
- package/webmap/parse.d.ts +2 -1
- package/webmap/parse.d.ts.map +1 -1
- package/webmap/parse.js +1 -1
- package/gen/honua/v1/feature_service_pb.d.ts +0 -918
- package/gen/honua/v1/feature_service_pb.d.ts.map +0 -1
- package/gen/honua/v1/feature_service_pb.js +0 -375
package/core/errors.d.ts
CHANGED
|
@@ -30,7 +30,17 @@
|
|
|
30
30
|
*
|
|
31
31
|
* @packageDocumentation
|
|
32
32
|
*/
|
|
33
|
-
import { type HonuaErrorMetadata, type HonuaErrorOptions, HonuaSdkError } from "./error-envelope.js";
|
|
33
|
+
import { type HonuaErrorMetadata, type HonuaErrorOptions, type HonuaFailureKind, type HonuaFieldFailure, type HonuaProtocolMetadata, HonuaSdkError, type HonuaTerminalFailureReceipt } from "./error-envelope.js";
|
|
34
|
+
export type { HonuaFailureKind, HonuaFieldFailure, HonuaProtocolMetadata, HonuaTerminalFailureReceipt };
|
|
35
|
+
export interface HonuaHttpErrorOptions extends HonuaErrorOptions {
|
|
36
|
+
readonly responseHeaders?: Pick<Headers, "entries" | "get"> | Readonly<Record<string, string | readonly string[]>>;
|
|
37
|
+
readonly protocolCode?: number | string;
|
|
38
|
+
readonly transportStatus?: number;
|
|
39
|
+
}
|
|
40
|
+
export interface HonuaGrpcErrorOptions extends HonuaErrorOptions {
|
|
41
|
+
readonly initialMetadata?: unknown;
|
|
42
|
+
readonly trailingMetadata?: unknown;
|
|
43
|
+
}
|
|
34
44
|
export type HonuaDiscoveryErrorCode = "ambiguous-protocol" | "ambiguous-source" | "invalid-cloud-native-input" | "invalid-cloud-native-manifest" | "invalid-endpoint" | "invalid-cache-identity" | "invalid-discovery-cache" | "invalid-capability" | "cloud-native-operation-unavailable" | "unsupported-protocol" | "protocol-mismatch";
|
|
35
45
|
/** Discovery input, metadata, or cache identity is invalid or inconsistent. */
|
|
36
46
|
export declare class HonuaDiscoveryError extends HonuaSdkError {
|
|
@@ -60,7 +70,8 @@ export declare class HonuaGeometryError extends HonuaSdkError {
|
|
|
60
70
|
export declare class HonuaHttpError extends HonuaSdkError {
|
|
61
71
|
readonly statusCode: number;
|
|
62
72
|
readonly body: unknown;
|
|
63
|
-
|
|
73
|
+
readonly receipt: HonuaTerminalFailureReceipt;
|
|
74
|
+
constructor(statusCode: number, message: string, body: unknown, options?: HonuaHttpErrorOptions);
|
|
64
75
|
}
|
|
65
76
|
/** Thrown when a request exceeds the configured timeout. */
|
|
66
77
|
export declare class HonuaTimeoutError extends HonuaSdkError {
|
|
@@ -80,7 +91,8 @@ export declare class HonuaAbortError extends HonuaSdkError {
|
|
|
80
91
|
export declare class HonuaGrpcError extends HonuaSdkError {
|
|
81
92
|
readonly code: number;
|
|
82
93
|
readonly details: unknown;
|
|
83
|
-
|
|
94
|
+
readonly receipt: HonuaTerminalFailureReceipt;
|
|
95
|
+
constructor(code: number, message: string, details?: unknown, options?: HonuaGrpcErrorOptions);
|
|
84
96
|
}
|
|
85
97
|
/**
|
|
86
98
|
* Thrown when a `Source` is asked to perform an operation that the underlying
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,aAAa,
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,aAAa,EACb,KAAK,2BAA2B,EAGjC,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,CAAC;AAExG,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC9D,QAAQ,CAAC,eAAe,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,SAAS,GAAG,KAAK,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;IACnH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxC,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AAED,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC9D,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CACrC;AAED,MAAM,MAAM,uBAAuB,GAC/B,oBAAoB,G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Aa,4BAA6B,SAAQ,aAAa;aAE3C,IAAI,EAAE,MAAM;gBAAZ,IAAI,EAAE,MAAM,EAC5B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,iBAAsB;CAQlC;AAED;;;;;;;GAOG;AACH,qBAAa,sBAAuB,SAAQ,aAAa;IACvD,SAAgB,aAAa,EAAE,MAAM,CAAC;IACtC,SAAgB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;gBAEzB,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB;CAY7G;AAED,iEAAiE;AACjE,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC;AAEvC,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAEhE"}
|
package/core/errors.js
CHANGED
|
@@ -73,14 +73,19 @@ export class HonuaGeometryError extends HonuaSdkError {
|
|
|
73
73
|
export class HonuaHttpError extends HonuaSdkError {
|
|
74
74
|
statusCode;
|
|
75
75
|
body;
|
|
76
|
+
receipt;
|
|
76
77
|
constructor(statusCode, message, body, options = {}) {
|
|
77
|
-
|
|
78
|
+
const receipt = httpFailureReceipt(statusCode, body, options);
|
|
79
|
+
super(receipt.retryable ? "core.http.transient" : "core.http.rejected", `HTTP ${statusCode}: ${message}`, {
|
|
78
80
|
...options,
|
|
81
|
+
requestId: options.requestId ?? receipt.correlationId,
|
|
82
|
+
terminalReceipt: receipt,
|
|
79
83
|
context: mergeHonuaErrorContext(options.context, { statusCode }),
|
|
80
84
|
});
|
|
81
85
|
this.name = "HonuaHttpError";
|
|
82
86
|
this.statusCode = statusCode;
|
|
83
87
|
this.body = body;
|
|
88
|
+
this.receipt = receipt;
|
|
84
89
|
}
|
|
85
90
|
}
|
|
86
91
|
/** Thrown when a request exceeds the configured timeout. */
|
|
@@ -115,14 +120,19 @@ export class HonuaAbortError extends HonuaSdkError {
|
|
|
115
120
|
export class HonuaGrpcError extends HonuaSdkError {
|
|
116
121
|
code;
|
|
117
122
|
details;
|
|
123
|
+
receipt;
|
|
118
124
|
constructor(code, message, details, options = {}) {
|
|
119
|
-
|
|
125
|
+
const receipt = grpcFailureReceipt(code, details, options);
|
|
126
|
+
super(receipt.retryable ? "core.grpc.transient" : "core.grpc.rejected", message, {
|
|
120
127
|
...options,
|
|
128
|
+
requestId: options.requestId ?? receipt.correlationId,
|
|
129
|
+
terminalReceipt: receipt,
|
|
121
130
|
context: mergeHonuaErrorContext(options.context, { grpcCode: code }),
|
|
122
131
|
});
|
|
123
132
|
this.code = code;
|
|
124
133
|
this.name = "HonuaGrpcError";
|
|
125
134
|
this.details = details;
|
|
135
|
+
this.receipt = receipt;
|
|
126
136
|
}
|
|
127
137
|
}
|
|
128
138
|
/**
|
|
@@ -221,3 +231,245 @@ const AUTH_ERROR_CODES = {
|
|
|
221
231
|
refresh_failed: "core.auth.refresh-failed",
|
|
222
232
|
invalid_grant: "core.auth.invalid-grant",
|
|
223
233
|
};
|
|
234
|
+
function httpFailureReceipt(statusCode, body, options) {
|
|
235
|
+
const root = isObject(body) ? body : undefined;
|
|
236
|
+
const protocolError = root && isObject(root.error) ? root.error : undefined;
|
|
237
|
+
const source = protocolError ?? root;
|
|
238
|
+
const protocolCode = options.protocolCode ?? scalarCode(protocolError?.code);
|
|
239
|
+
const classificationCode = typeof protocolCode === "number" ? protocolCode : statusCode;
|
|
240
|
+
const metadata = metadataRecord(options.responseHeaders);
|
|
241
|
+
const bodyKind = stringValue(source?.kind);
|
|
242
|
+
const kind = isFailureKind(bodyKind) ? bodyKind : failureKindForHttp(classificationCode, statusCode);
|
|
243
|
+
const code = stringValue(source?.machineCode) ?? stringValue(source?.code) ?? stringValue(root?.code) ?? defaultCode(kind);
|
|
244
|
+
const explicitRetryable = booleanValue(source?.retryable) ?? booleanValue(root?.retryable);
|
|
245
|
+
const retryAfterSeconds = numberValue(source?.retryAfterSeconds) ?? numberValue(root?.retryAfterSeconds);
|
|
246
|
+
const headerDelay = parseRetryAfter(metadataGetter(options.responseHeaders));
|
|
247
|
+
const correlationId = stringValue(source?.correlationId) ??
|
|
248
|
+
stringValue(root?.correlationId) ??
|
|
249
|
+
firstMetadata(metadata, "x-correlation-id", "honua-request-id", "x-request-id", "honua-correlation-id");
|
|
250
|
+
const fieldErrors = parseFieldFailures(source?.errors ?? root?.errors);
|
|
251
|
+
return freezeReceipt({
|
|
252
|
+
transportStatus: options.transportStatus ?? statusCode,
|
|
253
|
+
...(protocolCode !== undefined ? { protocolCode } : {}),
|
|
254
|
+
kind,
|
|
255
|
+
...(code ? { code } : {}),
|
|
256
|
+
retryable: explicitRetryable ??
|
|
257
|
+
(HTTP_RETRYABLE_STATUSES.has(classificationCode) ||
|
|
258
|
+
HTTP_RETRYABLE_STATUSES.has(options.transportStatus ?? statusCode)),
|
|
259
|
+
...(retryAfterSeconds !== undefined
|
|
260
|
+
? { retryAfterMs: Math.max(0, retryAfterSeconds * 1_000) }
|
|
261
|
+
: headerDelay !== undefined
|
|
262
|
+
? { retryAfterMs: headerDelay }
|
|
263
|
+
: {}),
|
|
264
|
+
...(correlationId ? { correlationId } : {}),
|
|
265
|
+
fieldErrors,
|
|
266
|
+
protocolMetadata: { initial: metadata, trailing: emptyMetadata() },
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
function grpcFailureReceipt(code, details, options) {
|
|
270
|
+
const initial = metadataRecord(options.initialMetadata);
|
|
271
|
+
const trailing = metadataRecord(options.trailingMetadata);
|
|
272
|
+
const declaredMachineCode = firstMetadata(trailing, "honua-error-code") ?? firstMetadata(initial, "honua-error-code");
|
|
273
|
+
const declaredKind = firstMetadata(trailing, "honua-error-kind") ?? firstMetadata(initial, "honua-error-kind");
|
|
274
|
+
const kind = isFailureKind(declaredKind) ? declaredKind : failureKindForGrpc(code);
|
|
275
|
+
const machineCode = declaredMachineCode ?? defaultCode(kind);
|
|
276
|
+
const declaredRetryable = firstMetadata(trailing, "honua-retryable", "honua-error-retryable") ??
|
|
277
|
+
firstMetadata(initial, "honua-retryable", "honua-error-retryable");
|
|
278
|
+
const retryAfterMs = parseRetryAfter(metadataGetterFromRecords(trailing, initial));
|
|
279
|
+
const correlationId = firstMetadata(trailing, "x-correlation-id", "honua-request-id", "x-request-id", "honua-correlation-id") ??
|
|
280
|
+
firstMetadata(initial, "x-correlation-id", "honua-request-id", "x-request-id", "honua-correlation-id");
|
|
281
|
+
const encodedErrors = firstMetadata(trailing, "honua-error-details") ?? firstMetadata(initial, "honua-error-details");
|
|
282
|
+
return freezeReceipt({
|
|
283
|
+
protocolCode: code,
|
|
284
|
+
kind,
|
|
285
|
+
code: machineCode,
|
|
286
|
+
retryable: parseBoolean(declaredRetryable) ?? GRPC_RETRYABLE_CODES.has(code),
|
|
287
|
+
...(retryAfterMs !== undefined ? { retryAfterMs } : {}),
|
|
288
|
+
...(correlationId ? { correlationId } : {}),
|
|
289
|
+
fieldErrors: parseEncodedFieldFailures(encodedErrors, details),
|
|
290
|
+
protocolMetadata: { initial, trailing },
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
function failureKindForHttp(code, transportStatus) {
|
|
294
|
+
if (code === 401 || code === 498 || code === 499)
|
|
295
|
+
return "authentication";
|
|
296
|
+
if (code === 403)
|
|
297
|
+
return "authorization";
|
|
298
|
+
if (code === 404)
|
|
299
|
+
return "not-found";
|
|
300
|
+
if (code === 400 || code === 422)
|
|
301
|
+
return "validation";
|
|
302
|
+
if (code === 409 || code === 412 || code === 428)
|
|
303
|
+
return "conflict";
|
|
304
|
+
if (code === 429)
|
|
305
|
+
return "throttled";
|
|
306
|
+
if (HTTP_RETRYABLE_STATUSES.has(code) || transportStatus >= 500)
|
|
307
|
+
return "unavailable";
|
|
308
|
+
return "unknown";
|
|
309
|
+
}
|
|
310
|
+
function failureKindForGrpc(code) {
|
|
311
|
+
if (code === 16)
|
|
312
|
+
return "authentication";
|
|
313
|
+
if (code === 7)
|
|
314
|
+
return "authorization";
|
|
315
|
+
if (code === 5)
|
|
316
|
+
return "not-found";
|
|
317
|
+
if (code === 3)
|
|
318
|
+
return "validation";
|
|
319
|
+
if (code === 10 || code === 6)
|
|
320
|
+
return "conflict";
|
|
321
|
+
if (code === 8)
|
|
322
|
+
return "throttled";
|
|
323
|
+
if (GRPC_RETRYABLE_CODES.has(code))
|
|
324
|
+
return "unavailable";
|
|
325
|
+
return "unknown";
|
|
326
|
+
}
|
|
327
|
+
function defaultCode(kind) {
|
|
328
|
+
return {
|
|
329
|
+
authentication: "authentication_required",
|
|
330
|
+
authorization: "permission_denied",
|
|
331
|
+
"not-found": "resource_not_found",
|
|
332
|
+
validation: "validation_failed",
|
|
333
|
+
conflict: "resource_conflict",
|
|
334
|
+
throttled: "rate_limit_exceeded",
|
|
335
|
+
unavailable: "service_unavailable",
|
|
336
|
+
unknown: "unknown_failure",
|
|
337
|
+
}[kind];
|
|
338
|
+
}
|
|
339
|
+
function metadataRecord(value) {
|
|
340
|
+
const result = Object.create(null);
|
|
341
|
+
const add = (key, item) => {
|
|
342
|
+
const normalized = key.toLowerCase();
|
|
343
|
+
if (SENSITIVE_METADATA_KEYS.has(normalized))
|
|
344
|
+
return;
|
|
345
|
+
const values = Array.isArray(item)
|
|
346
|
+
? item.filter((entry) => typeof entry === "string")
|
|
347
|
+
: [String(item)];
|
|
348
|
+
if (values.length > 0)
|
|
349
|
+
result[normalized] = Object.freeze(values.slice(0, 20));
|
|
350
|
+
};
|
|
351
|
+
if (value && typeof value.entries === "function") {
|
|
352
|
+
for (const [key, item] of value.entries())
|
|
353
|
+
add(key, item);
|
|
354
|
+
}
|
|
355
|
+
else if (isObject(value)) {
|
|
356
|
+
for (const [key, item] of Object.entries(value))
|
|
357
|
+
add(key, item);
|
|
358
|
+
}
|
|
359
|
+
return Object.freeze(result);
|
|
360
|
+
}
|
|
361
|
+
function metadataGetter(value) {
|
|
362
|
+
if (value && typeof value.get === "function")
|
|
363
|
+
return value;
|
|
364
|
+
return metadataGetterFromRecords(metadataRecord(value));
|
|
365
|
+
}
|
|
366
|
+
function metadataGetterFromRecords(...records) {
|
|
367
|
+
return {
|
|
368
|
+
get(name) {
|
|
369
|
+
for (const record of records) {
|
|
370
|
+
const value = firstMetadata(record, name);
|
|
371
|
+
if (value)
|
|
372
|
+
return value;
|
|
373
|
+
}
|
|
374
|
+
return null;
|
|
375
|
+
},
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
function firstMetadata(record, ...keys) {
|
|
379
|
+
for (const key of keys) {
|
|
380
|
+
const value = record[key.toLowerCase()]?.[0];
|
|
381
|
+
if (value)
|
|
382
|
+
return value;
|
|
383
|
+
}
|
|
384
|
+
return undefined;
|
|
385
|
+
}
|
|
386
|
+
function parseRetryAfter(headers) {
|
|
387
|
+
const value = headers.get("retry-after");
|
|
388
|
+
if (!value)
|
|
389
|
+
return undefined;
|
|
390
|
+
const seconds = Number(value);
|
|
391
|
+
if (Number.isFinite(seconds) && seconds >= 0)
|
|
392
|
+
return seconds * 1_000;
|
|
393
|
+
const target = Date.parse(value);
|
|
394
|
+
return Number.isFinite(target) ? Math.max(0, target - Date.now()) : undefined;
|
|
395
|
+
}
|
|
396
|
+
function parseEncodedFieldFailures(encoded, details) {
|
|
397
|
+
if (encoded) {
|
|
398
|
+
try {
|
|
399
|
+
return parseFieldFailures(JSON.parse(encoded));
|
|
400
|
+
}
|
|
401
|
+
catch {
|
|
402
|
+
return [];
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return parseFieldFailures(details);
|
|
406
|
+
}
|
|
407
|
+
function parseFieldFailures(value) {
|
|
408
|
+
if (!Array.isArray(value))
|
|
409
|
+
return Object.freeze([]);
|
|
410
|
+
return Object.freeze(value.filter(isObject).map((item) => {
|
|
411
|
+
const code = stringValue(item.code);
|
|
412
|
+
const severity = stringValue(item.severity);
|
|
413
|
+
const path = stringValue(item.path);
|
|
414
|
+
const fieldId = stringValue(item.fieldId);
|
|
415
|
+
const itemIndex = numberValue(item.itemIndex);
|
|
416
|
+
const message = stringValue(item.message);
|
|
417
|
+
return Object.freeze({
|
|
418
|
+
...(code ? { code } : {}),
|
|
419
|
+
...(severity ? { severity } : {}),
|
|
420
|
+
...(path ? { path } : {}),
|
|
421
|
+
...(fieldId ? { fieldId } : {}),
|
|
422
|
+
...(itemIndex !== undefined ? { itemIndex } : {}),
|
|
423
|
+
...(message ? { message } : {}),
|
|
424
|
+
});
|
|
425
|
+
}));
|
|
426
|
+
}
|
|
427
|
+
function freezeReceipt(receipt) {
|
|
428
|
+
return Object.freeze({
|
|
429
|
+
...receipt,
|
|
430
|
+
fieldErrors: Object.freeze([...receipt.fieldErrors]),
|
|
431
|
+
protocolMetadata: Object.freeze({
|
|
432
|
+
initial: receipt.protocolMetadata.initial,
|
|
433
|
+
trailing: receipt.protocolMetadata.trailing,
|
|
434
|
+
}),
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
function emptyMetadata() {
|
|
438
|
+
return Object.freeze(Object.create(null));
|
|
439
|
+
}
|
|
440
|
+
function scalarCode(value) {
|
|
441
|
+
return typeof value === "number" || typeof value === "string" ? value : undefined;
|
|
442
|
+
}
|
|
443
|
+
function stringValue(value) {
|
|
444
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
445
|
+
}
|
|
446
|
+
function booleanValue(value) {
|
|
447
|
+
return typeof value === "boolean" ? value : undefined;
|
|
448
|
+
}
|
|
449
|
+
function parseBoolean(value) {
|
|
450
|
+
if (value === "true")
|
|
451
|
+
return true;
|
|
452
|
+
if (value === "false")
|
|
453
|
+
return false;
|
|
454
|
+
return undefined;
|
|
455
|
+
}
|
|
456
|
+
function numberValue(value) {
|
|
457
|
+
return typeof value === "number" && Number.isFinite(value) ? value : undefined;
|
|
458
|
+
}
|
|
459
|
+
function isFailureKind(value) {
|
|
460
|
+
return value !== undefined && FAILURE_KINDS.has(value);
|
|
461
|
+
}
|
|
462
|
+
function isObject(value) {
|
|
463
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
464
|
+
}
|
|
465
|
+
const FAILURE_KINDS = new Set([
|
|
466
|
+
"authentication",
|
|
467
|
+
"authorization",
|
|
468
|
+
"not-found",
|
|
469
|
+
"validation",
|
|
470
|
+
"conflict",
|
|
471
|
+
"throttled",
|
|
472
|
+
"unavailable",
|
|
473
|
+
"unknown",
|
|
474
|
+
]);
|
|
475
|
+
const SENSITIVE_METADATA_KEYS = new Set(["authorization", "cookie", "set-cookie", "x-api-key"]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry-input-sr.d.ts","sourceRoot":"","sources":["../../../src/core/geometry-input-sr.ts"],"names":[],"mappings":"AAEA,gFAAgF;AAChF,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAqBhF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { HonuaGeometryError } from "./errors.js";
|
|
2
|
+
/** GeoServices query geometry defaults to WGS84, never the target layer CRS. */
|
|
3
|
+
export function geometryInputSpatialReference(geometry) {
|
|
4
|
+
if (typeof geometry === "string") {
|
|
5
|
+
try {
|
|
6
|
+
geometry = JSON.parse(geometry);
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
// GeoServices also accepts comma-separated coordinate strings.
|
|
10
|
+
return 4326;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
if (typeof geometry !== "object" || geometry === null || !("spatialReference" in geometry))
|
|
14
|
+
return 4326;
|
|
15
|
+
const sr = geometry.spatialReference;
|
|
16
|
+
if (typeof sr === "object" && sr !== null) {
|
|
17
|
+
if ("wkt" in sr && typeof sr.wkt === "string" && sr.wkt.trim())
|
|
18
|
+
return JSON.stringify(sr);
|
|
19
|
+
if ("latestWkid" in sr && typeof sr.latestWkid === "number" && Number.isInteger(sr.latestWkid) && sr.latestWkid > 0)
|
|
20
|
+
return sr.latestWkid;
|
|
21
|
+
if ("wkid" in sr && typeof sr.wkid === "number" && Number.isInteger(sr.wkid) && sr.wkid > 0)
|
|
22
|
+
return sr.wkid;
|
|
23
|
+
}
|
|
24
|
+
throw new HonuaGeometryError("malformed-geometry", "Query geometry has an invalid spatialReference", {
|
|
25
|
+
operation: "query-input-spatial-reference",
|
|
26
|
+
reason: "invalid-spatial-reference",
|
|
27
|
+
});
|
|
28
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geoservices.d.ts","sourceRoot":"","sources":["../../../src/core/geoservices.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"geoservices.d.ts","sourceRoot":"","sources":["../../../src/core/geoservices.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAGpE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,wBAAwB,EACxB,oBAAoB,EAEpB,0BAA0B,EAC3B,MAAM,YAAY,CAAC;AAIpB,wBAAsB,YAAY,CAChC,SAAS,EAAE,sBAAsB,EACjC,MAAM,EAAE,MAAM,GAAG,OAAO,EACxB,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,qBAAqB,CAAC,CAIhC;AAED,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,sBAAsB,EACjC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,2BAAgC,GACxC,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AChC,SAAS,EAAE,sBAAsB,EACjC,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,mBAAmB,CAAC,CAiB9B;AAED,wBAAsB,WAAW,CAC/B,SAAS,EAAE,sBAAsB,EACjC,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,qBAAqB,CAAC,CA8ChC;AAED,wBAAsB,OAAO,CAAC,SAAS,EAAE,sBAAsB,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA2DpH"}
|
package/core/geoservices.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @module
|
|
10
10
|
*/
|
|
11
|
+
import { geometryInputSpatialReference } from "./geometry-input-sr.js";
|
|
11
12
|
import { encodeServiceIdPath } from "./path-utils.js";
|
|
12
13
|
// ── Metadata ────────────────────────────────────────────────────
|
|
13
14
|
export async function listServices(transport, format, options = {}) {
|
|
@@ -36,6 +37,17 @@ export async function getMapLayerMetadata(transport, serviceId, layerId, options
|
|
|
36
37
|
return transport.requestCachedMetadataJson(`geoservices-map:${serviceId}:${layerId}`, path, options);
|
|
37
38
|
}
|
|
38
39
|
// ── FeatureServer / MapServer operations ────────────────────────
|
|
40
|
+
// A conservative request-target budget avoids common browser/proxy URL limits.
|
|
41
|
+
// Measure encoded parameters plus the configured base path: Unicode, polygon
|
|
42
|
+
// coordinates, and a deployment prefix (e.g. `/honua`) can all expand the
|
|
43
|
+
// actual request target that `resolveRequestUrl` sends. Explicit caller
|
|
44
|
+
// choices remain authoritative.
|
|
45
|
+
function queryMethod(method, path, params, baseUrl) {
|
|
46
|
+
if (method !== undefined)
|
|
47
|
+
return method;
|
|
48
|
+
const url = new URL(`${baseUrl}${path}?${params.toString()}`, globalThis.location?.href ?? "https://honua.invalid");
|
|
49
|
+
return url.pathname.length + url.search.length > 2_000 ? "POST" : "GET";
|
|
50
|
+
}
|
|
39
51
|
/**
|
|
40
52
|
* REST portion of `client.queryFeatures` (the gRPC-web fast path is
|
|
41
53
|
* orchestrated by the client). Maps directly to the FeatureServer `query`
|
|
@@ -43,16 +55,18 @@ export async function getMapLayerMetadata(transport, serviceId, layerId, options
|
|
|
43
55
|
* `preferBinary` is set.
|
|
44
56
|
*/
|
|
45
57
|
export async function queryFeaturesRest(transport, request, preferBinary) {
|
|
46
|
-
const method = request.method ?? "GET";
|
|
47
|
-
const usePbf = preferBinary && method === "GET";
|
|
48
58
|
const params = new URLSearchParams();
|
|
49
|
-
params.set("f",
|
|
59
|
+
params.set("f", preferBinary && (request.method === undefined || request.method === "GET") ? "pbf" : "json");
|
|
50
60
|
params.set("where", request.where ?? "1=1");
|
|
51
61
|
params.set("outFields", normalizeOutFields(request.outFields));
|
|
52
62
|
params.set("returnGeometry", String(request.returnGeometry ?? true));
|
|
53
63
|
serializeQueryParams(params, request);
|
|
54
64
|
appendQueryExtraParams(params, request);
|
|
55
65
|
const path = `/rest/services/${encodeServiceIdPath(request.serviceId)}/FeatureServer/${request.layerId}/query`;
|
|
66
|
+
const method = queryMethod(request.method, path, params, transport.baseUrl);
|
|
67
|
+
const usePbf = preferBinary && method === "GET";
|
|
68
|
+
if (request.method === undefined && method === "POST" && params.get("f") === "pbf")
|
|
69
|
+
params.set("f", "json");
|
|
56
70
|
if (usePbf) {
|
|
57
71
|
return transport.requestBinaryWithJsonFallback("GET", `${path}?${params.toString()}`, params, request.signal);
|
|
58
72
|
}
|
|
@@ -64,10 +78,9 @@ export async function queryFeaturesRest(transport, request, preferBinary) {
|
|
|
64
78
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
65
79
|
},
|
|
66
80
|
body: params.toString(),
|
|
67
|
-
}, request.signal);
|
|
81
|
+
}, request.signal, request.method === undefined ? { readOnlyQuery: true } : undefined);
|
|
68
82
|
}
|
|
69
83
|
export async function queryMapLayer(transport, request) {
|
|
70
|
-
const method = request.method ?? "GET";
|
|
71
84
|
const params = new URLSearchParams();
|
|
72
85
|
params.set("f", "json");
|
|
73
86
|
params.set("where", request.where ?? "1=1");
|
|
@@ -76,6 +89,7 @@ export async function queryMapLayer(transport, request) {
|
|
|
76
89
|
serializeQueryParams(params, request);
|
|
77
90
|
appendQueryExtraParams(params, request);
|
|
78
91
|
const path = `/rest/services/${encodeServiceIdPath(request.serviceId)}/MapServer/${request.layerId}/query`;
|
|
92
|
+
const method = queryMethod(request.method, path, params, transport.baseUrl);
|
|
79
93
|
if (method === "GET") {
|
|
80
94
|
return transport.requestJson("GET", `${path}?${params.toString()}`, undefined, request.signal);
|
|
81
95
|
}
|
|
@@ -84,7 +98,7 @@ export async function queryMapLayer(transport, request) {
|
|
|
84
98
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
85
99
|
},
|
|
86
100
|
body: params.toString(),
|
|
87
|
-
}, request.signal);
|
|
101
|
+
}, request.signal, request.method === undefined ? { readOnlyQuery: true } : undefined);
|
|
88
102
|
}
|
|
89
103
|
export async function applyEdits(transport, request) {
|
|
90
104
|
const path = `/rest/services/${encodeServiceIdPath(request.serviceId)}/FeatureServer/${request.layerId}/applyEdits`;
|
|
@@ -392,6 +406,7 @@ function serializeQueryParams(params, request) {
|
|
|
392
406
|
params.set("objectIds", Array.isArray(request.objectIds) ? request.objectIds.join(",") : String(request.objectIds));
|
|
393
407
|
}
|
|
394
408
|
if (request.geometry !== undefined) {
|
|
409
|
+
params.set("inSR", String(request.extraParams?.inSR ?? geometryInputSpatialReference(request.geometry)));
|
|
395
410
|
params.set("geometry", typeof request.geometry === "object" && request.geometry !== null
|
|
396
411
|
? JSON.stringify(request.geometry)
|
|
397
412
|
: String(request.geometry));
|
|
@@ -402,6 +417,18 @@ function serializeQueryParams(params, request) {
|
|
|
402
417
|
if (request.spatialRel !== undefined) {
|
|
403
418
|
params.set("spatialRel", request.spatialRel);
|
|
404
419
|
}
|
|
420
|
+
if (request.distance !== undefined) {
|
|
421
|
+
params.set("distance", String(request.distance));
|
|
422
|
+
}
|
|
423
|
+
if (request.units !== undefined) {
|
|
424
|
+
params.set("units", request.units);
|
|
425
|
+
}
|
|
426
|
+
if (request.nearestCount !== undefined) {
|
|
427
|
+
params.set("nearestCount", String(request.nearestCount));
|
|
428
|
+
}
|
|
429
|
+
if (request.returnDistance !== undefined) {
|
|
430
|
+
params.set("returnDistance", String(request.returnDistance));
|
|
431
|
+
}
|
|
405
432
|
if (request.returnDistinctValues !== undefined) {
|
|
406
433
|
params.set("returnDistinctValues", String(request.returnDistinctValues));
|
|
407
434
|
}
|
package/core/grpc-adapter.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type FeaturePage, type QueryFeaturesResponse } from "../gen/
|
|
1
|
+
import { type FeaturePage, type QueryFeaturesResponse } from "../gen/geospatial/v1/index.js";
|
|
2
2
|
import type { HonuaCountResponse, HonuaExtentResponse, HonuaFeature, HonuaObjectIdsResponse, HonuaQueryResponse, QueryFeaturesRequest } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Converts a SDK QueryFeaturesRequest into a proto QueryFeaturesRequest message.
|
|
5
5
|
*/
|
|
6
|
-
export declare function toProtoQueryRequest(request: QueryFeaturesRequest): import("../gen/
|
|
6
|
+
export declare function toProtoQueryRequest(request: QueryFeaturesRequest): import("../gen/geospatial/v1/feature_service_pb.js").QueryFeaturesRequest;
|
|
7
7
|
/**
|
|
8
8
|
* Converts a proto QueryFeaturesResponse into the JSON-compatible shape
|
|
9
9
|
* matching the `f=json` response format.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpc-adapter.d.ts","sourceRoot":"","sources":["../../../src/core/grpc-adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,WAAW,EAWhB,KAAK,qBAAqB,EAM3B,MAAM,
|
|
1
|
+
{"version":3,"file":"grpc-adapter.d.ts","sourceRoot":"","sources":["../../../src/core/grpc-adapter.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,WAAW,EAWhB,KAAK,qBAAqB,EAM3B,MAAM,+BAA+B,CAAC;AAGvC,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EAEZ,sBAAsB,EACtB,kBAAkB,EAElB,oBAAoB,EACrB,MAAM,YAAY,CAAC;AA6GpB;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,6EA6IhE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,qBAAqB,GAC9B,kBAAkB,GAAG,kBAAkB,GAAG,sBAAsB,GAAG,mBAAmB,CAkDxF;AA0UD;;;;GAIG;AACH,wBAAuB,gBAAgB,CACrC,MAAM,EAAE,aAAa,CAAC,WAAW,CAAC,GACjC,cAAc,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,CAAC,CAiBjD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,CAiBtD"}
|
package/core/grpc-adapter.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { create } from "@bufbuild/protobuf";
|
|
2
|
-
import { CoordinateSchema, CoordinateSequenceSchema, DistanceUnit, FieldType, GeometrySchema, GeometryType, MultiPointGeometrySchema, PointGeometrySchema, PolygonGeometrySchema, PolylineGeometrySchema, QueryFeaturesRequestSchema, SpatialFilterSchema, SpatialReferenceSchema, SpatialRelationship, StatisticDefinitionSchema, StatisticType, } from "../gen/
|
|
2
|
+
import { CoordinateSchema, CoordinateSequenceSchema, DistanceUnit, FieldType, GeometrySchema, GeometryType, MultiPointGeometrySchema, PointGeometrySchema, PolygonGeometrySchema, PolylineGeometrySchema, QueryFeaturesRequestSchema, SpatialFilterSchema, SpatialReferenceSchema, SpatialRelationship, StatisticDefinitionSchema, StatisticType, } from "../gen/geospatial/v1/index.js";
|
|
3
3
|
import { HonuaGrpcError } from "./errors.js";
|
|
4
|
+
import { geometryInputSpatialReference } from "./geometry-input-sr.js";
|
|
4
5
|
/**
|
|
5
6
|
* Maps proto FieldType enum values to Esri-style field type strings
|
|
6
7
|
* used in the JSON response shape.
|
|
@@ -81,6 +82,25 @@ const STATISTIC_TYPE_MAP = {
|
|
|
81
82
|
};
|
|
82
83
|
const MAX_SAFE_INTEGER_BIGINT = BigInt(Number.MAX_SAFE_INTEGER);
|
|
83
84
|
const MIN_SAFE_INTEGER_BIGINT = BigInt(Number.MIN_SAFE_INTEGER);
|
|
85
|
+
const MIN_PROTO_INT64 = -(1n << 63n);
|
|
86
|
+
const MAX_PROTO_INT64 = (1n << 63n) - 1n;
|
|
87
|
+
function toProtoObjectId(value) {
|
|
88
|
+
const token = value.trim();
|
|
89
|
+
if (!/^(?:0|-?[1-9][0-9]*)$/.test(token)) {
|
|
90
|
+
throw new RangeError("string objectIds must contain canonical decimal int64 values");
|
|
91
|
+
}
|
|
92
|
+
const parsed = BigInt(token);
|
|
93
|
+
if (parsed < MIN_PROTO_INT64 || parsed > MAX_PROTO_INT64) {
|
|
94
|
+
throw new RangeError("string objectIds must remain within the signed int64 range");
|
|
95
|
+
}
|
|
96
|
+
return parsed;
|
|
97
|
+
}
|
|
98
|
+
function toProtoPageInt64(field, value) {
|
|
99
|
+
if (!Number.isSafeInteger(value) || value < 0) {
|
|
100
|
+
throw new RangeError(`${field} must be a non-negative safe integer for the gRPC int64 contract`);
|
|
101
|
+
}
|
|
102
|
+
return BigInt(value);
|
|
103
|
+
}
|
|
84
104
|
/**
|
|
85
105
|
* Converts a SDK QueryFeaturesRequest into a proto QueryFeaturesRequest message.
|
|
86
106
|
*/
|
|
@@ -107,15 +127,20 @@ export function toProtoQueryRequest(request) {
|
|
|
107
127
|
}
|
|
108
128
|
if (request.objectIds !== undefined) {
|
|
109
129
|
const ids = typeof request.objectIds === "string"
|
|
110
|
-
? request.objectIds.split(",").map(
|
|
111
|
-
: request.objectIds.map((id) =>
|
|
130
|
+
? request.objectIds.split(",").map(toProtoObjectId)
|
|
131
|
+
: request.objectIds.map((id) => {
|
|
132
|
+
if (!Number.isSafeInteger(id)) {
|
|
133
|
+
throw new RangeError("objectIds must contain only safe integers for the gRPC int64 contract");
|
|
134
|
+
}
|
|
135
|
+
return BigInt(id);
|
|
136
|
+
});
|
|
112
137
|
msg.objectIds = ids;
|
|
113
138
|
}
|
|
114
139
|
if (request.resultOffset !== undefined) {
|
|
115
|
-
msg.
|
|
140
|
+
msg.resultOffsetLong = toProtoPageInt64("resultOffset", request.resultOffset);
|
|
116
141
|
}
|
|
117
142
|
if (request.resultRecordCount !== undefined) {
|
|
118
|
-
msg.
|
|
143
|
+
msg.resultRecordCountLong = toProtoPageInt64("resultRecordCount", request.resultRecordCount);
|
|
119
144
|
}
|
|
120
145
|
if (request.orderByFields !== undefined) {
|
|
121
146
|
msg.orderBy = request.orderByFields;
|
|
@@ -146,8 +171,11 @@ export function toProtoQueryRequest(request) {
|
|
|
146
171
|
else {
|
|
147
172
|
filter.spatialRelationship = SpatialRelationship.INTERSECTS;
|
|
148
173
|
}
|
|
149
|
-
|
|
150
|
-
|
|
174
|
+
const inputSpatialReference = spatialReference ??
|
|
175
|
+
toProtoSpatialReference(request.extraParams?.inSR) ??
|
|
176
|
+
toProtoSpatialReference(geometryInputSpatialReference(request.geometry));
|
|
177
|
+
if (inputSpatialReference) {
|
|
178
|
+
filter.spatialReference = inputSpatialReference;
|
|
151
179
|
}
|
|
152
180
|
const distance = request.distance ?? parseExtraNumber(request.extraParams ?? {}, "distance");
|
|
153
181
|
if (distance !== undefined) {
|
|
@@ -553,7 +581,11 @@ export async function* streamProtoPages(stream) {
|
|
|
553
581
|
*/
|
|
554
582
|
export function wrapConnectError(error) {
|
|
555
583
|
if (error instanceof Error && "code" in error && typeof error.code === "number") {
|
|
556
|
-
|
|
584
|
+
const candidate = error;
|
|
585
|
+
return new HonuaGrpcError(candidate.code, error.message, "rawMessage" in error ? candidate.rawMessage : undefined, {
|
|
586
|
+
initialMetadata: candidate.headers ?? candidate.initialMetadata,
|
|
587
|
+
trailingMetadata: candidate.trailers ?? candidate.trailer ?? candidate.metadata,
|
|
588
|
+
});
|
|
557
589
|
}
|
|
558
590
|
if (error instanceof Error) {
|
|
559
591
|
return error;
|
|
@@ -577,7 +609,7 @@ function convertField(field) {
|
|
|
577
609
|
return {
|
|
578
610
|
name: field.name,
|
|
579
611
|
type: FIELD_TYPE_MAP[field.fieldType] ?? "esriFieldTypeString",
|
|
580
|
-
alias: field.name,
|
|
612
|
+
alias: field.alias || field.name,
|
|
581
613
|
length: field.length || undefined,
|
|
582
614
|
nullable: field.nullable,
|
|
583
615
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { JobStatus } from "../contract/jobs.js";
|
|
2
|
+
import { HonuaSdkError } from "./error-envelope.js";
|
|
3
|
+
/** Error thrown when `IJobRun.results()` observes a non-success terminal. */
|
|
4
|
+
export declare class HonuaJobFailedError extends HonuaSdkError {
|
|
5
|
+
readonly status: JobStatus;
|
|
6
|
+
readonly errorCode: string | undefined;
|
|
7
|
+
readonly details: unknown;
|
|
8
|
+
constructor(message: string, status: JobStatus, errorCode?: string, details?: unknown);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=job-run-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job-run-errors.d.ts","sourceRoot":"","sources":["../../../src/core/job-run-errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,6EAA6E;AAC7E,qBAAa,mBAAoB,SAAQ,aAAa;IACpD,SAAgB,MAAM,EAAE,SAAS,CAAC;IAClC,SAAgB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9C,SAAgB,OAAO,EAAE,OAAO,CAAC;gBAEd,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO;CAO7F"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HonuaSdkError } from "./error-envelope.js";
|
|
2
|
+
/** Error thrown when `IJobRun.results()` observes a non-success terminal. */
|
|
3
|
+
export class HonuaJobFailedError extends HonuaSdkError {
|
|
4
|
+
status;
|
|
5
|
+
errorCode;
|
|
6
|
+
details;
|
|
7
|
+
constructor(message, status, errorCode, details) {
|
|
8
|
+
super("core.job-failed", message, { context: { status, errorCode } });
|
|
9
|
+
this.name = "HonuaJobFailedError";
|
|
10
|
+
this.status = status;
|
|
11
|
+
this.errorCode = errorCode;
|
|
12
|
+
this.details = details;
|
|
13
|
+
}
|
|
14
|
+
}
|