@honua/sdk-esri-compat 0.0.9-alpha.0 → 0.0.20-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/contract/analytics-sources.d.ts +149 -0
- package/contract/analytics-sources.d.ts.map +1 -0
- package/contract/analytics-sources.js +235 -0
- package/contract/edit-session.js +46 -3
- package/contract/edit-sketch.d.ts +91 -0
- package/contract/edit-sketch.d.ts.map +1 -0
- package/contract/edit-sketch.js +281 -0
- package/contract/index.d.ts +46 -9
- package/contract/index.d.ts.map +1 -1
- package/contract/index.js +38 -4
- package/contract/jobs.d.ts +37 -3
- package/contract/jobs.d.ts.map +1 -1
- package/contract/jobs.js +18 -0
- package/contract/source.d.ts +277 -2
- package/contract/source.d.ts.map +1 -1
- package/contract/source.js +308 -19
- package/contract/spatial-aggregation.d.ts +12 -0
- package/contract/spatial-aggregation.d.ts.map +1 -1
- package/contract/temporal.d.ts +455 -0
- package/contract/temporal.d.ts.map +1 -0
- package/contract/temporal.js +146 -0
- package/contract/tiles.d.ts +173 -4
- package/contract/tiles.d.ts.map +1 -1
- package/contract/tiles.js +247 -1
- package/contract/types.d.ts +122 -0
- package/contract/types.d.ts.map +1 -1
- package/contract/widget-source.d.ts +43 -2
- package/contract/widget-source.d.ts.map +1 -1
- package/contract/widget-source.js +758 -12
- package/core/batch.d.ts.map +1 -1
- package/core/batch.js +3 -2
- package/core/cache-state.d.ts +2 -0
- package/core/cache-state.d.ts.map +1 -1
- package/core/cache-state.js +6 -6
- package/core/client.d.ts +268 -7
- package/core/client.d.ts.map +1 -1
- package/core/client.js +738 -1820
- package/core/compatibility.d.ts +18 -0
- package/core/compatibility.d.ts.map +1 -0
- package/core/compatibility.js +245 -0
- package/core/errors.d.ts +40 -1
- package/core/errors.d.ts.map +1 -1
- package/core/errors.js +40 -0
- package/core/esri-geojson.d.ts +66 -0
- package/core/esri-geojson.d.ts.map +1 -0
- package/core/esri-geojson.js +363 -0
- package/core/geoservices.d.ts +34 -0
- package/core/geoservices.d.ts.map +1 -0
- package/core/geoservices.js +434 -0
- package/core/grpc-adapter.d.ts.map +1 -1
- package/core/grpc-adapter.js +33 -49
- package/core/odata.d.ts.map +1 -1
- package/core/odata.js +76 -9
- package/core/ogc-features.d.ts +23 -0
- package/core/ogc-features.d.ts.map +1 -0
- package/core/ogc-features.js +114 -0
- package/core/ogc-maps.d.ts +4 -0
- package/core/ogc-maps.d.ts.map +1 -1
- package/core/ogc-maps.js +73 -0
- package/core/ogc-processes.d.ts +29 -3
- package/core/ogc-processes.d.ts.map +1 -1
- package/core/ogc-processes.js +107 -9
- package/core/ogc-records.d.ts +9 -0
- package/core/ogc-records.d.ts.map +1 -1
- package/core/ogc-records.js +108 -5
- package/core/ogc-tiles.d.ts +71 -1
- package/core/ogc-tiles.d.ts.map +1 -1
- package/core/ogc-tiles.js +102 -0
- package/core/path-utils.d.ts +69 -0
- package/core/path-utils.d.ts.map +1 -0
- package/core/path-utils.js +123 -0
- package/core/pbf-decoder.d.ts +11 -0
- package/core/pbf-decoder.d.ts.map +1 -1
- package/core/pbf-decoder.js +79 -4
- package/core/process-runner.d.ts +1 -0
- package/core/process-runner.d.ts.map +1 -1
- package/core/process-runner.js +56 -8
- package/core/protocol-transport.d.ts +76 -0
- package/core/protocol-transport.d.ts.map +1 -0
- package/core/protocol-transport.js +15 -0
- package/core/request-pipeline.d.ts +88 -0
- package/core/request-pipeline.d.ts.map +1 -0
- package/core/request-pipeline.js +273 -0
- package/core/stac.d.ts +12 -0
- package/core/stac.d.ts.map +1 -1
- package/core/stac.js +117 -4
- package/core/surfaces.d.ts +2 -2
- package/core/surfaces.d.ts.map +1 -1
- package/core/surfaces.js +96 -36
- package/core/terrain-elevation.d.ts +114 -0
- package/core/terrain-elevation.d.ts.map +1 -0
- package/core/terrain-elevation.js +150 -0
- package/core/types.d.ts +49 -0
- package/core/types.d.ts.map +1 -1
- package/core/wfs-filter.d.ts.map +1 -1
- package/core/wfs-filter.js +67 -19
- package/core/wire-shared.d.ts +32 -0
- package/core/wire-shared.d.ts.map +1 -0
- package/core/wire-shared.js +76 -0
- package/core/wms-axis.d.ts +36 -0
- package/core/wms-axis.d.ts.map +1 -0
- package/core/wms-axis.js +73 -0
- package/core/wms-capabilities.d.ts.map +1 -1
- package/core/wms-capabilities.js +2 -9
- package/core/wms.d.ts +36 -0
- package/core/wms.d.ts.map +1 -1
- package/core/wms.js +157 -1
- package/core/wmts-capabilities.d.ts.map +1 -1
- package/core/wmts-capabilities.js +2 -9
- package/core/wmts.d.ts +24 -1
- package/core/wmts.d.ts.map +1 -1
- package/core/wmts.js +160 -1
- package/core/xml-text.d.ts +20 -0
- package/core/xml-text.d.ts.map +1 -0
- package/core/xml-text.js +85 -0
- package/esri-compat/esri-request.d.ts.map +1 -1
- package/esri-compat/esri-request.js +62 -1
- package/esri-compat/feature-filter.d.ts +55 -0
- package/esri-compat/feature-filter.d.ts.map +1 -0
- package/esri-compat/feature-filter.js +109 -0
- package/esri-compat/feature-layer.d.ts.map +1 -1
- package/esri-compat/feature-layer.js +15 -9
- package/esri-compat/geojson-layer.d.ts +86 -0
- package/esri-compat/geojson-layer.d.ts.map +1 -0
- package/esri-compat/geojson-layer.js +191 -0
- package/esri-compat/geometry-engine.d.ts +107 -0
- package/esri-compat/geometry-engine.d.ts.map +1 -0
- package/esri-compat/geometry-engine.js +266 -0
- package/esri-compat/imagery-layer.d.ts +78 -0
- package/esri-compat/imagery-layer.d.ts.map +1 -0
- package/esri-compat/imagery-layer.js +167 -0
- package/esri-compat/map-image-layer.d.ts.map +1 -1
- package/esri-compat/map-image-layer.js +9 -4
- package/esri-compat/map-view.d.ts +8 -0
- package/esri-compat/map-view.d.ts.map +1 -1
- package/esri-compat/map-view.js +70 -5
- package/esri-compat/query.d.ts +12 -0
- package/esri-compat/query.d.ts.map +1 -1
- package/esri-compat/query.js +13 -4
- package/esri-compat/reactive-utils.d.ts +1 -0
- package/esri-compat/reactive-utils.d.ts.map +1 -1
- package/esri-compat/reactive-utils.js +16 -1
- package/esri-compat/tile-layer.d.ts.map +1 -1
- package/esri-compat/tile-layer.js +2 -1
- package/esri-compat/url.d.ts +1 -0
- package/esri-compat/url.d.ts.map +1 -1
- package/esri-compat/url.js +14 -0
- package/esri-compat/vector-tile-layer.d.ts +47 -0
- package/esri-compat/vector-tile-layer.d.ts.map +1 -0
- package/esri-compat/vector-tile-layer.js +130 -0
- package/esri-compat/wfs-layer.d.ts +64 -0
- package/esri-compat/wfs-layer.d.ts.map +1 -0
- package/esri-compat/wfs-layer.js +145 -0
- package/esri-compat/wms-layer.d.ts +76 -0
- package/esri-compat/wms-layer.d.ts.map +1 -0
- package/esri-compat/wms-layer.js +157 -0
- package/expr/expression.d.ts +457 -0
- package/expr/expression.d.ts.map +1 -0
- package/expr/expression.js +663 -0
- package/expr/index.d.ts +32 -0
- package/expr/index.d.ts.map +1 -0
- package/expr/index.js +30 -0
- package/geometry/convert.d.ts +13 -0
- package/geometry/convert.d.ts.map +1 -0
- package/geometry/convert.js +12 -0
- package/geometry/index.d.ts +17 -0
- package/geometry/index.d.ts.map +1 -0
- package/geometry/index.js +15 -0
- package/geometry/internal.d.ts +25 -0
- package/geometry/internal.d.ts.map +1 -0
- package/geometry/internal.js +40 -0
- package/geometry/ops.d.ts +71 -0
- package/geometry/ops.d.ts.map +1 -0
- package/geometry/ops.js +147 -0
- package/geometry/project.d.ts +40 -0
- package/geometry/project.d.ts.map +1 -0
- package/geometry/project.js +88 -0
- package/geometry/types.d.ts +36 -0
- package/geometry/types.d.ts.map +1 -0
- package/geometry/types.js +12 -0
- package/index.d.ts +18 -4
- package/index.js +7 -0
- package/package.json +18 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Honua
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider-neutral analytics source primitives for warehouse and indexed data.
|
|
3
|
+
*
|
|
4
|
+
* These descriptors are serializable contract objects. They describe table,
|
|
5
|
+
* SQL query, tileset, and indexed spatial sources without embedding
|
|
6
|
+
* credentials or binding callers to a warehouse vendor SDK.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import type { HonuaExtent } from "../core/types.js";
|
|
11
|
+
import type { Capability, DegradedReason, SourceFreshnessContract, SourceId } from "./types.js";
|
|
12
|
+
export declare const ANALYTICS_SOURCE_SCHEMA_VERSION: "honua.analytics-source.v1";
|
|
13
|
+
export type AnalyticsSourceSchemaVersion = typeof ANALYTICS_SOURCE_SCHEMA_VERSION;
|
|
14
|
+
export type AnalyticsSourceKind = "warehouse-table" | "warehouse-query" | "warehouse-tileset" | "indexed-spatial" | "h3-index" | "quadbin-index";
|
|
15
|
+
export type AnalyticsWarehouseProvider = "bigquery" | "snowflake" | "redshift" | "postgres" | "duckdb" | "carto" | "honua" | "custom";
|
|
16
|
+
export type AnalyticsSourcePushdownCapability = "sql" | "tiles" | "widgets" | "spatialAggregate" | "crossfilter" | "metadata";
|
|
17
|
+
export type AnalyticsSourceFallbackMode = "disabled" | "server-degraded" | "client-bounded";
|
|
18
|
+
export type AnalyticsIndexHierarchy = "parent-child" | "flat" | "unknown";
|
|
19
|
+
export type AnalyticsIndexCoverageKind = "global" | "bounded" | "sparse" | "viewport";
|
|
20
|
+
export interface AnalyticsSourceRelationDescriptor {
|
|
21
|
+
readonly project?: string;
|
|
22
|
+
readonly dataset?: string;
|
|
23
|
+
readonly schema?: string;
|
|
24
|
+
readonly table: string;
|
|
25
|
+
readonly catalog?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface AnalyticsSourceSqlDescriptor {
|
|
28
|
+
/** SQL text or a stable server-side query id. Never put secrets here. */
|
|
29
|
+
readonly text: string;
|
|
30
|
+
readonly dialect?: string;
|
|
31
|
+
readonly parameters?: Readonly<Record<string, string | number | boolean | null>>;
|
|
32
|
+
}
|
|
33
|
+
export interface AnalyticsSourceTilesetDescriptor {
|
|
34
|
+
readonly id: string;
|
|
35
|
+
readonly url?: string;
|
|
36
|
+
readonly tileMatrixSet?: string;
|
|
37
|
+
readonly minzoom?: number;
|
|
38
|
+
readonly maxzoom?: number;
|
|
39
|
+
readonly sourceLayer?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface AnalyticsIndexCoverageDescriptor {
|
|
42
|
+
readonly kind: AnalyticsIndexCoverageKind;
|
|
43
|
+
readonly extent?: HonuaExtent;
|
|
44
|
+
readonly cellCount?: number;
|
|
45
|
+
readonly complete?: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface AnalyticsIndexDescriptor {
|
|
48
|
+
readonly modelId: "h3" | "quadbin" | string;
|
|
49
|
+
readonly cellIdField: string;
|
|
50
|
+
readonly resolution?: number;
|
|
51
|
+
readonly minResolution?: number;
|
|
52
|
+
readonly maxResolution?: number;
|
|
53
|
+
readonly hierarchy?: AnalyticsIndexHierarchy;
|
|
54
|
+
readonly coverage?: AnalyticsIndexCoverageDescriptor;
|
|
55
|
+
readonly parentField?: string;
|
|
56
|
+
readonly geometryField?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface AnalyticsSourceCapabilityMetadata {
|
|
59
|
+
readonly pushdown: readonly AnalyticsSourcePushdownCapability[];
|
|
60
|
+
readonly unsupported?: readonly AnalyticsSourcePushdownCapability[];
|
|
61
|
+
readonly maxClientRows?: number;
|
|
62
|
+
readonly realtime?: boolean;
|
|
63
|
+
readonly freshness?: SourceFreshnessContract;
|
|
64
|
+
}
|
|
65
|
+
export interface AnalyticsSourceCacheIdentity {
|
|
66
|
+
readonly sourceVersion?: string;
|
|
67
|
+
readonly authorizationScope?: string;
|
|
68
|
+
readonly filters?: unknown;
|
|
69
|
+
readonly indexResolution?: number;
|
|
70
|
+
readonly projection?: unknown;
|
|
71
|
+
readonly widgetProjection?: unknown;
|
|
72
|
+
readonly styleProjection?: unknown;
|
|
73
|
+
readonly extra?: Readonly<Record<string, unknown>>;
|
|
74
|
+
}
|
|
75
|
+
export interface AnalyticsSourceCachePolicy {
|
|
76
|
+
readonly metadataCacheable?: boolean;
|
|
77
|
+
readonly resultCacheable?: boolean;
|
|
78
|
+
readonly ttlMs?: number;
|
|
79
|
+
readonly key?: AnalyticsSourceCacheIdentity;
|
|
80
|
+
}
|
|
81
|
+
export interface AnalyticsSourceFallbackPolicy {
|
|
82
|
+
readonly mode: AnalyticsSourceFallbackMode;
|
|
83
|
+
readonly reason?: string;
|
|
84
|
+
}
|
|
85
|
+
export interface AnalyticsSourceProtocolEscapeHatch {
|
|
86
|
+
readonly provider: string;
|
|
87
|
+
readonly protocol: string;
|
|
88
|
+
readonly options?: Readonly<Record<string, unknown>>;
|
|
89
|
+
}
|
|
90
|
+
export interface AnalyticsSourceDescriptorBase {
|
|
91
|
+
readonly schemaVersion?: AnalyticsSourceSchemaVersion;
|
|
92
|
+
readonly kind: AnalyticsSourceKind;
|
|
93
|
+
readonly id: SourceId;
|
|
94
|
+
readonly title?: string;
|
|
95
|
+
readonly description?: string;
|
|
96
|
+
readonly provider?: AnalyticsWarehouseProvider | string;
|
|
97
|
+
readonly sourceId?: SourceId;
|
|
98
|
+
readonly capabilities?: AnalyticsSourceCapabilityMetadata;
|
|
99
|
+
readonly cache?: AnalyticsSourceCachePolicy;
|
|
100
|
+
readonly fallback?: AnalyticsSourceFallbackPolicy;
|
|
101
|
+
readonly protocol?: AnalyticsSourceProtocolEscapeHatch;
|
|
102
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
103
|
+
}
|
|
104
|
+
export interface WarehouseTableSourceDescriptor extends AnalyticsSourceDescriptorBase {
|
|
105
|
+
readonly kind: "warehouse-table";
|
|
106
|
+
readonly relation: AnalyticsSourceRelationDescriptor;
|
|
107
|
+
}
|
|
108
|
+
export interface WarehouseQuerySourceDescriptor extends AnalyticsSourceDescriptorBase {
|
|
109
|
+
readonly kind: "warehouse-query";
|
|
110
|
+
readonly sql: AnalyticsSourceSqlDescriptor;
|
|
111
|
+
}
|
|
112
|
+
export interface WarehouseTilesetSourceDescriptor extends AnalyticsSourceDescriptorBase {
|
|
113
|
+
readonly kind: "warehouse-tileset";
|
|
114
|
+
readonly tileset: AnalyticsSourceTilesetDescriptor;
|
|
115
|
+
readonly relation?: AnalyticsSourceRelationDescriptor;
|
|
116
|
+
readonly sql?: AnalyticsSourceSqlDescriptor;
|
|
117
|
+
}
|
|
118
|
+
export interface IndexedSpatialSourceDescriptor extends AnalyticsSourceDescriptorBase {
|
|
119
|
+
readonly kind: "indexed-spatial" | "h3-index" | "quadbin-index";
|
|
120
|
+
readonly relation?: AnalyticsSourceRelationDescriptor;
|
|
121
|
+
readonly sql?: AnalyticsSourceSqlDescriptor;
|
|
122
|
+
readonly index: AnalyticsIndexDescriptor;
|
|
123
|
+
}
|
|
124
|
+
export type AnalyticsSourceDescriptor = WarehouseTableSourceDescriptor | WarehouseQuerySourceDescriptor | WarehouseTilesetSourceDescriptor | IndexedSpatialSourceDescriptor;
|
|
125
|
+
export interface AnalyticsSourceCacheKeyOptions {
|
|
126
|
+
readonly cache?: AnalyticsSourceCacheIdentity;
|
|
127
|
+
readonly prefix?: string;
|
|
128
|
+
readonly operation?: "tiles" | "widget" | "spatialAggregate" | "sql" | string;
|
|
129
|
+
}
|
|
130
|
+
export interface AnalyticsSourcePushdownAssessment {
|
|
131
|
+
readonly sourceId: SourceId;
|
|
132
|
+
readonly capability: AnalyticsSourcePushdownCapability;
|
|
133
|
+
readonly supported: boolean;
|
|
134
|
+
readonly cacheKey: string;
|
|
135
|
+
readonly degraded?: readonly DegradedReason[];
|
|
136
|
+
}
|
|
137
|
+
export declare function defineWarehouseTableSource(descriptor: Omit<WarehouseTableSourceDescriptor, "kind">): WarehouseTableSourceDescriptor;
|
|
138
|
+
export declare function defineWarehouseQuerySource(descriptor: Omit<WarehouseQuerySourceDescriptor, "kind">): WarehouseQuerySourceDescriptor;
|
|
139
|
+
export declare function defineWarehouseTilesetSource(descriptor: Omit<WarehouseTilesetSourceDescriptor, "kind">): WarehouseTilesetSourceDescriptor;
|
|
140
|
+
export declare function defineIndexedSpatialSource(descriptor: Omit<IndexedSpatialSourceDescriptor, "kind"> & {
|
|
141
|
+
readonly kind?: IndexedSpatialSourceDescriptor["kind"];
|
|
142
|
+
}): IndexedSpatialSourceDescriptor;
|
|
143
|
+
export declare function normalizeAnalyticsSourceDescriptor<T extends AnalyticsSourceDescriptor>(descriptor: T): T;
|
|
144
|
+
export declare function analyticsSourceId(descriptor: AnalyticsSourceDescriptor): SourceId;
|
|
145
|
+
export declare function isAnalyticsSourceDescriptor(value: unknown): value is AnalyticsSourceDescriptor;
|
|
146
|
+
export declare function buildAnalyticsSourceCacheKey(descriptor: AnalyticsSourceDescriptor, options?: AnalyticsSourceCacheKeyOptions): string;
|
|
147
|
+
export declare function assessAnalyticsSourcePushdown(descriptor: AnalyticsSourceDescriptor, capability: AnalyticsSourcePushdownCapability, options?: AnalyticsSourceCacheKeyOptions): AnalyticsSourcePushdownAssessment;
|
|
148
|
+
export declare function analyticsSourceDegradedReason(descriptor: AnalyticsSourceDescriptor, capability: Capability, reason?: string): DegradedReason;
|
|
149
|
+
//# sourceMappingURL=analytics-sources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics-sources.d.ts","sourceRoot":"","sources":["../../../src/contract/analytics-sources.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,uBAAuB,EAAE,QAAQ,EAAE,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G;IACzD,QAAQ,CAAC,IAAI,CAAC,EAAE,8BAA8B,CAAC,MAAM,CAAC,CAAC;CACxD,GACA,8BAA8B,CAKhC;AAED,wBAAgB,kCAAkC,CAAC,CAAC,SAAS,yBAAyB,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC,CAwCxG;AAED,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,yBAAyB,GAAG,QAAQ,CAEjF;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,yBAAyB,CAe9F;AAED,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,yBAAyB,EACrC,OAAO,GAAE,8BAAmC,GAC3C,MAAM,CAuBR;AAED,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,yBAAyB,EACrC,UAAU,EAAE,iCAAiC,EAC7C,OAAO,GAAE,8BAAmC,GAC3C,iCAAiC,CAmBnC;AAED,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,yBAAyB,EACrC,UAAU,EAAE,UAAU,EACtB,MAAM,CAAC,EAAE,MAAM,GACd,cAAc,CAOhB"}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider-neutral analytics source primitives for warehouse and indexed data.
|
|
3
|
+
*
|
|
4
|
+
* These descriptors are serializable contract objects. They describe table,
|
|
5
|
+
* SQL query, tileset, and indexed spatial sources without embedding
|
|
6
|
+
* credentials or binding callers to a warehouse vendor SDK.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
export const ANALYTICS_SOURCE_SCHEMA_VERSION = "honua.analytics-source.v1";
|
|
11
|
+
export function defineWarehouseTableSource(descriptor) {
|
|
12
|
+
return normalizeAnalyticsSourceDescriptor({ ...descriptor, kind: "warehouse-table" });
|
|
13
|
+
}
|
|
14
|
+
export function defineWarehouseQuerySource(descriptor) {
|
|
15
|
+
return normalizeAnalyticsSourceDescriptor({ ...descriptor, kind: "warehouse-query" });
|
|
16
|
+
}
|
|
17
|
+
export function defineWarehouseTilesetSource(descriptor) {
|
|
18
|
+
return normalizeAnalyticsSourceDescriptor({ ...descriptor, kind: "warehouse-tileset" });
|
|
19
|
+
}
|
|
20
|
+
export function defineIndexedSpatialSource(descriptor) {
|
|
21
|
+
const modelId = descriptor.index?.modelId;
|
|
22
|
+
const kind = descriptor.kind ?? (modelId === "h3" ? "h3-index" : modelId === "quadbin" ? "quadbin-index" : "indexed-spatial");
|
|
23
|
+
return normalizeAnalyticsSourceDescriptor({ ...descriptor, kind });
|
|
24
|
+
}
|
|
25
|
+
export function normalizeAnalyticsSourceDescriptor(descriptor) {
|
|
26
|
+
if (!isRecord(descriptor)) {
|
|
27
|
+
throw new Error("AnalyticsSourceDescriptor must be an object");
|
|
28
|
+
}
|
|
29
|
+
if (!descriptor.id || typeof descriptor.id !== "string") {
|
|
30
|
+
throw new Error("AnalyticsSourceDescriptor.id is required");
|
|
31
|
+
}
|
|
32
|
+
if (!isAnalyticsSourceKind(descriptor.kind)) {
|
|
33
|
+
throw new Error("AnalyticsSourceDescriptor.kind is required");
|
|
34
|
+
}
|
|
35
|
+
if (descriptor.kind === "warehouse-table" && !isRelationDescriptor(descriptor.relation)) {
|
|
36
|
+
throw new Error("warehouse table sources require relation.table");
|
|
37
|
+
}
|
|
38
|
+
if (descriptor.kind === "warehouse-query" && !isSqlDescriptor(descriptor.sql)) {
|
|
39
|
+
throw new Error("warehouse query sources require sql.text");
|
|
40
|
+
}
|
|
41
|
+
if (descriptor.kind === "warehouse-tileset" && !isTilesetDescriptor(descriptor.tileset)) {
|
|
42
|
+
throw new Error("warehouse tileset sources require tileset.id");
|
|
43
|
+
}
|
|
44
|
+
if ((descriptor.kind === "indexed-spatial" || descriptor.kind === "h3-index" || descriptor.kind === "quadbin-index") &&
|
|
45
|
+
!isIndexDescriptor(descriptor.index)) {
|
|
46
|
+
throw new Error("indexed spatial sources require index.modelId and index.cellIdField");
|
|
47
|
+
}
|
|
48
|
+
const capabilities = isCapabilitiesMetadata(descriptor.capabilities) ? descriptor.capabilities : undefined;
|
|
49
|
+
const fallback = isFallbackPolicy(descriptor.fallback) ? descriptor.fallback : undefined;
|
|
50
|
+
return {
|
|
51
|
+
...descriptor,
|
|
52
|
+
schemaVersion: descriptor.schemaVersion ?? ANALYTICS_SOURCE_SCHEMA_VERSION,
|
|
53
|
+
sourceId: descriptor.sourceId ?? descriptor.id,
|
|
54
|
+
capabilities: {
|
|
55
|
+
pushdown: capabilities?.pushdown ?? defaultPushdown(descriptor),
|
|
56
|
+
...(capabilities?.unsupported ? { unsupported: capabilities.unsupported } : {}),
|
|
57
|
+
...(capabilities?.maxClientRows !== undefined ? { maxClientRows: capabilities.maxClientRows } : {}),
|
|
58
|
+
...(capabilities?.realtime !== undefined ? { realtime: capabilities.realtime } : {}),
|
|
59
|
+
...(capabilities?.freshness ? { freshness: capabilities.freshness } : {}),
|
|
60
|
+
},
|
|
61
|
+
fallback: fallback ?? { mode: "disabled" },
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export function analyticsSourceId(descriptor) {
|
|
65
|
+
return normalizeAnalyticsSourceDescriptor(descriptor).sourceId ?? descriptor.id;
|
|
66
|
+
}
|
|
67
|
+
export function isAnalyticsSourceDescriptor(value) {
|
|
68
|
+
if (!isRecord(value))
|
|
69
|
+
return false;
|
|
70
|
+
if (typeof value.id !== "string" || value.id.length === 0 || !isAnalyticsSourceKind(value.kind))
|
|
71
|
+
return false;
|
|
72
|
+
switch (value.kind) {
|
|
73
|
+
case "warehouse-table":
|
|
74
|
+
return isRelationDescriptor(value.relation);
|
|
75
|
+
case "warehouse-query":
|
|
76
|
+
return isSqlDescriptor(value.sql);
|
|
77
|
+
case "warehouse-tileset":
|
|
78
|
+
return isTilesetDescriptor(value.tileset);
|
|
79
|
+
case "indexed-spatial":
|
|
80
|
+
case "h3-index":
|
|
81
|
+
case "quadbin-index":
|
|
82
|
+
return isIndexDescriptor(value.index);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export function buildAnalyticsSourceCacheKey(descriptor, options = {}) {
|
|
86
|
+
const normalized = normalizeAnalyticsSourceDescriptor(descriptor);
|
|
87
|
+
const cache = { ...(normalized.cache?.key ?? {}), ...(options.cache ?? {}) };
|
|
88
|
+
return `${options.prefix ?? "honua-analytics-source"}:${stableStringify({
|
|
89
|
+
v: 1,
|
|
90
|
+
schemaVersion: normalized.schemaVersion,
|
|
91
|
+
operation: options.operation,
|
|
92
|
+
kind: normalized.kind,
|
|
93
|
+
id: normalized.id,
|
|
94
|
+
sourceId: normalized.sourceId,
|
|
95
|
+
provider: normalized.provider,
|
|
96
|
+
relation: relationForCache(normalized),
|
|
97
|
+
sql: sqlForCache(normalized),
|
|
98
|
+
tileset: tilesetForCache(normalized),
|
|
99
|
+
index: indexForCache(normalized, cache.indexResolution),
|
|
100
|
+
sourceVersion: cache.sourceVersion,
|
|
101
|
+
authorizationScope: cache.authorizationScope,
|
|
102
|
+
filters: cache.filters,
|
|
103
|
+
projection: cache.projection,
|
|
104
|
+
widgetProjection: cache.widgetProjection,
|
|
105
|
+
styleProjection: cache.styleProjection,
|
|
106
|
+
extra: cache.extra,
|
|
107
|
+
})}`;
|
|
108
|
+
}
|
|
109
|
+
export function assessAnalyticsSourcePushdown(descriptor, capability, options = {}) {
|
|
110
|
+
const normalized = normalizeAnalyticsSourceDescriptor(descriptor);
|
|
111
|
+
const supported = normalized.capabilities?.pushdown.includes(capability) === true;
|
|
112
|
+
const degraded = supported
|
|
113
|
+
? undefined
|
|
114
|
+
: [
|
|
115
|
+
analyticsSourceDegradedReason(normalized, capabilityToContractCapability(capability), `Analytics source "${normalized.id}" does not advertise ${capability} server pushdown.`),
|
|
116
|
+
];
|
|
117
|
+
return {
|
|
118
|
+
sourceId: analyticsSourceId(normalized),
|
|
119
|
+
capability,
|
|
120
|
+
supported,
|
|
121
|
+
cacheKey: buildAnalyticsSourceCacheKey(normalized, { ...options, operation: options.operation ?? capability }),
|
|
122
|
+
...(degraded ? { degraded } : {}),
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
export function analyticsSourceDegradedReason(descriptor, capability, reason) {
|
|
126
|
+
const normalized = normalizeAnalyticsSourceDescriptor(descriptor);
|
|
127
|
+
return {
|
|
128
|
+
capability,
|
|
129
|
+
reason: reason ?? normalized.fallback?.reason ?? `Analytics source "${normalized.id}" requires degraded execution.`,
|
|
130
|
+
sourceId: analyticsSourceId(normalized),
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function defaultPushdown(descriptor) {
|
|
134
|
+
switch (descriptor.kind) {
|
|
135
|
+
case "warehouse-table":
|
|
136
|
+
case "warehouse-query":
|
|
137
|
+
return ["sql", "widgets", "spatialAggregate", "metadata"];
|
|
138
|
+
case "warehouse-tileset":
|
|
139
|
+
return ["tiles", "metadata"];
|
|
140
|
+
case "h3-index":
|
|
141
|
+
case "quadbin-index":
|
|
142
|
+
case "indexed-spatial":
|
|
143
|
+
return ["tiles", "widgets", "spatialAggregate", "crossfilter", "metadata"];
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function capabilityToContractCapability(capability) {
|
|
147
|
+
if (capability === "tiles")
|
|
148
|
+
return "tiles";
|
|
149
|
+
if (capability === "sql")
|
|
150
|
+
return "sql";
|
|
151
|
+
if (capability === "spatialAggregate")
|
|
152
|
+
return "spatialAggregate";
|
|
153
|
+
return "queryAggregate";
|
|
154
|
+
}
|
|
155
|
+
function isAnalyticsSourceKind(value) {
|
|
156
|
+
return (value === "warehouse-table" ||
|
|
157
|
+
value === "warehouse-query" ||
|
|
158
|
+
value === "warehouse-tileset" ||
|
|
159
|
+
value === "indexed-spatial" ||
|
|
160
|
+
value === "h3-index" ||
|
|
161
|
+
value === "quadbin-index");
|
|
162
|
+
}
|
|
163
|
+
function isRelationDescriptor(value) {
|
|
164
|
+
return isRecord(value) && typeof value.table === "string" && value.table.length > 0;
|
|
165
|
+
}
|
|
166
|
+
function isSqlDescriptor(value) {
|
|
167
|
+
return isRecord(value) && typeof value.text === "string" && value.text.length > 0;
|
|
168
|
+
}
|
|
169
|
+
function isTilesetDescriptor(value) {
|
|
170
|
+
return isRecord(value) && typeof value.id === "string" && value.id.length > 0;
|
|
171
|
+
}
|
|
172
|
+
function isIndexDescriptor(value) {
|
|
173
|
+
return (isRecord(value) &&
|
|
174
|
+
typeof value.modelId === "string" &&
|
|
175
|
+
value.modelId.length > 0 &&
|
|
176
|
+
typeof value.cellIdField === "string" &&
|
|
177
|
+
value.cellIdField.length > 0);
|
|
178
|
+
}
|
|
179
|
+
function isCapabilitiesMetadata(value) {
|
|
180
|
+
if (!isRecord(value))
|
|
181
|
+
return false;
|
|
182
|
+
return ((!("pushdown" in value) || isPushdownCapabilityArray(value.pushdown)) &&
|
|
183
|
+
(!("unsupported" in value) || isPushdownCapabilityArray(value.unsupported)) &&
|
|
184
|
+
(!("maxClientRows" in value) || typeof value.maxClientRows === "number") &&
|
|
185
|
+
(!("realtime" in value) || typeof value.realtime === "boolean"));
|
|
186
|
+
}
|
|
187
|
+
function isPushdownCapabilityArray(value) {
|
|
188
|
+
return Array.isArray(value) && value.every(isPushdownCapability);
|
|
189
|
+
}
|
|
190
|
+
function isPushdownCapability(value) {
|
|
191
|
+
return (value === "sql" ||
|
|
192
|
+
value === "tiles" ||
|
|
193
|
+
value === "widgets" ||
|
|
194
|
+
value === "spatialAggregate" ||
|
|
195
|
+
value === "crossfilter" ||
|
|
196
|
+
value === "metadata");
|
|
197
|
+
}
|
|
198
|
+
function isFallbackPolicy(value) {
|
|
199
|
+
return (isRecord(value) &&
|
|
200
|
+
(value.mode === "disabled" || value.mode === "server-degraded" || value.mode === "client-bounded"));
|
|
201
|
+
}
|
|
202
|
+
function relationForCache(descriptor) {
|
|
203
|
+
return "relation" in descriptor ? descriptor.relation : undefined;
|
|
204
|
+
}
|
|
205
|
+
function sqlForCache(descriptor) {
|
|
206
|
+
return "sql" in descriptor ? descriptor.sql : undefined;
|
|
207
|
+
}
|
|
208
|
+
function tilesetForCache(descriptor) {
|
|
209
|
+
return "tileset" in descriptor ? descriptor.tileset : undefined;
|
|
210
|
+
}
|
|
211
|
+
function indexForCache(descriptor, overrideResolution) {
|
|
212
|
+
if (!("index" in descriptor))
|
|
213
|
+
return undefined;
|
|
214
|
+
return {
|
|
215
|
+
...descriptor.index,
|
|
216
|
+
resolution: overrideResolution ?? descriptor.index.resolution,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
function stableStringify(value) {
|
|
220
|
+
if (value === null || typeof value !== "object")
|
|
221
|
+
return JSON.stringify(value);
|
|
222
|
+
if (value instanceof Date)
|
|
223
|
+
return JSON.stringify(value.toISOString());
|
|
224
|
+
if (Array.isArray(value))
|
|
225
|
+
return `[${value.map(stableStringify).join(",")}]`;
|
|
226
|
+
const obj = value;
|
|
227
|
+
return `{${Object.keys(obj)
|
|
228
|
+
.sort()
|
|
229
|
+
.filter((key) => obj[key] !== undefined)
|
|
230
|
+
.map((key) => `${JSON.stringify(key)}:${stableStringify(obj[key])}`)
|
|
231
|
+
.join(",")}}`;
|
|
232
|
+
}
|
|
233
|
+
function isRecord(value) {
|
|
234
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
235
|
+
}
|
package/contract/edit-session.js
CHANGED
|
@@ -693,7 +693,7 @@ function attachmentOperationToWorkflowOperation(operation) {
|
|
|
693
693
|
function cloneCanonicalFeature(feature) {
|
|
694
694
|
return {
|
|
695
695
|
...(feature.id !== undefined ? { id: feature.id } : {}),
|
|
696
|
-
attributes:
|
|
696
|
+
attributes: cloneJsonLike(feature.attributes),
|
|
697
697
|
...(feature.geometry !== undefined ? { geometry: cloneRecord(feature.geometry) } : {}),
|
|
698
698
|
};
|
|
699
699
|
}
|
|
@@ -707,11 +707,54 @@ function cloneAttachmentMutation(mutation) {
|
|
|
707
707
|
function cloneRecord(value) {
|
|
708
708
|
if (value === null || value === undefined)
|
|
709
709
|
return null;
|
|
710
|
-
return
|
|
710
|
+
return cloneJsonLike(value);
|
|
711
711
|
}
|
|
712
712
|
function isEmptyValue(value) {
|
|
713
713
|
return value === undefined || value === null || value === "";
|
|
714
714
|
}
|
|
715
715
|
function sameValue(left, right) {
|
|
716
|
-
return
|
|
716
|
+
return deepEqual(left, right);
|
|
717
|
+
}
|
|
718
|
+
function cloneJsonLike(value) {
|
|
719
|
+
if (value === null || typeof value !== "object")
|
|
720
|
+
return value;
|
|
721
|
+
if (value instanceof Date)
|
|
722
|
+
return new Date(value.getTime());
|
|
723
|
+
if (Array.isArray(value))
|
|
724
|
+
return value.map(cloneJsonLike);
|
|
725
|
+
if (isCloneOpaque(value))
|
|
726
|
+
return value;
|
|
727
|
+
const out = {};
|
|
728
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
729
|
+
out[key] = cloneJsonLike(entry);
|
|
730
|
+
}
|
|
731
|
+
return out;
|
|
732
|
+
}
|
|
733
|
+
function deepEqual(left, right) {
|
|
734
|
+
if (Object.is(left, right))
|
|
735
|
+
return true;
|
|
736
|
+
if (left instanceof Date || right instanceof Date) {
|
|
737
|
+
return left instanceof Date && right instanceof Date && left.getTime() === right.getTime();
|
|
738
|
+
}
|
|
739
|
+
if (Array.isArray(left) || Array.isArray(right)) {
|
|
740
|
+
if (!Array.isArray(left) || !Array.isArray(right) || left.length !== right.length)
|
|
741
|
+
return false;
|
|
742
|
+
return left.every((value, index) => deepEqual(value, right[index]));
|
|
743
|
+
}
|
|
744
|
+
if (!isPlainRecord(left) || !isPlainRecord(right))
|
|
745
|
+
return false;
|
|
746
|
+
const leftKeys = Object.keys(left);
|
|
747
|
+
const rightKeys = Object.keys(right);
|
|
748
|
+
if (leftKeys.length !== rightKeys.length)
|
|
749
|
+
return false;
|
|
750
|
+
return leftKeys.every((key) => Object.hasOwn(right, key) && deepEqual(left[key], right[key]));
|
|
751
|
+
}
|
|
752
|
+
function isPlainRecord(value) {
|
|
753
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
754
|
+
return false;
|
|
755
|
+
const prototype = Object.getPrototypeOf(value);
|
|
756
|
+
return prototype === Object.prototype || prototype === null;
|
|
757
|
+
}
|
|
758
|
+
function isCloneOpaque(value) {
|
|
759
|
+
return !isPlainRecord(value);
|
|
717
760
|
}
|