@honua/sdk-esri-compat 0.1.11-beta.0 → 0.1.13
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 +2 -0
- package/columnar/apache-arrow.d.ts +17 -0
- package/columnar/apache-arrow.d.ts.map +1 -0
- package/columnar/apache-arrow.js +1036 -0
- package/columnar/batch-cache-conformance.d.ts +66 -0
- package/columnar/batch-cache-conformance.d.ts.map +1 -0
- package/columnar/batch-cache-conformance.js +317 -0
- package/columnar/batch-cache-indexeddb.d.ts +31 -0
- package/columnar/batch-cache-indexeddb.d.ts.map +1 -0
- package/columnar/batch-cache-indexeddb.js +148 -0
- package/columnar/batch-cache.d.ts +298 -0
- package/columnar/batch-cache.d.ts.map +1 -0
- package/columnar/batch-cache.js +757 -0
- package/columnar/geoarrow-aggregate.d.ts +178 -0
- package/columnar/geoarrow-aggregate.d.ts.map +1 -0
- package/columnar/geoarrow-aggregate.js +976 -0
- package/columnar/geoarrow-patch.d.ts +382 -0
- package/columnar/geoarrow-patch.d.ts.map +1 -0
- package/columnar/geoarrow-patch.js +1656 -0
- package/columnar/geoarrow-reproject.d.ts +22 -0
- package/columnar/geoarrow-reproject.d.ts.map +1 -0
- package/columnar/geoarrow-reproject.js +119 -0
- package/columnar/geoarrow-serialization.d.ts +68 -0
- package/columnar/geoarrow-serialization.d.ts.map +1 -0
- package/columnar/geoarrow-serialization.js +331 -0
- package/columnar/geoarrow-types.d.ts +271 -0
- package/columnar/geoarrow-types.d.ts.map +1 -0
- package/columnar/geoarrow-types.js +15 -0
- package/columnar/geoarrow.d.ts +52 -0
- package/columnar/geoarrow.d.ts.map +1 -0
- package/columnar/geoarrow.js +1469 -0
- package/columnar/index.d.ts +43 -0
- package/columnar/index.d.ts.map +1 -0
- package/columnar/index.js +29 -0
- package/columnar/operators.d.ts +70 -0
- package/columnar/operators.d.ts.map +1 -0
- package/columnar/operators.js +307 -0
- package/columnar/result.d.ts +369 -0
- package/columnar/result.d.ts.map +1 -0
- package/columnar/result.js +815 -0
- package/columnar/telemetry.d.ts +152 -0
- package/columnar/telemetry.d.ts.map +1 -0
- package/columnar/telemetry.js +265 -0
- package/columnar/transfer.d.ts +28 -0
- package/columnar/transfer.d.ts.map +1 -0
- package/columnar/transfer.js +669 -0
- package/columnar/types.d.ts +175 -0
- package/columnar/types.d.ts.map +1 -0
- package/columnar/types.js +22 -0
- package/columnar/worker.d.ts +157 -0
- package/columnar/worker.d.ts.map +1 -0
- package/columnar/worker.js +1059 -0
- package/connect-url-safety.d.ts +53 -0
- package/connect-url-safety.js +189 -0
- package/contract/pmtiles.d.ts +6 -5
- package/contract/pmtiles.d.ts.map +1 -1
- package/contract/pmtiles.js +30 -5
- package/core/client.d.ts.map +1 -1
- package/core/client.js +87 -19
- package/core/deprecation-notice.d.ts +28 -0
- package/core/deprecation-notice.d.ts.map +1 -0
- package/core/deprecation-notice.js +22 -0
- package/core/esri-geojson.d.ts.map +1 -1
- package/core/esri-geojson.js +10 -6
- package/core/optional-grpc-peer.d.ts +15 -0
- package/core/optional-grpc-peer.d.ts.map +1 -0
- package/core/optional-grpc-peer.js +60 -0
- package/esri-compat/basemap-gallery.d.ts +2 -0
- package/esri-compat/basemap-gallery.d.ts.map +1 -1
- package/esri-compat/basemap-gallery.js +12 -0
- package/esri-compat/basemap.d.ts +4 -0
- package/esri-compat/basemap.d.ts.map +1 -1
- package/esri-compat/basemap.js +70 -0
- package/esri-compat/bookmarks.d.ts +2 -0
- package/esri-compat/bookmarks.d.ts.map +1 -1
- package/esri-compat/bookmarks.js +12 -0
- package/esri-compat/controls.d.ts +18 -0
- package/esri-compat/controls.d.ts.map +1 -1
- package/esri-compat/controls.js +120 -57
- package/esri-compat/directions.d.ts +4 -0
- package/esri-compat/directions.d.ts.map +1 -1
- package/esri-compat/directions.js +30 -20
- package/esri-compat/editor.d.ts +4 -0
- package/esri-compat/editor.d.ts.map +1 -1
- package/esri-compat/editor.js +16 -0
- package/esri-compat/esri-config.d.ts +2 -1
- package/esri-compat/esri-config.d.ts.map +1 -1
- package/esri-compat/feature-effect.d.ts +23 -0
- package/esri-compat/feature-effect.d.ts.map +1 -0
- package/esri-compat/feature-effect.js +12 -0
- package/esri-compat/feature-form.d.ts +6 -0
- package/esri-compat/feature-form.d.ts.map +1 -1
- package/esri-compat/feature-form.js +63 -0
- package/esri-compat/feature-layer.d.ts +21 -2
- package/esri-compat/feature-layer.d.ts.map +1 -1
- package/esri-compat/feature-layer.js +172 -1
- package/esri-compat/feature-table.d.ts +5 -0
- package/esri-compat/feature-table.d.ts.map +1 -1
- package/esri-compat/feature-table.js +23 -0
- package/esri-compat/identity-manager.d.ts +1 -1
- package/esri-compat/identity-manager.js +1 -1
- package/esri-compat/legend.d.ts +2 -0
- package/esri-compat/legend.d.ts.map +1 -1
- package/esri-compat/legend.js +98 -0
- package/esri-compat/locator.d.ts +1 -1
- package/esri-compat/locator.js +1 -1
- package/esri-compat/map-view-mount.d.ts +1 -0
- package/esri-compat/map-view-mount.d.ts.map +1 -1
- package/esri-compat/map-view-mount.js +46 -25
- package/esri-compat/map-view.d.ts +13 -0
- package/esri-compat/map-view.d.ts.map +1 -1
- package/esri-compat/map-view.js +94 -8
- package/esri-compat/map.d.ts +5 -1
- package/esri-compat/map.d.ts.map +1 -1
- package/esri-compat/map.js +10 -0
- package/esri-compat/measurement.d.ts +2 -0
- package/esri-compat/measurement.d.ts.map +1 -1
- package/esri-compat/measurement.js +14 -0
- package/esri-compat/point.d.ts +7 -0
- package/esri-compat/point.d.ts.map +1 -1
- package/esri-compat/point.js +33 -3
- package/esri-compat/popup.d.ts +2 -0
- package/esri-compat/popup.d.ts.map +1 -1
- package/esri-compat/popup.js +12 -0
- package/esri-compat/portal.d.ts +1 -1
- package/esri-compat/portal.js +1 -1
- package/esri-compat/print.d.ts +3 -0
- package/esri-compat/print.d.ts.map +1 -1
- package/esri-compat/print.js +15 -0
- package/esri-compat/search.d.ts +4 -0
- package/esri-compat/search.d.ts.map +1 -1
- package/esri-compat/search.js +25 -28
- package/esri-compat/sketch.d.ts +2 -0
- package/esri-compat/sketch.d.ts.map +1 -1
- package/esri-compat/sketch.js +12 -0
- package/esri-compat/widget-host.d.ts +46 -17
- package/esri-compat/widget-host.d.ts.map +1 -1
- package/esri-compat/widget-host.js +84 -20
- package/esri-compat/widget-shell-hosts.d.ts +61 -0
- package/esri-compat/widget-shell-hosts.d.ts.map +1 -0
- package/esri-compat/widget-shell-hosts.js +76 -0
- package/index.d.ts +3 -1
- package/index.js +1 -0
- package/offline/digest.d.ts +15 -0
- package/offline/digest.js +58 -0
- package/offline/quota.d.ts +161 -0
- package/offline/quota.js +370 -0
- package/offline/types.d.ts +349 -0
- package/offline/types.js +75 -0
- package/package.json +21 -2
- package/query-planner/canonical-filter.d.ts +30 -0
- package/query-planner/canonical-filter.d.ts.map +1 -0
- package/query-planner/canonical-filter.js +30 -0
- 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/columnar-plan.d.ts +63 -0
- package/query-planner/columnar-plan.d.ts.map +1 -0
- package/query-planner/columnar-plan.js +94 -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 +386 -0
- package/query-planner/duckdb.d.ts +79 -0
- package/query-planner/duckdb.d.ts.map +1 -0
- package/query-planner/duckdb.js +772 -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 +52 -0
- package/query-planner/executor.d.ts +5 -0
- package/query-planner/executor.d.ts.map +1 -0
- package/query-planner/executor.js +229 -0
- package/query-planner/geoservices.d.ts +91 -0
- package/query-planner/geoservices.d.ts.map +1 -0
- package/query-planner/geoservices.js +688 -0
- package/query-planner/grpc.d.ts +100 -0
- package/query-planner/grpc.d.ts.map +1 -0
- package/query-planner/grpc.js +760 -0
- package/query-planner/index.d.ts +59 -0
- package/query-planner/index.d.ts.map +1 -0
- package/query-planner/index.js +43 -0
- package/query-planner/ir.d.ts +25 -0
- package/query-planner/ir.d.ts.map +1 -0
- package/query-planner/ir.js +479 -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-protocol-module.d.ts +54 -0
- package/query-planner/odata-protocol-module.d.ts.map +1 -0
- package/query-planner/odata-protocol-module.js +199 -0
- package/query-planner/odata-v1.d.ts +23 -0
- package/query-planner/odata-v1.d.ts.map +1 -0
- package/query-planner/odata-v1.js +202 -0
- package/query-planner/odata.d.ts +45 -0
- package/query-planner/odata.d.ts.map +1 -0
- package/query-planner/odata.js +519 -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 +639 -0
- package/query-planner/planner.d.ts +17 -0
- package/query-planner/planner.d.ts.map +1 -0
- package/query-planner/planner.js +937 -0
- package/query-planner/representation.d.ts +59 -0
- package/query-planner/representation.d.ts.map +1 -0
- package/query-planner/representation.js +140 -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 +712 -0
- package/query-planner/types.d.ts.map +1 -0
- package/query-planner/types.js +49 -0
- package/query-planner/wfs-protocol-module.d.ts +57 -0
- package/query-planner/wfs-protocol-module.d.ts.map +1 -0
- package/query-planner/wfs-protocol-module.js +731 -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-v1.d.ts +41 -0
- package/query-planner/wfs-v1.d.ts.map +1 -0
- package/query-planner/wfs-v1.js +366 -0
- package/query-planner/wfs.d.ts +4 -0
- package/query-planner/wfs.d.ts.map +1 -0
- package/query-planner/wfs.js +2 -0
- package/widget-capabilities.d.ts +67 -0
- package/widget-capabilities.js +152 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic result-representation selection for the query planner.
|
|
3
|
+
*
|
|
4
|
+
* The planner's {@link QueryPlanExecutionMode} axis answers *when* rows are
|
|
5
|
+
* delivered (`snapshot` vs `delta`). This module adds the orthogonal axis that
|
|
6
|
+
* answers *what shape* they arrive in: protocol-neutral `Result` feature
|
|
7
|
+
* objects, or a `ColumnarBatchV1`.
|
|
8
|
+
*
|
|
9
|
+
* Selection is metadata-only and reproducible by inspection. It reads the
|
|
10
|
+
* declared source identity (protocol plus physical geometry encoding) and the
|
|
11
|
+
* caller's {@link QueryPlanningEstimates}; it never reads result data, never
|
|
12
|
+
* constructs a worker, and never performs I/O. Two callers who explain the same
|
|
13
|
+
* query against the same declared source get the same decision, and therefore
|
|
14
|
+
* the same plan fingerprint.
|
|
15
|
+
*
|
|
16
|
+
* Capability honesty is the governing rule: a source that cannot serve columnar
|
|
17
|
+
* plans `object` and records why, and an explicit unsatisfiable pin throws
|
|
18
|
+
* {@link HonuaCapabilityNotSupportedError}. There is no silent fallback that
|
|
19
|
+
* would report a representation execution cannot deliver.
|
|
20
|
+
*
|
|
21
|
+
* @module
|
|
22
|
+
*/
|
|
23
|
+
import { type DuckDbGeometryEncoding, type QueryIrV1, type QueryIrV2, type QueryPlanRepresentationDecisionV1, type QueryPlanRepresentationRequest, type QueryPlanningEstimates } from "./types.js";
|
|
24
|
+
/**
|
|
25
|
+
* Estimated rows at or above which `representation: "auto"` selects columnar.
|
|
26
|
+
*
|
|
27
|
+
* Set at the SDK's bounded-local materialization ceiling
|
|
28
|
+
* (`MAX_LOCAL_MATERIALIZATION_ROWS`): below it a result is small enough that
|
|
29
|
+
* feature objects stay affordable, at or above it the per-row object cost is
|
|
30
|
+
* exactly the problem a columnar batch exists to remove.
|
|
31
|
+
*/
|
|
32
|
+
export declare const COLUMNAR_REPRESENTATION_MIN_ROWS = 100000;
|
|
33
|
+
/** Estimated payload bytes at or above which `representation: "auto"` selects columnar. */
|
|
34
|
+
export declare const COLUMNAR_REPRESENTATION_MIN_BYTES: number;
|
|
35
|
+
/**
|
|
36
|
+
* Physical geometry encodings with an executable columnar producer today.
|
|
37
|
+
*
|
|
38
|
+
* These are the GeoParquet 1.1 native encodings that map 1:1 onto a Honua
|
|
39
|
+
* GeoArrow geometry kind, so a batch can be produced without inventing a
|
|
40
|
+
* geometry type. The multi-part encodings (`geoarrow-multipoint`,
|
|
41
|
+
* `geoarrow-multilinestring`, `geoarrow-multipolygon`) are deliberately absent:
|
|
42
|
+
* this SDK's dependency-free GeoArrow mapping has no multi-part kind, and
|
|
43
|
+
* re-labelling their parts as a single-part column would misreport the
|
|
44
|
+
* geometry.
|
|
45
|
+
*/
|
|
46
|
+
export declare const COLUMNAR_REPRESENTATION_ENCODINGS: readonly DuckDbGeometryEncoding[];
|
|
47
|
+
/** True for a declared geometry encoding that has an executable columnar producer. */
|
|
48
|
+
export declare function isColumnarRepresentationEncoding(encoding: DuckDbGeometryEncoding | undefined): encoding is DuckDbGeometryEncoding;
|
|
49
|
+
/** Validate a caller-supplied representation request; `undefined` means `auto`. */
|
|
50
|
+
export declare function normalizeRepresentationRequest(value: unknown): QueryPlanRepresentationRequest;
|
|
51
|
+
/**
|
|
52
|
+
* Select the plan's result representation.
|
|
53
|
+
*
|
|
54
|
+
* @throws HonuaCapabilityNotSupportedError when `requested` is `"columnar"` and
|
|
55
|
+
* the declared source or query cannot serve it. Failing closed here is the
|
|
56
|
+
* point: an unsatisfiable pin must never quietly become object execution.
|
|
57
|
+
*/
|
|
58
|
+
export declare function createQueryPlanRepresentationDecision(ir: QueryIrV1 | QueryIrV2, estimates: QueryPlanningEstimates, requested: QueryPlanRepresentationRequest): QueryPlanRepresentationDecisionV1;
|
|
59
|
+
//# sourceMappingURL=representation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"representation.d.ts","sourceRoot":"","sources":["../../../src/query-planner/representation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAEL,KAAK,sBAAsB,EAK3B,KAAK,SAAS,EACd,KAAK,SAAS,EAEd,KAAK,iCAAiC,EAGtC,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,EAC5B,MAAM,YAAY,CAAC;AAEpB;;;;;;;GAOG;AACH,eAAO,MAAM,gCAAgC,SAAU,CAAC;AAExD,2FAA2F;AAC3F,eAAO,MAAM,iCAAiC,QAAkB,CAAC;AAEjE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iCAAiC,EAAE,SAAS,sBAAsB,EAI7E,CAAC;AAEH,sFAAsF;AACtF,wBAAgB,gCAAgC,CAC9C,QAAQ,EAAE,sBAAsB,GAAG,SAAS,GAC3C,QAAQ,IAAI,sBAAsB,CAEpC;AAED,mFAAmF;AACnF,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,8BAA8B,CAM7F;AA2CD;;;;;;GAMG;AACH,wBAAgB,qCAAqC,CACnD,EAAE,EAAE,SAAS,GAAG,SAAS,EACzB,SAAS,EAAE,sBAAsB,EACjC,SAAS,EAAE,8BAA8B,GACxC,iCAAiC,CA0BnC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic result-representation selection for the query planner.
|
|
3
|
+
*
|
|
4
|
+
* The planner's {@link QueryPlanExecutionMode} axis answers *when* rows are
|
|
5
|
+
* delivered (`snapshot` vs `delta`). This module adds the orthogonal axis that
|
|
6
|
+
* answers *what shape* they arrive in: protocol-neutral `Result` feature
|
|
7
|
+
* objects, or a `ColumnarBatchV1`.
|
|
8
|
+
*
|
|
9
|
+
* Selection is metadata-only and reproducible by inspection. It reads the
|
|
10
|
+
* declared source identity (protocol plus physical geometry encoding) and the
|
|
11
|
+
* caller's {@link QueryPlanningEstimates}; it never reads result data, never
|
|
12
|
+
* constructs a worker, and never performs I/O. Two callers who explain the same
|
|
13
|
+
* query against the same declared source get the same decision, and therefore
|
|
14
|
+
* the same plan fingerprint.
|
|
15
|
+
*
|
|
16
|
+
* Capability honesty is the governing rule: a source that cannot serve columnar
|
|
17
|
+
* plans `object` and records why, and an explicit unsatisfiable pin throws
|
|
18
|
+
* {@link HonuaCapabilityNotSupportedError}. There is no silent fallback that
|
|
19
|
+
* would report a representation execution cannot deliver.
|
|
20
|
+
*
|
|
21
|
+
* @module
|
|
22
|
+
*/
|
|
23
|
+
import { HonuaCapabilityNotSupportedError } from "../core/errors.js";
|
|
24
|
+
import { HonuaQueryPlanningError, QUERY_PLAN_DIAGNOSTICS_VERSION, } from "./types.js";
|
|
25
|
+
/**
|
|
26
|
+
* Estimated rows at or above which `representation: "auto"` selects columnar.
|
|
27
|
+
*
|
|
28
|
+
* Set at the SDK's bounded-local materialization ceiling
|
|
29
|
+
* (`MAX_LOCAL_MATERIALIZATION_ROWS`): below it a result is small enough that
|
|
30
|
+
* feature objects stay affordable, at or above it the per-row object cost is
|
|
31
|
+
* exactly the problem a columnar batch exists to remove.
|
|
32
|
+
*/
|
|
33
|
+
export const COLUMNAR_REPRESENTATION_MIN_ROWS = 100_000;
|
|
34
|
+
/** Estimated payload bytes at or above which `representation: "auto"` selects columnar. */
|
|
35
|
+
export const COLUMNAR_REPRESENTATION_MIN_BYTES = 8 * 1024 * 1024;
|
|
36
|
+
/**
|
|
37
|
+
* Physical geometry encodings with an executable columnar producer today.
|
|
38
|
+
*
|
|
39
|
+
* These are the GeoParquet 1.1 native encodings that map 1:1 onto a Honua
|
|
40
|
+
* GeoArrow geometry kind, so a batch can be produced without inventing a
|
|
41
|
+
* geometry type. The multi-part encodings (`geoarrow-multipoint`,
|
|
42
|
+
* `geoarrow-multilinestring`, `geoarrow-multipolygon`) are deliberately absent:
|
|
43
|
+
* this SDK's dependency-free GeoArrow mapping has no multi-part kind, and
|
|
44
|
+
* re-labelling their parts as a single-part column would misreport the
|
|
45
|
+
* geometry.
|
|
46
|
+
*/
|
|
47
|
+
export const COLUMNAR_REPRESENTATION_ENCODINGS = Object.freeze([
|
|
48
|
+
"geoarrow-linestring",
|
|
49
|
+
"geoarrow-point",
|
|
50
|
+
"geoarrow-polygon",
|
|
51
|
+
]);
|
|
52
|
+
/** True for a declared geometry encoding that has an executable columnar producer. */
|
|
53
|
+
export function isColumnarRepresentationEncoding(encoding) {
|
|
54
|
+
return encoding !== undefined && COLUMNAR_REPRESENTATION_ENCODINGS.includes(encoding);
|
|
55
|
+
}
|
|
56
|
+
/** Validate a caller-supplied representation request; `undefined` means `auto`. */
|
|
57
|
+
export function normalizeRepresentationRequest(value) {
|
|
58
|
+
if (value === undefined)
|
|
59
|
+
return "auto";
|
|
60
|
+
if (value !== "auto" && value !== "object" && value !== "columnar") {
|
|
61
|
+
throw new HonuaQueryPlanningError("invalid-query", "representation is invalid");
|
|
62
|
+
}
|
|
63
|
+
return value;
|
|
64
|
+
}
|
|
65
|
+
function declaredGeometryEncoding(source) {
|
|
66
|
+
return source.protocol === "geoparquet" ? source.geoparquet?.geometryEncoding : undefined;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Decide whether this source and query can be served columnar, from declared
|
|
70
|
+
* metadata alone. Reasons are ordered most-fundamental first so the recorded
|
|
71
|
+
* reason names the constraint a caller would have to change first.
|
|
72
|
+
*/
|
|
73
|
+
function columnarCapability(source, query) {
|
|
74
|
+
const geometryEncoding = declaredGeometryEncoding(source);
|
|
75
|
+
const encoded = geometryEncoding === undefined ? {} : { geometryEncoding };
|
|
76
|
+
if (source.protocol !== "geoparquet") {
|
|
77
|
+
return { supported: false, reason: "protocol-not-columnar", ...encoded };
|
|
78
|
+
}
|
|
79
|
+
if (!isColumnarRepresentationEncoding(geometryEncoding)) {
|
|
80
|
+
return { supported: false, reason: "encoding-not-columnar", ...encoded };
|
|
81
|
+
}
|
|
82
|
+
if (query.aggregation !== undefined) {
|
|
83
|
+
return { supported: false, reason: "aggregation-not-columnar", ...encoded };
|
|
84
|
+
}
|
|
85
|
+
if (query.returnGeometry === false) {
|
|
86
|
+
return { supported: false, reason: "geometry-not-requested", ...encoded };
|
|
87
|
+
}
|
|
88
|
+
return { supported: true, reason: "workload-above-threshold", ...encoded };
|
|
89
|
+
}
|
|
90
|
+
function meetsColumnarThreshold(estimates) {
|
|
91
|
+
if (estimates.rows !== undefined && estimates.rows >= COLUMNAR_REPRESENTATION_MIN_ROWS)
|
|
92
|
+
return true;
|
|
93
|
+
return estimates.bytes !== undefined && estimates.bytes >= COLUMNAR_REPRESENTATION_MIN_BYTES;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Select the plan's result representation.
|
|
97
|
+
*
|
|
98
|
+
* @throws HonuaCapabilityNotSupportedError when `requested` is `"columnar"` and
|
|
99
|
+
* the declared source or query cannot serve it. Failing closed here is the
|
|
100
|
+
* point: an unsatisfiable pin must never quietly become object execution.
|
|
101
|
+
*/
|
|
102
|
+
export function createQueryPlanRepresentationDecision(ir, estimates, requested) {
|
|
103
|
+
const capability = columnarCapability(ir.source, ir.query);
|
|
104
|
+
if (requested === "columnar" && !capability.supported) {
|
|
105
|
+
throw new HonuaCapabilityNotSupportedError("columnar-execution", ir.source.protocol, ir.source.id, {
|
|
106
|
+
context: { representation: "columnar", reason: capability.reason },
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
const inputs = {
|
|
110
|
+
...(capability.geometryEncoding === undefined ? {} : { geometryEncoding: capability.geometryEncoding }),
|
|
111
|
+
rowThreshold: COLUMNAR_REPRESENTATION_MIN_ROWS,
|
|
112
|
+
byteThreshold: COLUMNAR_REPRESENTATION_MIN_BYTES,
|
|
113
|
+
...(estimates.rows === undefined ? {} : { estimatedRows: estimates.rows }),
|
|
114
|
+
...(estimates.bytes === undefined ? {} : { estimatedBytes: estimates.bytes }),
|
|
115
|
+
};
|
|
116
|
+
const available = capability.supported
|
|
117
|
+
? Object.freeze(["object", "columnar"])
|
|
118
|
+
: Object.freeze(["object"]);
|
|
119
|
+
const { selected, reason } = selectRepresentation(capability, estimates, requested);
|
|
120
|
+
return Object.freeze({
|
|
121
|
+
version: QUERY_PLAN_DIAGNOSTICS_VERSION,
|
|
122
|
+
requested,
|
|
123
|
+
selected,
|
|
124
|
+
available,
|
|
125
|
+
reason,
|
|
126
|
+
inputs: Object.freeze(inputs),
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function selectRepresentation(capability, estimates, requested) {
|
|
130
|
+
if (requested !== "auto")
|
|
131
|
+
return { selected: requested, reason: "explicit-pin" };
|
|
132
|
+
if (!capability.supported)
|
|
133
|
+
return { selected: "object", reason: capability.reason };
|
|
134
|
+
if (estimates.rows === undefined && estimates.bytes === undefined) {
|
|
135
|
+
return { selected: "object", reason: "estimate-unavailable" };
|
|
136
|
+
}
|
|
137
|
+
return meetsColumnarThreshold(estimates)
|
|
138
|
+
? { selected: "columnar", reason: "workload-above-threshold" }
|
|
139
|
+
: { selected: "object", reason: "workload-below-threshold" };
|
|
140
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/** Discriminant for versioned, serializable query resource handles. */
|
|
2
|
+
export declare const QUERY_RESOURCE_HANDLE_KIND: "honua.query-resource";
|
|
3
|
+
/** First opaque query resource handle format. */
|
|
4
|
+
export declare const QUERY_RESOURCE_HANDLE_VERSION: "1.0";
|
|
5
|
+
/** Credential-free resolver identity embedded in a GeoParquet resource handle. */
|
|
6
|
+
export interface GeoParquetResolverResourceReferenceV1 {
|
|
7
|
+
readonly kind: "resolver";
|
|
8
|
+
/** Canonical lowercase reverse-DNS resolver identifier. */
|
|
9
|
+
readonly resolver: string;
|
|
10
|
+
/** Stable logical resource id. It must never be derived from a credential. */
|
|
11
|
+
readonly id: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Serializable identity for a GeoParquet resource whose private locator is
|
|
15
|
+
* supplied only at execution time.
|
|
16
|
+
*/
|
|
17
|
+
export interface GeoParquetResourceHandleV1 {
|
|
18
|
+
readonly kind: typeof QUERY_RESOURCE_HANDLE_KIND;
|
|
19
|
+
readonly version: typeof QUERY_RESOURCE_HANDLE_VERSION;
|
|
20
|
+
readonly protocol: "geoparquet";
|
|
21
|
+
readonly resource: GeoParquetResolverResourceReferenceV1;
|
|
22
|
+
/** Stable, non-secret authorization partition id; never a token or credential. */
|
|
23
|
+
readonly authorizationContextId: string;
|
|
24
|
+
/** Data revision/validator identity. Credential rotation must not change it. */
|
|
25
|
+
readonly resourceVersion?: string;
|
|
26
|
+
}
|
|
27
|
+
/** Ephemeral raw GeoParquet addressing returned at the trusted execution boundary. */
|
|
28
|
+
export interface ResolvedGeoParquetResource {
|
|
29
|
+
/**
|
|
30
|
+
* One to 64 values, each at most 16 KiB UTF-8 and at most 128 KiB in
|
|
31
|
+
* aggregate. Never persist, log, fingerprint, or place them in a query plan.
|
|
32
|
+
*/
|
|
33
|
+
readonly sources: readonly string[];
|
|
34
|
+
}
|
|
35
|
+
/** Per-execution authorization and cancellation state supplied to a resolver. */
|
|
36
|
+
export interface GeoParquetResourceResolutionContext {
|
|
37
|
+
/** Must exactly match the stable, non-secret partition id in the handle. */
|
|
38
|
+
readonly authorizationContextId: string;
|
|
39
|
+
readonly signal?: AbortSignal;
|
|
40
|
+
}
|
|
41
|
+
/** Injected, lifecycle-scoped GeoParquet locator resolver. */
|
|
42
|
+
export type GeoParquetResourceResolver = (handle: GeoParquetResourceHandleV1, context: GeoParquetResourceResolutionContext) => ResolvedGeoParquetResource | Promise<ResolvedGeoParquetResource>;
|
|
43
|
+
/** Input used to register or atomically replace one private resource locator. */
|
|
44
|
+
export interface RegisterGeoParquetResourceInput {
|
|
45
|
+
readonly id: string;
|
|
46
|
+
readonly authorizationContextId: string;
|
|
47
|
+
readonly resourceVersion?: string;
|
|
48
|
+
/** Private addressing subject to the same fixed bounds as resolved sources. */
|
|
49
|
+
readonly sources: readonly string[];
|
|
50
|
+
/** Private Unix epoch deadline in milliseconds; expiry occurs at `now >= expiresAt`. */
|
|
51
|
+
readonly expiresAt?: number;
|
|
52
|
+
}
|
|
53
|
+
/** Stable identity input for a handle whose private locator is registered elsewhere. */
|
|
54
|
+
export interface CreateGeoParquetResourceHandleInput {
|
|
55
|
+
readonly resolver: string;
|
|
56
|
+
readonly id: string;
|
|
57
|
+
readonly authorizationContextId: string;
|
|
58
|
+
readonly resourceVersion?: string;
|
|
59
|
+
}
|
|
60
|
+
/** Options for an ephemeral, in-memory resolver registry. */
|
|
61
|
+
export interface GeoParquetResourceRegistryOptions {
|
|
62
|
+
/** Canonical lowercase reverse-DNS resolver identifier embedded in handles. */
|
|
63
|
+
readonly resolver: string;
|
|
64
|
+
/** May tighten, but never raise, the SDK's hard 4,096-entry ceiling. */
|
|
65
|
+
readonly maxEntries?: number;
|
|
66
|
+
/** Injectable finite Unix epoch millisecond clock for lifecycle control and tests. */
|
|
67
|
+
readonly now?: () => number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Lifecycle-scoped private resource registry. This is isolation, not encrypted
|
|
71
|
+
* storage: call `dispose()` when the owning client/session ends.
|
|
72
|
+
*/
|
|
73
|
+
export interface GeoParquetResourceRegistry {
|
|
74
|
+
register(input: RegisterGeoParquetResourceInput): GeoParquetResourceHandleV1;
|
|
75
|
+
readonly resolver: GeoParquetResourceResolver;
|
|
76
|
+
/** Idempotently removes a handle without revealing whether it existed. */
|
|
77
|
+
revoke(handle: GeoParquetResourceHandleV1): void;
|
|
78
|
+
/** Idempotently clears every private locator and closes the registry. */
|
|
79
|
+
dispose(): void;
|
|
80
|
+
}
|
|
81
|
+
/** Create a credential-free handle without registering or resolving a locator. */
|
|
82
|
+
export declare function createGeoParquetResourceHandle(input: CreateGeoParquetResourceHandleInput): GeoParquetResourceHandleV1;
|
|
83
|
+
/** Parse an exact v1 handle without invoking accessors or retaining rejected input. */
|
|
84
|
+
export declare function parseGeoParquetResourceHandle(value: unknown): GeoParquetResourceHandleV1;
|
|
85
|
+
/** Stable credential-free fingerprint for plan/cache identity. */
|
|
86
|
+
export declare function hashGeoParquetResourceHandle(value: unknown): `sha256:${string}`;
|
|
87
|
+
/**
|
|
88
|
+
* Resolve a handle through an injected resolver after enforcing scope,
|
|
89
|
+
* cancellation, output bounds, and fixed-message error redaction.
|
|
90
|
+
*/
|
|
91
|
+
export declare function resolveGeoParquetResource(value: unknown, resolver: GeoParquetResourceResolver, context: GeoParquetResourceResolutionContext): Promise<ResolvedGeoParquetResource>;
|
|
92
|
+
/** Create a bounded in-memory registry for private, rotation-friendly locators. */
|
|
93
|
+
export declare function createGeoParquetResourceRegistry(options: GeoParquetResourceRegistryOptions): GeoParquetResourceRegistry;
|
|
94
|
+
//# sourceMappingURL=resource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../../src/query-planner/resource.ts"],"names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