@sqlrooms/deck 0.29.0-rc.10

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.
Files changed (251) hide show
  1. package/LICENSE.md +10 -0
  2. package/README.md +654 -0
  3. package/dist/BlockMapSettings.d.ts +3 -0
  4. package/dist/BlockMapSettings.d.ts.map +1 -0
  5. package/dist/BlockMapSettings.js +57 -0
  6. package/dist/BlockMapSettings.js.map +1 -0
  7. package/dist/DashboardMapSettings.d.ts +7 -0
  8. package/dist/DashboardMapSettings.d.ts.map +1 -0
  9. package/dist/DashboardMapSettings.js +52 -0
  10. package/dist/DashboardMapSettings.js.map +1 -0
  11. package/dist/DeckJsonMap.d.ts +4 -0
  12. package/dist/DeckJsonMap.d.ts.map +1 -0
  13. package/dist/DeckJsonMap.js +370 -0
  14. package/dist/DeckJsonMap.js.map +1 -0
  15. package/dist/DeckJsonMapSpec.d.ts +7617 -0
  16. package/dist/DeckJsonMapSpec.d.ts.map +1 -0
  17. package/dist/DeckJsonMapSpec.js +82 -0
  18. package/dist/DeckJsonMapSpec.js.map +1 -0
  19. package/dist/DeckMapDefaultStylesProvider.d.ts +28 -0
  20. package/dist/DeckMapDefaultStylesProvider.d.ts.map +1 -0
  21. package/dist/DeckMapDefaultStylesProvider.js +23 -0
  22. package/dist/DeckMapDefaultStylesProvider.js.map +1 -0
  23. package/dist/DeckMapSurface.d.ts +39 -0
  24. package/dist/DeckMapSurface.d.ts.map +1 -0
  25. package/dist/DeckMapSurface.js +137 -0
  26. package/dist/DeckMapSurface.js.map +1 -0
  27. package/dist/DeckMapsSlice.d.ts +99 -0
  28. package/dist/DeckMapsSlice.d.ts.map +1 -0
  29. package/dist/DeckMapsSlice.js +89 -0
  30. package/dist/DeckMapsSlice.js.map +1 -0
  31. package/dist/MapSettings.d.ts +16 -0
  32. package/dist/MapSettings.d.ts.map +1 -0
  33. package/dist/MapSettings.js +292 -0
  34. package/dist/MapSettings.js.map +1 -0
  35. package/dist/MapSettingsControls.d.ts +40 -0
  36. package/dist/MapSettingsControls.d.ts.map +1 -0
  37. package/dist/MapSettingsControls.js +54 -0
  38. package/dist/MapSettingsControls.js.map +1 -0
  39. package/dist/ai.d.ts +261 -0
  40. package/dist/ai.d.ts.map +1 -0
  41. package/dist/ai.js +392 -0
  42. package/dist/ai.js.map +1 -0
  43. package/dist/block.d.ts +21 -0
  44. package/dist/block.d.ts.map +1 -0
  45. package/dist/block.js +105 -0
  46. package/dist/block.js.map +1 -0
  47. package/dist/blockDocumentRegistration.d.ts +45 -0
  48. package/dist/blockDocumentRegistration.d.ts.map +1 -0
  49. package/dist/blockDocumentRegistration.js +68 -0
  50. package/dist/blockDocumentRegistration.js.map +1 -0
  51. package/dist/createDeckJsonSpecFromDatasets.d.ts +11 -0
  52. package/dist/createDeckJsonSpecFromDatasets.d.ts.map +1 -0
  53. package/dist/createDeckJsonSpecFromDatasets.js +85 -0
  54. package/dist/createDeckJsonSpecFromDatasets.js.map +1 -0
  55. package/dist/createOrUpdateDeckMapResource.d.ts +81 -0
  56. package/dist/createOrUpdateDeckMapResource.d.ts.map +1 -0
  57. package/dist/createOrUpdateDeckMapResource.js +82 -0
  58. package/dist/createOrUpdateDeckMapResource.js.map +1 -0
  59. package/dist/dashboard.d.ts +6 -0
  60. package/dist/dashboard.d.ts.map +1 -0
  61. package/dist/dashboard.js +337 -0
  62. package/dist/dashboard.js.map +1 -0
  63. package/dist/dashboardConfig.d.ts +25 -0
  64. package/dist/dashboardConfig.d.ts.map +1 -0
  65. package/dist/dashboardConfig.js +82 -0
  66. package/dist/dashboardConfig.js.map +1 -0
  67. package/dist/dashboardIntegration.d.ts +3 -0
  68. package/dist/dashboardIntegration.d.ts.map +1 -0
  69. package/dist/dashboardIntegration.js +16 -0
  70. package/dist/dashboardIntegration.js.map +1 -0
  71. package/dist/datasetSourceUtils.d.ts +16 -0
  72. package/dist/datasetSourceUtils.d.ts.map +1 -0
  73. package/dist/datasetSourceUtils.js +25 -0
  74. package/dist/datasetSourceUtils.js.map +1 -0
  75. package/dist/datasets/PreparedDatasetStore.d.ts +120 -0
  76. package/dist/datasets/PreparedDatasetStore.d.ts.map +1 -0
  77. package/dist/datasets/PreparedDatasetStore.js +268 -0
  78. package/dist/datasets/PreparedDatasetStore.js.map +1 -0
  79. package/dist/datasets/helpers.d.ts +57 -0
  80. package/dist/datasets/helpers.d.ts.map +1 -0
  81. package/dist/datasets/helpers.js +155 -0
  82. package/dist/datasets/helpers.js.map +1 -0
  83. package/dist/datasets/normalizeDatasets.d.ts +11 -0
  84. package/dist/datasets/normalizeDatasets.d.ts.map +1 -0
  85. package/dist/datasets/normalizeDatasets.js +50 -0
  86. package/dist/datasets/normalizeDatasets.js.map +1 -0
  87. package/dist/datasets/tableAdapter.d.ts +11 -0
  88. package/dist/datasets/tableAdapter.d.ts.map +1 -0
  89. package/dist/datasets/tableAdapter.js +11 -0
  90. package/dist/datasets/tableAdapter.js.map +1 -0
  91. package/dist/datasets/tableDatasetSql.d.ts +16 -0
  92. package/dist/datasets/tableDatasetSql.d.ts.map +1 -0
  93. package/dist/datasets/tableDatasetSql.js +49 -0
  94. package/dist/datasets/tableDatasetSql.js.map +1 -0
  95. package/dist/datasets/types.d.ts +40 -0
  96. package/dist/datasets/types.d.ts.map +1 -0
  97. package/dist/datasets/types.js +2 -0
  98. package/dist/datasets/types.js.map +1 -0
  99. package/dist/datasets/usePreparedDatasetStates.d.ts +16 -0
  100. package/dist/datasets/usePreparedDatasetStates.d.ts.map +1 -0
  101. package/dist/datasets/usePreparedDatasetStates.js +59 -0
  102. package/dist/datasets/usePreparedDatasetStates.js.map +1 -0
  103. package/dist/index.d.ts +34 -0
  104. package/dist/index.d.ts.map +1 -0
  105. package/dist/index.js +27 -0
  106. package/dist/index.js.map +1 -0
  107. package/dist/json/aggregateWaypoints.d.ts +14 -0
  108. package/dist/json/aggregateWaypoints.d.ts.map +1 -0
  109. package/dist/json/aggregateWaypoints.js +190 -0
  110. package/dist/json/aggregateWaypoints.js.map +1 -0
  111. package/dist/json/colorScaleFunction.d.ts +27 -0
  112. package/dist/json/colorScaleFunction.d.ts.map +1 -0
  113. package/dist/json/colorScaleFunction.js +46 -0
  114. package/dist/json/colorScaleFunction.js.map +1 -0
  115. package/dist/json/compileColorScale.d.ts +12 -0
  116. package/dist/json/compileColorScale.d.ts.map +1 -0
  117. package/dist/json/compileColorScale.js +125 -0
  118. package/dist/json/compileColorScale.js.map +1 -0
  119. package/dist/json/compileGeoArrowAccessor.d.ts +18 -0
  120. package/dist/json/compileGeoArrowAccessor.d.ts.map +1 -0
  121. package/dist/json/compileGeoArrowAccessor.js +129 -0
  122. package/dist/json/compileGeoArrowAccessor.js.map +1 -0
  123. package/dist/json/createDeckJsonConfiguration.d.ts +9 -0
  124. package/dist/json/createDeckJsonConfiguration.d.ts.map +1 -0
  125. package/dist/json/createDeckJsonConfiguration.js +315 -0
  126. package/dist/json/createDeckJsonConfiguration.js.map +1 -0
  127. package/dist/json/defaultClasses.d.ts +12 -0
  128. package/dist/json/defaultClasses.d.ts.map +1 -0
  129. package/dist/json/defaultClasses.js +35 -0
  130. package/dist/json/defaultClasses.js.map +1 -0
  131. package/dist/json/extractColorScaleLegends.d.ts +8 -0
  132. package/dist/json/extractColorScaleLegends.d.ts.map +1 -0
  133. package/dist/json/extractColorScaleLegends.js +86 -0
  134. package/dist/json/extractColorScaleLegends.js.map +1 -0
  135. package/dist/json/heatmapDefaults.d.ts +8 -0
  136. package/dist/json/heatmapDefaults.d.ts.map +1 -0
  137. package/dist/json/heatmapDefaults.js +14 -0
  138. package/dist/json/heatmapDefaults.js.map +1 -0
  139. package/dist/json/layerCompatibility.d.ts +21 -0
  140. package/dist/json/layerCompatibility.d.ts.map +1 -0
  141. package/dist/json/layerCompatibility.js +168 -0
  142. package/dist/json/layerCompatibility.js.map +1 -0
  143. package/dist/json/layerConfig.d.ts +14 -0
  144. package/dist/json/layerConfig.d.ts.map +1 -0
  145. package/dist/json/layerConfig.js +54 -0
  146. package/dist/json/layerConfig.js.map +1 -0
  147. package/dist/json/layers/DeckColumnLayer.d.ts +10 -0
  148. package/dist/json/layers/DeckColumnLayer.d.ts.map +1 -0
  149. package/dist/json/layers/DeckColumnLayer.js +26 -0
  150. package/dist/json/layers/DeckColumnLayer.js.map +1 -0
  151. package/dist/json/layers/DeckH3HexagonLayer.d.ts +37 -0
  152. package/dist/json/layers/DeckH3HexagonLayer.d.ts.map +1 -0
  153. package/dist/json/layers/DeckH3HexagonLayer.js +118 -0
  154. package/dist/json/layers/DeckH3HexagonLayer.js.map +1 -0
  155. package/dist/json/layers/DeckTripsLayer.d.ts +46 -0
  156. package/dist/json/layers/DeckTripsLayer.d.ts.map +1 -0
  157. package/dist/json/layers/DeckTripsLayer.js +170 -0
  158. package/dist/json/layers/DeckTripsLayer.js.map +1 -0
  159. package/dist/json/layers/createTableToRecordBatchAdapter.d.ts +20 -0
  160. package/dist/json/layers/createTableToRecordBatchAdapter.d.ts.map +1 -0
  161. package/dist/json/layers/createTableToRecordBatchAdapter.js +81 -0
  162. package/dist/json/layers/createTableToRecordBatchAdapter.js.map +1 -0
  163. package/dist/json/layers/index.d.ts +5 -0
  164. package/dist/json/layers/index.d.ts.map +1 -0
  165. package/dist/json/layers/index.js +5 -0
  166. package/dist/json/layers/index.js.map +1 -0
  167. package/dist/json/rewriteGeoArrowAccessors.d.ts +7 -0
  168. package/dist/json/rewriteGeoArrowAccessors.d.ts.map +1 -0
  169. package/dist/json/rewriteGeoArrowAccessors.js +55 -0
  170. package/dist/json/rewriteGeoArrowAccessors.js.map +1 -0
  171. package/dist/mapAiConfig.d.ts +111 -0
  172. package/dist/mapAiConfig.d.ts.map +1 -0
  173. package/dist/mapAiConfig.js +69 -0
  174. package/dist/mapAiConfig.js.map +1 -0
  175. package/dist/mapConfig.d.ts +73 -0
  176. package/dist/mapConfig.d.ts.map +1 -0
  177. package/dist/mapConfig.js +47 -0
  178. package/dist/mapConfig.js.map +1 -0
  179. package/dist/mapConfigUtils.d.ts +111 -0
  180. package/dist/mapConfigUtils.d.ts.map +1 -0
  181. package/dist/mapConfigUtils.js +502 -0
  182. package/dist/mapConfigUtils.js.map +1 -0
  183. package/dist/mapDataPolicy.d.ts +9 -0
  184. package/dist/mapDataPolicy.d.ts.map +1 -0
  185. package/dist/mapDataPolicy.js +25 -0
  186. package/dist/mapDataPolicy.js.map +1 -0
  187. package/dist/mapFit.d.ts +62 -0
  188. package/dist/mapFit.d.ts.map +1 -0
  189. package/dist/mapFit.js +325 -0
  190. package/dist/mapFit.js.map +1 -0
  191. package/dist/mapLayerConfigUtils.d.ts +54 -0
  192. package/dist/mapLayerConfigUtils.d.ts.map +1 -0
  193. package/dist/mapLayerConfigUtils.js +296 -0
  194. package/dist/mapLayerConfigUtils.js.map +1 -0
  195. package/dist/mapResourceAuthoring.d.ts +40 -0
  196. package/dist/mapResourceAuthoring.d.ts.map +1 -0
  197. package/dist/mapResourceAuthoring.js +266 -0
  198. package/dist/mapResourceAuthoring.js.map +1 -0
  199. package/dist/mosaic.d.ts +9 -0
  200. package/dist/mosaic.d.ts.map +1 -0
  201. package/dist/mosaic.js +8 -0
  202. package/dist/mosaic.js.map +1 -0
  203. package/dist/prepare/detectGeometryColumn.d.ts +19 -0
  204. package/dist/prepare/detectGeometryColumn.d.ts.map +1 -0
  205. package/dist/prepare/detectGeometryColumn.js +126 -0
  206. package/dist/prepare/detectGeometryColumn.js.map +1 -0
  207. package/dist/prepare/geoarrow.d.ts +18 -0
  208. package/dist/prepare/geoarrow.d.ts.map +1 -0
  209. package/dist/prepare/geoarrow.js +114 -0
  210. package/dist/prepare/geoarrow.js.map +1 -0
  211. package/dist/prepare/geometryDecoder.d.ts +8 -0
  212. package/dist/prepare/geometryDecoder.d.ts.map +1 -0
  213. package/dist/prepare/geometryDecoder.js +2 -0
  214. package/dist/prepare/geometryDecoder.js.map +1 -0
  215. package/dist/prepare/prepareDeckDataset.d.ts +57 -0
  216. package/dist/prepare/prepareDeckDataset.d.ts.map +1 -0
  217. package/dist/prepare/prepareDeckDataset.js +112 -0
  218. package/dist/prepare/prepareDeckDataset.js.map +1 -0
  219. package/dist/prepare/toGeoJsonBinary.d.ts +9 -0
  220. package/dist/prepare/toGeoJsonBinary.d.ts.map +1 -0
  221. package/dist/prepare/toGeoJsonBinary.js +26 -0
  222. package/dist/prepare/toGeoJsonBinary.js.map +1 -0
  223. package/dist/prepare/types.d.ts +25 -0
  224. package/dist/prepare/types.d.ts.map +1 -0
  225. package/dist/prepare/types.js +2 -0
  226. package/dist/prepare/types.js.map +1 -0
  227. package/dist/prepare/wkbDecoder.d.ts +3 -0
  228. package/dist/prepare/wkbDecoder.d.ts.map +1 -0
  229. package/dist/prepare/wkbDecoder.js +419 -0
  230. package/dist/prepare/wkbDecoder.js.map +1 -0
  231. package/dist/prepare/wkbParser.d.ts +24 -0
  232. package/dist/prepare/wkbParser.d.ts.map +1 -0
  233. package/dist/prepare/wkbParser.js +139 -0
  234. package/dist/prepare/wkbParser.js.map +1 -0
  235. package/dist/types.d.ts +92 -0
  236. package/dist/types.d.ts.map +1 -0
  237. package/dist/types.js +11 -0
  238. package/dist/types.js.map +1 -0
  239. package/dist/useDeckMapDatasetSchema.d.ts +33 -0
  240. package/dist/useDeckMapDatasetSchema.d.ts.map +1 -0
  241. package/dist/useDeckMapDatasetSchema.js +138 -0
  242. package/dist/useDeckMapDatasetSchema.js.map +1 -0
  243. package/dist/useDeckMapDatasets.d.ts +17 -0
  244. package/dist/useDeckMapDatasets.d.ts.map +1 -0
  245. package/dist/useDeckMapDatasets.js +69 -0
  246. package/dist/useDeckMapDatasets.js.map +1 -0
  247. package/dist/useDeckMapFitToBounds.d.ts +31 -0
  248. package/dist/useDeckMapFitToBounds.d.ts.map +1 -0
  249. package/dist/useDeckMapFitToBounds.js +58 -0
  250. package/dist/useDeckMapFitToBounds.js.map +1 -0
  251. package/package.json +98 -0
@@ -0,0 +1,170 @@
1
+ import { CompositeLayer } from '@deck.gl/core';
2
+ import { TripsLayer } from '@deck.gl/geo-layers';
3
+ import * as arrow from 'apache-arrow';
4
+ /**
5
+ * Expand a per-geometry array to per-coordinate by repeating values for each
6
+ * vertex in the geometry (required by deck.gl's binary attribute interface for
7
+ * per-path attributes like getColor on PathLayer/TripsLayer).
8
+ */
9
+ function expandToCoords(input, size, geomOffsets) {
10
+ const numCoords = geomOffsets[geomOffsets.length - 1];
11
+ // @ts-expect-error constructor signature
12
+ const output = new input.constructor(numCoords * size);
13
+ for (let geomIdx = 0; geomIdx < geomOffsets.length - 1; geomIdx++) {
14
+ const start = geomOffsets[geomIdx];
15
+ const end = geomOffsets[geomIdx + 1];
16
+ for (let coordIdx = start; coordIdx < end; coordIdx++) {
17
+ for (let i = 0; i < size; i++) {
18
+ output[coordIdx * size + i] = input[geomIdx * size + i];
19
+ }
20
+ }
21
+ }
22
+ return output;
23
+ }
24
+ /**
25
+ * Custom GeoArrow-compatible TripsLayer wrapper.
26
+ *
27
+ * The upstream GeoArrowTripsLayer (from @geoarrow/deck.gl-geoarrow@0.4.x)
28
+ * expects `getTimestamps: Data<List<Float>>`, which may not match raw DuckDB
29
+ * timestamp types. Additionally, deck.gl 9.3's PathLayer/TripsLayer attribute
30
+ * manager fails to initialize raw typed arrays correctly, producing
31
+ * "Float64Array Error: Float64Array".
32
+ *
33
+ * This wrapper extracts the binary data from Arrow vectors and passes it to the
34
+ * native TripsLayer in a compatible format, properly resolving accessor props
35
+ * (Arrow Vectors → binary attributes, functions → wrapped with batch context).
36
+ */
37
+ export class DeckTripsLayer extends CompositeLayer {
38
+ static layerName = 'GeoArrowTripsLayer';
39
+ static defaultProps = {
40
+ currentTime: { type: 'number', value: 0 },
41
+ trailLength: { type: 'number', value: 120 },
42
+ fadeTrail: true,
43
+ _pathType: 'open',
44
+ };
45
+ renderLayers() {
46
+ const { data: table, getPath, getTimestamps, ...otherProps } = this.props;
47
+ if (!getPath || !getTimestamps)
48
+ return null;
49
+ const layers = [];
50
+ const numChunks = getPath.data.length;
51
+ for (let chunkIdx = 0; chunkIdx < numChunks; chunkIdx++) {
52
+ const lineData = getPath.data[chunkIdx];
53
+ if (!lineData)
54
+ continue;
55
+ const geomOffsets = lineData.valueOffsets;
56
+ const vertexData = lineData.children[0];
57
+ if (!vertexData)
58
+ continue;
59
+ const nDim = vertexData.type.listSize;
60
+ const coordData = vertexData.children[0];
61
+ if (!coordData)
62
+ continue;
63
+ // Arrow chunks may share a single backing buffer with absolute offsets.
64
+ // deck.gl expects relative (zero-based) offsets for startIndices.
65
+ const baseOffset = geomOffsets[0] ?? 0;
66
+ const relativeOffsets = new Int32Array(geomOffsets.length);
67
+ for (let i = 0; i < geomOffsets.length; i++) {
68
+ relativeOffsets[i] = (geomOffsets[i] ?? 0) - baseOffset;
69
+ }
70
+ const numVertices = relativeOffsets[relativeOffsets.length - 1] ?? 0;
71
+ // Slice the coordinate buffer to only this chunk's vertices
72
+ const rawValues = coordData.values;
73
+ const coordStart = baseOffset * nDim;
74
+ const coordEnd = coordStart + numVertices * nDim;
75
+ const flatCoords = coordStart > 0 || coordEnd < rawValues.length
76
+ ? rawValues.slice(coordStart, coordEnd)
77
+ : rawValues;
78
+ const tsData = getTimestamps.data[chunkIdx];
79
+ if (!tsData)
80
+ continue;
81
+ const tsChild = tsData.children[0];
82
+ if (!tsChild)
83
+ continue;
84
+ // Slice timestamps to this chunk's range (same shared-buffer issue)
85
+ const tsBaseOffset = tsData.valueOffsets[0] ?? 0;
86
+ const tsRawValues = tsChild.values;
87
+ const tsStart = tsBaseOffset;
88
+ const tsEnd = tsStart + numVertices;
89
+ // TripsLayer's timestamps attribute does NOT have doublePrecision, so
90
+ // luma.gl's type resolver rejects Float64Array. Timestamps MUST be Float32.
91
+ let tsValues;
92
+ if (tsRawValues instanceof Float32Array) {
93
+ tsValues = tsRawValues.slice(tsStart, tsEnd);
94
+ }
95
+ else {
96
+ tsValues = new Float32Array(numVertices);
97
+ const src = tsRawValues;
98
+ if (src instanceof BigInt64Array || src instanceof BigUint64Array) {
99
+ for (let i = 0; i < numVertices; i++) {
100
+ tsValues[i] = Number(src[tsStart + i]);
101
+ }
102
+ }
103
+ else {
104
+ for (let i = 0; i < numVertices; i++) {
105
+ tsValues[i] = Number(src[tsStart + i]) || 0;
106
+ }
107
+ }
108
+ }
109
+ const { _tripsMaxTimestamp: _unused, ...restProps } = otherProps;
110
+ void _unused;
111
+ const binaryAttributes = {
112
+ getPath: { value: flatCoords, size: nDim },
113
+ getTimestamps: { value: tsValues, size: 1 },
114
+ };
115
+ const layerProps = {};
116
+ const batch = table.batches[chunkIdx];
117
+ for (const [propName, propValue] of Object.entries(restProps)) {
118
+ if (propValue instanceof arrow.Vector) {
119
+ // Arrow Vector accessor → resolve to binary attribute
120
+ const chunkData = propValue.data[chunkIdx];
121
+ if (!chunkData)
122
+ continue;
123
+ if (arrow.DataType.isFixedSizeList(chunkData.type)) {
124
+ const childValues = chunkData.children[0]?.values;
125
+ if (!childValues)
126
+ continue;
127
+ const values = expandToCoords(childValues, chunkData.type.listSize, relativeOffsets);
128
+ binaryAttributes[propName] = {
129
+ value: values,
130
+ size: chunkData.type.listSize,
131
+ normalized: true,
132
+ };
133
+ }
134
+ else if (arrow.DataType.isFloat(chunkData.type)) {
135
+ const values = expandToCoords(chunkData.values, 1, relativeOffsets);
136
+ binaryAttributes[propName] = { value: values, size: 1 };
137
+ }
138
+ }
139
+ else if (typeof propValue === 'function') {
140
+ // Function accessor → wrap to provide batch context
141
+ const fn = propValue;
142
+ layerProps[propName] = (_object, objectInfo) => {
143
+ return fn({
144
+ index: objectInfo.index,
145
+ data: { data: batch },
146
+ target: objectInfo.target,
147
+ });
148
+ };
149
+ }
150
+ else {
151
+ layerProps[propName] = propValue;
152
+ }
153
+ }
154
+ const props = {
155
+ ...layerProps,
156
+ _pathType: 'open',
157
+ id: `${this.props.id}-geoarrow-trip-${chunkIdx}`,
158
+ data: {
159
+ data: batch,
160
+ length: lineData.length,
161
+ startIndices: relativeOffsets,
162
+ attributes: binaryAttributes,
163
+ },
164
+ };
165
+ layers.push(new TripsLayer(props));
166
+ }
167
+ return layers;
168
+ }
169
+ }
170
+ //# sourceMappingURL=DeckTripsLayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeckTripsLayer.js","sourceRoot":"","sources":["../../../src/json/layers/DeckTripsLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAA8B,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAatC;;;;GAIG;AACH,SAAS,cAAc,CACrB,KAAQ,EACR,IAAY,EACZ,WAAuB;IAEvB,MAAM,SAAS,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC;IACvD,yCAAyC;IACzC,MAAM,MAAM,GAAM,IAAI,KAAK,CAAC,WAAW,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IAC1D,KAAK,IAAI,OAAO,GAAG,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC;QAClE,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,CAAE,CAAC;QACpC,MAAM,GAAG,GAAG,WAAW,CAAC,OAAO,GAAG,CAAC,CAAE,CAAC;QACtC,KAAK,IAAI,QAAQ,GAAG,KAAK,EAAE,QAAQ,GAAG,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC;YACtD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC9B,MAAM,CAAC,QAAQ,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,GAAG,IAAI,GAAG,CAAC,CAAE,CAAC;YAC3D,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;;;;;GAY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AAE,UAAU,CAAC,KAAK;4BACvB,IAAI,EAAE,EAAC,IAAI,EAAE,KAAK,EAAC;4BACnB,MAAM,EAAE,UAAU,CAAC,MAAM;yBAC1B,CAAC,CAAC;oBACL,CAAC,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,UAAU,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;gBACnC,CAAC;YACH,CAAC;YAED,MAAM,KAAK,GAAG;gBACZ,GAAG,UAAU;gBACb,SAAS,EAAE,MAAe;gBAC1B,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,kBAAkB,QAAQ,EAAE;gBAChD,IAAI,EAAE;oBACJ,IAAI,EAAE,KAAK;oBACX,MAAM,EAAE,QAAQ,CAAC,MAAM;oBACvB,YAAY,EAAE,eAAe;oBAC7B,UAAU,EAAE,gBAAgB;iBAC7B;aACF,CAAC;YAEF,MAAM,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,KAAY,CAAC,CAAC,CAAC;QAC5C,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC","sourcesContent":["import {CompositeLayer, type Layer, type LayersList} from '@deck.gl/core';\nimport {TripsLayer} from '@deck.gl/geo-layers';\nimport * as arrow from 'apache-arrow';\n\ntype TypedArray =\n | Uint8Array\n | Uint8ClampedArray\n | Uint16Array\n | Uint32Array\n | Int8Array\n | Int16Array\n | Int32Array\n | Float32Array\n | Float64Array;\n\n/**\n * Expand a per-geometry array to per-coordinate by repeating values for each\n * vertex in the geometry (required by deck.gl's binary attribute interface for\n * per-path attributes like getColor on PathLayer/TripsLayer).\n */\nfunction expandToCoords<T extends TypedArray>(\n input: T,\n size: number,\n geomOffsets: Int32Array,\n): T {\n const numCoords = geomOffsets[geomOffsets.length - 1]!;\n // @ts-expect-error constructor signature\n const output: T = new input.constructor(numCoords * size);\n for (let geomIdx = 0; geomIdx < geomOffsets.length - 1; geomIdx++) {\n const start = geomOffsets[geomIdx]!;\n const end = geomOffsets[geomIdx + 1]!;\n for (let coordIdx = start; coordIdx < end; coordIdx++) {\n for (let i = 0; i < size; i++) {\n output[coordIdx * size + i] = input[geomIdx * size + i]!;\n }\n }\n }\n return output;\n}\n\n/**\n * Custom GeoArrow-compatible TripsLayer wrapper.\n *\n * The upstream GeoArrowTripsLayer (from @geoarrow/deck.gl-geoarrow@0.4.x)\n * expects `getTimestamps: Data<List<Float>>`, which may not match raw DuckDB\n * timestamp types. Additionally, deck.gl 9.3's PathLayer/TripsLayer attribute\n * manager fails to initialize raw typed arrays correctly, producing\n * \"Float64Array Error: Float64Array\".\n *\n * This wrapper extracts the binary data from Arrow vectors and passes it to the\n * native TripsLayer in a compatible format, properly resolving accessor props\n * (Arrow Vectors → binary attributes, functions → wrapped with batch context).\n */\nexport class DeckTripsLayer extends CompositeLayer<{\n data: arrow.Table;\n getPath: arrow.Vector;\n getTimestamps: arrow.Vector;\n getColor?:\n | arrow.Vector\n | [number, number, number, number]\n | ((...args: any[]) => any);\n getWidth?: arrow.Vector | number | ((...args: any[]) => any);\n currentTime?: number;\n trailLength?: number;\n fadeTrail?: boolean;\n widthMinPixels?: number;\n widthMaxPixels?: number;\n opacity?: number;\n _tripsMaxTimestamp?: number;\n [key: string]: unknown;\n}> {\n static layerName = 'GeoArrowTripsLayer';\n static defaultProps = {\n currentTime: {type: 'number', value: 0},\n trailLength: {type: 'number', value: 120},\n fadeTrail: true,\n _pathType: 'open',\n };\n\n renderLayers(): Layer | LayersList | null {\n const {data: table, getPath, getTimestamps, ...otherProps} = this.props;\n\n if (!getPath || !getTimestamps) return null;\n\n const layers: TripsLayer[] = [];\n const numChunks = getPath.data.length;\n\n for (let chunkIdx = 0; chunkIdx < numChunks; chunkIdx++) {\n const lineData = getPath.data[chunkIdx];\n if (!lineData) continue;\n\n const geomOffsets = lineData.valueOffsets;\n const vertexData = lineData.children[0];\n if (!vertexData) continue;\n const nDim = (vertexData.type as arrow.FixedSizeList).listSize;\n const coordData = vertexData.children[0];\n if (!coordData) continue;\n\n // Arrow chunks may share a single backing buffer with absolute offsets.\n // deck.gl expects relative (zero-based) offsets for startIndices.\n const baseOffset = geomOffsets[0] ?? 0;\n const relativeOffsets = new Int32Array(geomOffsets.length);\n for (let i = 0; i < geomOffsets.length; i++) {\n relativeOffsets[i] = (geomOffsets[i] ?? 0) - baseOffset;\n }\n const numVertices = relativeOffsets[relativeOffsets.length - 1] ?? 0;\n\n // Slice the coordinate buffer to only this chunk's vertices\n const rawValues = coordData.values;\n const coordStart = baseOffset * nDim;\n const coordEnd = coordStart + numVertices * nDim;\n const flatCoords =\n coordStart > 0 || coordEnd < rawValues.length\n ? rawValues.slice(coordStart, coordEnd)\n : rawValues;\n\n const tsData = getTimestamps.data[chunkIdx];\n if (!tsData) continue;\n const tsChild = tsData.children[0];\n if (!tsChild) continue;\n\n // Slice timestamps to this chunk's range (same shared-buffer issue)\n const tsBaseOffset = tsData.valueOffsets[0] ?? 0;\n const tsRawValues = tsChild.values;\n const tsStart = tsBaseOffset;\n const tsEnd = tsStart + numVertices;\n\n // TripsLayer's timestamps attribute does NOT have doublePrecision, so\n // luma.gl's type resolver rejects Float64Array. Timestamps MUST be Float32.\n let tsValues: Float32Array;\n if (tsRawValues instanceof Float32Array) {\n tsValues = tsRawValues.slice(tsStart, tsEnd);\n } else {\n tsValues = new Float32Array(numVertices);\n const src = tsRawValues;\n if (src instanceof BigInt64Array || src instanceof BigUint64Array) {\n for (let i = 0; i < numVertices; i++) {\n tsValues[i] = Number(src[tsStart + i]);\n }\n } else {\n for (let i = 0; i < numVertices; i++) {\n tsValues[i] = Number(src[tsStart + i]) || 0;\n }\n }\n }\n\n const {_tripsMaxTimestamp: _unused, ...restProps} = otherProps;\n void _unused;\n\n const binaryAttributes: Record<\n string,\n {value: TypedArray; size: number; normalized?: boolean}\n > = {\n getPath: {value: flatCoords, size: nDim},\n getTimestamps: {value: tsValues, size: 1},\n };\n\n const layerProps: Record<string, unknown> = {};\n const batch = table.batches[chunkIdx];\n\n for (const [propName, propValue] of Object.entries(restProps)) {\n if (propValue instanceof arrow.Vector) {\n // Arrow Vector accessor → resolve to binary attribute\n const chunkData = propValue.data[chunkIdx];\n if (!chunkData) continue;\n\n if (arrow.DataType.isFixedSizeList(chunkData.type)) {\n const childValues = chunkData.children[0]?.values;\n if (!childValues) continue;\n const values = expandToCoords(\n childValues as TypedArray,\n chunkData.type.listSize,\n relativeOffsets,\n );\n binaryAttributes[propName] = {\n value: values,\n size: chunkData.type.listSize,\n normalized: true,\n };\n } else if (arrow.DataType.isFloat(chunkData.type)) {\n const values = expandToCoords(\n chunkData.values as TypedArray,\n 1,\n relativeOffsets,\n );\n binaryAttributes[propName] = {value: values, size: 1};\n }\n } else if (typeof propValue === 'function') {\n // Function accessor → wrap to provide batch context\n const fn = propValue;\n layerProps[propName] = (\n _object: unknown,\n objectInfo: {index: number; target?: number[]},\n ) => {\n return fn({\n index: objectInfo.index,\n data: {data: batch},\n target: objectInfo.target,\n });\n };\n } else {\n layerProps[propName] = propValue;\n }\n }\n\n const props = {\n ...layerProps,\n _pathType: 'open' as const,\n id: `${this.props.id}-geoarrow-trip-${chunkIdx}`,\n data: {\n data: batch,\n length: lineData.length,\n startIndices: relativeOffsets,\n attributes: binaryAttributes,\n },\n };\n\n layers.push(new TripsLayer(props as any));\n }\n\n return layers;\n }\n}\n"]}
@@ -0,0 +1,20 @@
1
+ import { type Layer } from '@deck.gl/core';
2
+ type GeoArrowLayerClass = new (props: Record<string, unknown>) => Layer;
3
+ /**
4
+ * Creates a wrapper layer class that adapts the 0.4.x GeoArrow layer API
5
+ * (which expects `data: RecordBatch` and geometry as `arrow.Data`) to accept
6
+ * the Table + Vector format used by our JSON pipeline.
7
+ *
8
+ * The wrapper splits a multi-batch Table into per-batch sublayers, converting
9
+ * each Vector prop into its corresponding Data chunk.
10
+ *
11
+ * @param UpstreamLayer - The GeoArrow 0.4.x layer class to wrap
12
+ * (e.g. `GeoArrowScatterplotLayer`).
13
+ * @param layerName - The `layerName` assigned to the adapter class, used by
14
+ * deck.gl for layer type identification in the JSON configuration.
15
+ * @returns A CompositeLayer subclass that can be used as a drop-in replacement
16
+ * in the deck.gl JSON pipeline.
17
+ */
18
+ export declare function createTableToRecordBatchAdapter(UpstreamLayer: GeoArrowLayerClass, layerName: string): GeoArrowLayerClass;
19
+ export {};
20
+ //# sourceMappingURL=createTableToRecordBatchAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createTableToRecordBatchAdapter.d.ts","sourceRoot":"","sources":["../../../src/json/layers/createTableToRecordBatchAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,KAAK,EAAkB,MAAM,eAAe,CAAC;AAG1E,KAAK,kBAAkB,GAAG,KAAK,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,KAAK,CAAC;AAExE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,+BAA+B,CAC7C,aAAa,EAAE,kBAAkB,EACjC,SAAS,EAAE,MAAM,GAoEY,kBAAkB,CAChD"}
@@ -0,0 +1,81 @@
1
+ import { CompositeLayer } from '@deck.gl/core';
2
+ import * as arrow from 'apache-arrow';
3
+ /**
4
+ * Creates a wrapper layer class that adapts the 0.4.x GeoArrow layer API
5
+ * (which expects `data: RecordBatch` and geometry as `arrow.Data`) to accept
6
+ * the Table + Vector format used by our JSON pipeline.
7
+ *
8
+ * The wrapper splits a multi-batch Table into per-batch sublayers, converting
9
+ * each Vector prop into its corresponding Data chunk.
10
+ *
11
+ * @param UpstreamLayer - The GeoArrow 0.4.x layer class to wrap
12
+ * (e.g. `GeoArrowScatterplotLayer`).
13
+ * @param layerName - The `layerName` assigned to the adapter class, used by
14
+ * deck.gl for layer type identification in the JSON configuration.
15
+ * @returns A CompositeLayer subclass that can be used as a drop-in replacement
16
+ * in the deck.gl JSON pipeline.
17
+ */
18
+ export function createTableToRecordBatchAdapter(UpstreamLayer, layerName) {
19
+ class Adapter extends CompositeLayer {
20
+ static layerName = layerName;
21
+ renderLayers() {
22
+ const { data, ...otherProps } = this.props;
23
+ if (!data)
24
+ return null;
25
+ // If already a RecordBatch, pass through directly
26
+ if (data instanceof arrow.RecordBatch) {
27
+ const batchProps = {
28
+ id: `${this.props.id}-0`,
29
+ data,
30
+ };
31
+ for (const [propName, propValue] of Object.entries(otherProps)) {
32
+ if (propName === 'id')
33
+ continue;
34
+ if (propValue instanceof arrow.Vector) {
35
+ const chunkData = propValue.data[0];
36
+ if (chunkData) {
37
+ batchProps[propName] = chunkData;
38
+ }
39
+ }
40
+ else {
41
+ batchProps[propName] = propValue;
42
+ }
43
+ }
44
+ return new UpstreamLayer(batchProps);
45
+ }
46
+ // Must be an arrow.Table — split into per-batch sublayers
47
+ if (!(data instanceof arrow.Table))
48
+ return null;
49
+ const table = data;
50
+ const batches = table.batches;
51
+ if (!batches.length)
52
+ return null;
53
+ const layers = [];
54
+ for (let batchIdx = 0; batchIdx < batches.length; batchIdx++) {
55
+ const batch = batches[batchIdx];
56
+ const batchProps = {
57
+ id: `${this.props.id}-${batchIdx}`,
58
+ data: batch,
59
+ };
60
+ for (const [propName, propValue] of Object.entries(otherProps)) {
61
+ if (propName === 'id')
62
+ continue;
63
+ if (propValue instanceof arrow.Vector) {
64
+ // Convert Vector chunk to Data for this batch
65
+ const chunkData = propValue.data[batchIdx];
66
+ if (chunkData) {
67
+ batchProps[propName] = chunkData;
68
+ }
69
+ }
70
+ else {
71
+ batchProps[propName] = propValue;
72
+ }
73
+ }
74
+ layers.push(new UpstreamLayer(batchProps));
75
+ }
76
+ return layers;
77
+ }
78
+ }
79
+ return Adapter;
80
+ }
81
+ //# sourceMappingURL=createTableToRecordBatchAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createTableToRecordBatchAdapter.js","sourceRoot":"","sources":["../../../src/json/layers/createTableToRecordBatchAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAA8B,MAAM,eAAe,CAAC;AAC1E,OAAO,KAAK,KAAK,MA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O,CAAC,MAAM;gBAAE,OAAO,IAAI,CAAC;YAEjC,MAAM,MAAM,GAAY,EAAE,CAAC;YAC3B,KAAK,IAAI,QAAQ,GAAG,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE,CAAC;gBAC7D,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAE,CAAC;gBACjC,MAAM,UAAU,GAA4B;oBAC1C,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,QAAQ,EAAE;oBAClC,IAAI,EAAE,KAAK;iBACZ,CAAC;gBAEF,KAAK,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;oBAC/D,IAAI,QAAQ,KAAK,IAAI;wBAAE,SAAS;oBAChC,IAAI,SAAS,YAAY,KAAK,CAAC,MAAM,EAAE,CAAC;wBACtC,8CAA8C;wBAC9C,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;wBAC3C,IAAI,SAAS,EAAE,CAAC;4BACd,UAAU,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;wBACnC,CAAC;oBACH,CAAC;yBAAM,CAAC;wBACN,UAAU,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;oBACnC,CAAC;gBACH,CAAC;gBAED,MAAM,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;YAC7C,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC;;IAGH,OAAO,OAAwC,CAAC;AAClD,CAAC","sourcesContent":["import {CompositeLayer, type Layer, type LayersList} from '@deck.gl/core';\nimport * as arrow from 'apache-arrow';\n\ntype GeoArrowLayerClass = new (props: Record<string, unknown>) => Layer;\n\n/**\n * Creates a wrapper layer class that adapts the 0.4.x GeoArrow layer API\n * (which expects `data: RecordBatch` and geometry as `arrow.Data`) to accept\n * the Table + Vector format used by our JSON pipeline.\n *\n * The wrapper splits a multi-batch Table into per-batch sublayers, converting\n * each Vector prop into its corresponding Data chunk.\n *\n * @param UpstreamLayer - The GeoArrow 0.4.x layer class to wrap\n * (e.g. `GeoArrowScatterplotLayer`).\n * @param layerName - The `layerName` assigned to the adapter class, used by\n * deck.gl for layer type identification in the JSON configuration.\n * @returns A CompositeLayer subclass that can be used as a drop-in replacement\n * in the deck.gl JSON pipeline.\n */\nexport function createTableToRecordBatchAdapter(\n UpstreamLayer: GeoArrowLayerClass,\n layerName: string,\n) {\n class Adapter extends CompositeLayer<{\n data: arrow.Table | arrow.RecordBatch;\n [key: string]: unknown;\n }> {\n static layerName = layerName;\n\n renderLayers(): Layer | LayersList | null {\n const {data, ...otherProps} = this.props;\n\n if (!data) return null;\n\n // If already a RecordBatch, pass through directly\n if (data instanceof arrow.RecordBatch) {\n const batchProps: Record<string, unknown> = {\n id: `${this.props.id}-0`,\n data,\n };\n for (const [propName, propValue] of Object.entries(otherProps)) {\n if (propName === 'id') continue;\n if (propValue instanceof arrow.Vector) {\n const chunkData = propValue.data[0];\n if (chunkData) {\n batchProps[propName] = chunkData;\n }\n } else {\n batchProps[propName] = propValue;\n }\n }\n return new UpstreamLayer(batchProps);\n }\n\n // Must be an arrow.Table — split into per-batch sublayers\n if (!(data instanceof arrow.Table)) return null;\n\n const table = data;\n const batches = table.batches;\n if (!batches.length) return null;\n\n const layers: Layer[] = [];\n for (let batchIdx = 0; batchIdx < batches.length; batchIdx++) {\n const batch = batches[batchIdx]!;\n const batchProps: Record<string, unknown> = {\n id: `${this.props.id}-${batchIdx}`,\n data: batch,\n };\n\n for (const [propName, propValue] of Object.entries(otherProps)) {\n if (propName === 'id') continue;\n if (propValue instanceof arrow.Vector) {\n // Convert Vector chunk to Data for this batch\n const chunkData = propValue.data[batchIdx];\n if (chunkData) {\n batchProps[propName] = chunkData;\n }\n } else {\n batchProps[propName] = propValue;\n }\n }\n\n layers.push(new UpstreamLayer(batchProps));\n }\n\n return layers;\n }\n }\n\n return Adapter as unknown as GeoArrowLayerClass;\n}\n"]}
@@ -0,0 +1,5 @@
1
+ export { createTableToRecordBatchAdapter } from './createTableToRecordBatchAdapter';
2
+ export { DeckColumnLayer } from './DeckColumnLayer';
3
+ export { DeckH3HexagonLayer } from './DeckH3HexagonLayer';
4
+ export { DeckTripsLayer } from './DeckTripsLayer';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/json/layers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,+BAA+B,EAAC,MAAM,mCAAmC,CAAC;AAClF,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { createTableToRecordBatchAdapter } from './createTableToRecordBatchAdapter';
2
+ export { DeckColumnLayer } from './DeckColumnLayer';
3
+ export { DeckH3HexagonLayer } from './DeckH3HexagonLayer';
4
+ export { DeckTripsLayer } from './DeckTripsLayer';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/json/layers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,+BAA+B,EAAC,MAAM,mCAAmC,CAAC;AAClF,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC","sourcesContent":["export {createTableToRecordBatchAdapter} from './createTableToRecordBatchAdapter';\nexport {DeckColumnLayer} from './DeckColumnLayer';\nexport {DeckH3HexagonLayer} from './DeckH3HexagonLayer';\nexport {DeckTripsLayer} from './DeckTripsLayer';\n"]}
@@ -0,0 +1,7 @@
1
+ import * as arrow from 'apache-arrow';
2
+ export declare function rewriteGeoArrowAccessors(options: {
3
+ props: Record<string, unknown>;
4
+ table: arrow.Table;
5
+ layerName: string;
6
+ }): Record<string, unknown>;
7
+ //# sourceMappingURL=rewriteGeoArrowAccessors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rewriteGeoArrowAccessors.d.ts","sourceRoot":"","sources":["../../src/json/rewriteGeoArrowAccessors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAyBtC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE;IAChD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,2BA4CA"}
@@ -0,0 +1,55 @@
1
+ import * as arrow from 'apache-arrow';
2
+ import { compileGeoArrowAccessor } from './compileGeoArrowAccessor';
3
+ import { getLayerCompatibility } from './layerCompatibility';
4
+ function isSimpleColumnReference(expression) {
5
+ return /^[A-Za-z_$][\w$]*$/.test(expression.trim());
6
+ }
7
+ function canUseDirectVectorAccessor(propName, vector) {
8
+ // Direct numeric vectors (for example `getRadius`) currently end up in deck's
9
+ // binary attribute path and trigger `Float64Array` initialization failures in the
10
+ // GeoArrow scatterplot wrapper. Re-test which direct vector accessors are safe
11
+ // after verifying the 0.4.x runtime contract handles them correctly.
12
+ if (!propName.endsWith('Color')) {
13
+ return false;
14
+ }
15
+ const firstChunk = vector.data[0];
16
+ if (!firstChunk || !arrow.DataType.isFixedSizeList(firstChunk.type)) {
17
+ return false;
18
+ }
19
+ return true;
20
+ }
21
+ export function rewriteGeoArrowAccessors(options) {
22
+ const { props, table, layerName } = options;
23
+ const compatibility = getLayerCompatibility(layerName);
24
+ if (!compatibility || compatibility.representation !== 'geoarrow') {
25
+ return props;
26
+ }
27
+ const nextProps = { ...props };
28
+ for (const [propName, propValue] of Object.entries(nextProps)) {
29
+ if (typeof propValue !== 'string' ||
30
+ !propValue.startsWith('@@=') ||
31
+ !propName.startsWith('get')) {
32
+ continue;
33
+ }
34
+ const expression = propValue.slice(3);
35
+ if (compatibility.vectorAccessorProps.includes(propName) &&
36
+ isSimpleColumnReference(expression)) {
37
+ const vector = table.getChild(expression.trim());
38
+ if (vector && canUseDirectVectorAccessor(propName, vector)) {
39
+ nextProps[propName] = vector;
40
+ continue;
41
+ }
42
+ if (!vector) {
43
+ // Column not found — fall through to compileGeoArrowAccessor which
44
+ // handles missing bindings gracefully (returns undefined per row).
45
+ console.warn(`Column "${expression.trim()}" not found in dataset for accessor "${propName}".`);
46
+ }
47
+ }
48
+ // This custom compiler handles GeoArrow batch-oriented callbacks. The 0.4.x
49
+ // layers call function accessors with {index, data: {data: batch}, target},
50
+ // which this compiler produces.
51
+ nextProps[propName] = compileGeoArrowAccessor(expression, table);
52
+ }
53
+ return nextProps;
54
+ }
55
+ //# sourceMappingURL=rewriteGeoArrowAccessors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rewriteGeoArrowAccessors.js","sourceRoot":"","sources":["../../src/json/rewriteGeoArrowAccessors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAAC,uBAAuB,EAAC,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAC,qBAAqB,EAAC,MAAM,sBAAsB,CAAC;AAE3D,SAAS,uBAAuB,CAAC,UAAkB;IACjD,OAAO,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,0BAA0B,CAAC,QAAgB,EAAE,MAAoB;IACxE,8EAA8E;IAC9E,kFAAkF;IAClF,+EAA+E;IAC/E,qEAAqE;IACrE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAChC,OAAO,KAAK,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AAG,MAAM,CAAC;gBAC7B,SAAS;YACX,CAAC;YACD,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,mEAAmE;gBACnE,mEAAmE;gBACnE,OAAO,CAAC,IAAI,CACV,WAAW,UAAU,CAAC,IAAI,EAAE,wCAAwC,QAAQ,IAAI,CACjF,CAAC;YACJ,CAAC;QACH,CAAC;QAED,4EAA4E;QAC5E,4EAA4E;QAC5E,gCAAgC;QAChC,SAAS,CAAC,QAAQ,CAAC,GAAG,uBAAuB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACnE,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import * as arrow from 'apache-arrow';\nimport {compileGeoArrowAccessor} from './compileGeoArrowAccessor';\nimport {getLayerCompatibility} from './layerCompatibility';\n\nfunction isSimpleColumnReference(expression: string) {\n return /^[A-Za-z_$][\\w$]*$/.test(expression.trim());\n}\n\nfunction canUseDirectVectorAccessor(propName: string, vector: arrow.Vector) {\n // Direct numeric vectors (for example `getRadius`) currently end up in deck's\n // binary attribute path and trigger `Float64Array` initialization failures in the\n // GeoArrow scatterplot wrapper. Re-test which direct vector accessors are safe\n // after verifying the 0.4.x runtime contract handles them correctly.\n if (!propName.endsWith('Color')) {\n return false;\n }\n\n const firstChunk = vector.data[0];\n if (!firstChunk || !arrow.DataType.isFixedSizeList(firstChunk.type)) {\n return false;\n }\n\n return true;\n}\n\nexport function rewriteGeoArrowAccessors(options: {\n props: Record<string, unknown>;\n table: arrow.Table;\n layerName: string;\n}) {\n const {props, table, layerName} = options;\n const compatibility = getLayerCompatibility(layerName);\n if (!compatibility || compatibility.representation !== 'geoarrow') {\n return props;\n }\n\n const nextProps = {...props};\n\n for (const [propName, propValue] of Object.entries(nextProps)) {\n if (\n typeof propValue !== 'string' ||\n !propValue.startsWith('@@=') ||\n !propName.startsWith('get')\n ) {\n continue;\n }\n\n const expression = propValue.slice(3);\n if (\n compatibility.vectorAccessorProps.includes(propName) &&\n isSimpleColumnReference(expression)\n ) {\n const vector = table.getChild(expression.trim());\n if (vector && canUseDirectVectorAccessor(propName, vector)) {\n nextProps[propName] = vector;\n continue;\n }\n if (!vector) {\n // Column not found — fall through to compileGeoArrowAccessor which\n // handles missing bindings gracefully (returns undefined per row).\n console.warn(\n `Column \"${expression.trim()}\" not found in dataset for accessor \"${propName}\".`,\n );\n }\n }\n\n // This custom compiler handles GeoArrow batch-oriented callbacks. The 0.4.x\n // layers call function accessors with {index, data: {data: batch}, target},\n // which this compiler produces.\n nextProps[propName] = compileGeoArrowAccessor(expression, table);\n }\n\n return nextProps;\n}\n"]}
@@ -0,0 +1,111 @@
1
+ import { z } from 'zod';
2
+ /** Validates the portable Deck map config accepted from commands and AI tools. */
3
+ export declare const DeckMapResourceConfigParameter: z.ZodObject<{
4
+ spec: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
5
+ datasets: z.ZodRecord<z.ZodString, z.ZodObject<{
6
+ source: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
7
+ sqlQuery: z.ZodString;
8
+ }, z.core.$loose>, z.ZodObject<{
9
+ tableName: z.ZodString;
10
+ transformSql: z.ZodOptional<z.ZodString>;
11
+ }, z.core.$loose>]>>;
12
+ geometryColumn: z.ZodOptional<z.ZodString>;
13
+ geometryEncodingHint: z.ZodOptional<z.ZodEnum<{
14
+ geoarrow: "geoarrow";
15
+ wkb: "wkb";
16
+ wkt: "wkt";
17
+ }>>;
18
+ }, z.core.$loose>>;
19
+ configMode: z.ZodOptional<z.ZodEnum<{
20
+ custom: "custom";
21
+ basic: "basic";
22
+ }>>;
23
+ mapStyle: z.ZodOptional<z.ZodString>;
24
+ mapProps: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
25
+ showLegends: z.ZodOptional<z.ZodBoolean>;
26
+ interaction: z.ZodOptional<z.ZodObject<{
27
+ type: z.ZodLiteral<"point-radius-brush">;
28
+ dataset: z.ZodString;
29
+ longitudeColumn: z.ZodString;
30
+ latitudeColumn: z.ZodString;
31
+ radiusMeters: z.ZodOptional<z.ZodNumber>;
32
+ event: z.ZodOptional<z.ZodEnum<{
33
+ hover: "hover";
34
+ click: "click";
35
+ }>>;
36
+ }, z.core.$loose>>;
37
+ fitToData: z.ZodOptional<z.ZodObject<{
38
+ dataset: z.ZodString;
39
+ longitudeColumn: z.ZodOptional<z.ZodString>;
40
+ latitudeColumn: z.ZodOptional<z.ZodString>;
41
+ geometryColumn: z.ZodOptional<z.ZodString>;
42
+ h3Column: z.ZodOptional<z.ZodString>;
43
+ padding: z.ZodOptional<z.ZodNumber>;
44
+ maxZoom: z.ZodOptional<z.ZodNumber>;
45
+ }, z.core.$loose>>;
46
+ dataPolicy: z.ZodOptional<z.ZodObject<{
47
+ disabled: z.ZodOptional<z.ZodBoolean>;
48
+ maxRows: z.ZodOptional<z.ZodNumber>;
49
+ reason: z.ZodOptional<z.ZodString>;
50
+ }, z.core.$loose>>;
51
+ settingsOpen: z.ZodOptional<z.ZodBoolean>;
52
+ }, z.core.$loose>;
53
+ /** Validates inputs for an AI or command invocation that writes a map resource. */
54
+ export declare const DeckMapResourceToolParameters: z.ZodObject<{
55
+ title: z.ZodDefault<z.ZodOptional<z.ZodString>>;
56
+ config: z.ZodObject<{
57
+ spec: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
58
+ datasets: z.ZodRecord<z.ZodString, z.ZodObject<{
59
+ source: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
60
+ sqlQuery: z.ZodString;
61
+ }, z.core.$loose>, z.ZodObject<{
62
+ tableName: z.ZodString;
63
+ transformSql: z.ZodOptional<z.ZodString>;
64
+ }, z.core.$loose>]>>;
65
+ geometryColumn: z.ZodOptional<z.ZodString>;
66
+ geometryEncodingHint: z.ZodOptional<z.ZodEnum<{
67
+ geoarrow: "geoarrow";
68
+ wkb: "wkb";
69
+ wkt: "wkt";
70
+ }>>;
71
+ }, z.core.$loose>>;
72
+ configMode: z.ZodOptional<z.ZodEnum<{
73
+ custom: "custom";
74
+ basic: "basic";
75
+ }>>;
76
+ mapStyle: z.ZodOptional<z.ZodString>;
77
+ mapProps: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
78
+ showLegends: z.ZodOptional<z.ZodBoolean>;
79
+ interaction: z.ZodOptional<z.ZodObject<{
80
+ type: z.ZodLiteral<"point-radius-brush">;
81
+ dataset: z.ZodString;
82
+ longitudeColumn: z.ZodString;
83
+ latitudeColumn: z.ZodString;
84
+ radiusMeters: z.ZodOptional<z.ZodNumber>;
85
+ event: z.ZodOptional<z.ZodEnum<{
86
+ hover: "hover";
87
+ click: "click";
88
+ }>>;
89
+ }, z.core.$loose>>;
90
+ fitToData: z.ZodOptional<z.ZodObject<{
91
+ dataset: z.ZodString;
92
+ longitudeColumn: z.ZodOptional<z.ZodString>;
93
+ latitudeColumn: z.ZodOptional<z.ZodString>;
94
+ geometryColumn: z.ZodOptional<z.ZodString>;
95
+ h3Column: z.ZodOptional<z.ZodString>;
96
+ padding: z.ZodOptional<z.ZodNumber>;
97
+ maxZoom: z.ZodOptional<z.ZodNumber>;
98
+ }, z.core.$loose>>;
99
+ dataPolicy: z.ZodOptional<z.ZodObject<{
100
+ disabled: z.ZodOptional<z.ZodBoolean>;
101
+ maxRows: z.ZodOptional<z.ZodNumber>;
102
+ reason: z.ZodOptional<z.ZodString>;
103
+ }, z.core.$loose>>;
104
+ settingsOpen: z.ZodOptional<z.ZodBoolean>;
105
+ }, z.core.$loose>;
106
+ tableName: z.ZodOptional<z.ZodString>;
107
+ replaceLayers: z.ZodOptional<z.ZodBoolean>;
108
+ replaceDatasets: z.ZodOptional<z.ZodBoolean>;
109
+ reasoning: z.ZodString;
110
+ }, z.core.$strip>;
111
+ //# sourceMappingURL=mapAiConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapAiConfig.d.ts","sourceRoot":"","sources":["../src/mapAiConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAuCtB,kFAAkF;AAClF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqBN,CAAC;AAEtC,mFAAmF;AACnF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiBxC,CAAC"}
@@ -0,0 +1,69 @@
1
+ import { z } from 'zod';
2
+ const DeckMapDatasetSource = z.union([
3
+ z.looseObject({
4
+ sqlQuery: z.string(),
5
+ }),
6
+ z.looseObject({
7
+ tableName: z.string(),
8
+ transformSql: z.string().optional(),
9
+ }),
10
+ ]);
11
+ const DeckMapDatasetConfig = z.looseObject({
12
+ source: DeckMapDatasetSource.optional().describe('Dataset source. Required for new maps; may be omitted only by a sparse update patch that retains an existing source.'),
13
+ geometryColumn: z.string().optional(),
14
+ geometryEncodingHint: z.enum(['geoarrow', 'wkb', 'wkt']).optional(),
15
+ });
16
+ const DeckMapInteractionConfig = z.looseObject({
17
+ type: z.literal('point-radius-brush'),
18
+ dataset: z.string(),
19
+ longitudeColumn: z.string(),
20
+ latitudeColumn: z.string(),
21
+ radiusMeters: z.number().optional(),
22
+ event: z.enum(['hover', 'click']).optional(),
23
+ });
24
+ const DeckMapFitToDataConfig = z.looseObject({
25
+ dataset: z.string(),
26
+ longitudeColumn: z.string().optional(),
27
+ latitudeColumn: z.string().optional(),
28
+ geometryColumn: z.string().optional(),
29
+ h3Column: z.string().optional(),
30
+ padding: z.number().optional(),
31
+ maxZoom: z.number().optional(),
32
+ });
33
+ /** Validates the portable Deck map config accepted from commands and AI tools. */
34
+ export const DeckMapResourceConfigParameter = z.looseObject({
35
+ spec: z.union([z.string(), z.record(z.string(), z.unknown())]),
36
+ datasets: z
37
+ .record(z.string(), DeckMapDatasetConfig)
38
+ .describe('Resource datasets keyed by id. Every dataset in a new map must define source.tableName or source.sqlQuery.'),
39
+ configMode: z.enum(['basic', 'custom']).optional(),
40
+ mapStyle: z.string().optional(),
41
+ mapProps: z.record(z.string(), z.unknown()).optional(),
42
+ showLegends: z.boolean().optional(),
43
+ interaction: DeckMapInteractionConfig.optional(),
44
+ fitToData: DeckMapFitToDataConfig.optional(),
45
+ dataPolicy: z
46
+ .looseObject({
47
+ disabled: z.boolean().optional(),
48
+ maxRows: z.number().int().min(1).optional(),
49
+ reason: z.string().optional(),
50
+ })
51
+ .optional(),
52
+ settingsOpen: z.boolean().optional(),
53
+ });
54
+ /** Validates inputs for an AI or command invocation that writes a map resource. */
55
+ export const DeckMapResourceToolParameters = z.object({
56
+ title: z.string().optional().default('Map'),
57
+ config: DeckMapResourceConfigParameter,
58
+ tableName: z.string().optional(),
59
+ replaceLayers: z
60
+ .boolean()
61
+ .optional()
62
+ .describe('Set true when config.spec.layers is the complete desired list and omitted existing layers should be removed.'),
63
+ replaceDatasets: z
64
+ .boolean()
65
+ .optional()
66
+ .describe('Set true when config.datasets is the complete desired registry and omitted existing datasets should be removed.'),
67
+ reasoning: z.string(),
68
+ });
69
+ //# sourceMappingURL=mapAiConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapAiConfig.js","sourceRoot":"","sources":["../src/mapAiConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC;IACnC,CAAC,CAAC,WAAW,CAAC;QACZ,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;KACrB,CAAC;IACF,CAAC,CAAC,WAAW,CAAC;QACZ,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KACpC,CAAC;CACH,CAAC,CAAC;AACH,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAAC;IACz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C,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAC3C,MAAM,EAAE,8BAA8B;IACtC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,aAAa,EAAE,CAAC;SACb,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,QAAQ,CACP,8GAA8G,CAC/G;IACH,eAAe,EAAE,CAAC;SACf,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,QAAQ,CACP,iHAAiH,CAClH;IACH,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC","sourcesContent":["import {z} from 'zod';\nimport type {DeckMapConfig} from './mapConfig';\n\nconst DeckMapDatasetSource = z.union([\n z.looseObject({\n sqlQuery: z.string(),\n }),\n z.looseObject({\n tableName: z.string(),\n transformSql: z.string().optional(),\n }),\n]);\nconst DeckMapDatasetConfig = z.looseObject({\n source: DeckMapDatasetSource.optional().describe(\n 'Dataset source. Required for new maps; may be omitted only by a sparse update patch that retains an existing source.',\n ),\n geometryColumn: z.string().optional(),\n geometryEncodingHint: z.enum(['geoarrow', 'wkb', 'wkt']).optional(),\n});\n\nconst DeckMapInteractionConfig = z.looseObject({\n type: z.literal('point-radius-brush'),\n dataset: z.string(),\n longitudeColumn: z.string(),\n latitudeColumn: z.string(),\n radiusMeters: z.number().optional(),\n event: z.enum(['hover', 'click']).optional(),\n});\n\nconst DeckMapFitToDataConfig = z.looseObject({\n dataset: z.string(),\n longitudeColumn: z.string().optional(),\n latitudeColumn: z.string().optional(),\n geometryColumn: z.string().optional(),\n h3Column: z.string().optional(),\n padding: z.number().optional(),\n maxZoom: z.number().optional(),\n});\n\n/** Validates the portable Deck map config accepted from commands and AI tools. */\nexport const DeckMapResourceConfigParameter = z.looseObject({\n spec: z.union([z.string(), z.record(z.string(), z.unknown())]),\n datasets: z\n .record(z.string(), DeckMapDatasetConfig)\n .describe(\n 'Resource datasets keyed by id. Every dataset in a new map must define source.tableName or source.sqlQuery.',\n ),\n configMode: z.enum(['basic', 'custom']).optional(),\n mapStyle: z.string().optional(),\n mapProps: z.record(z.string(), z.unknown()).optional(),\n showLegends: z.boolean().optional(),\n interaction: DeckMapInteractionConfig.optional(),\n fitToData: DeckMapFitToDataConfig.optional(),\n dataPolicy: z\n .looseObject({\n disabled: z.boolean().optional(),\n maxRows: z.number().int().min(1).optional(),\n reason: z.string().optional(),\n })\n .optional(),\n settingsOpen: z.boolean().optional(),\n}) satisfies z.ZodType<DeckMapConfig>;\n\n/** Validates inputs for an AI or command invocation that writes a map resource. */\nexport const DeckMapResourceToolParameters = z.object({\n title: z.string().optional().default('Map'),\n config: DeckMapResourceConfigParameter,\n tableName: z.string().optional(),\n replaceLayers: z\n .boolean()\n .optional()\n .describe(\n 'Set true when config.spec.layers is the complete desired list and omitted existing layers should be removed.',\n ),\n replaceDatasets: z\n .boolean()\n .optional()\n .describe(\n 'Set true when config.datasets is the complete desired registry and omitted existing datasets should be removed.',\n ),\n reasoning: z.string(),\n});\n"]}