@feltmaps/js-sdk 1.6.0 → 1.7.0-next.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/dist/client.cjs +1 -1
- package/dist/client.d.cts +2 -2
- package/dist/client.d.ts +2 -2
- package/dist/client.js +1 -1
- package/dist/{controller-C5gGWnaM.d.cts → controller-CmThLnnL.d.cts} +196 -4
- package/dist/{controller-C5gGWnaM.d.ts → controller-CmThLnnL.d.ts} +196 -4
- package/dist/handler.cjs +1 -1
- package/dist/handler.d.cts +120 -7
- package/dist/handler.d.ts +120 -7
- package/dist/handler.js +1 -1
- package/package.json +2 -1
package/dist/client.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var u=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var x=(e,o)=>{for(var n in o)u(e,n,{get:o[n],enumerable:!0})},f=(e,o,n,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of S(o))!I.call(e,s)&&s!==n&&u(e,s,{get:()=>o[s],enumerable:!(a=b(o,s))||a.enumerable});return e};var k=e=>f(u({},"__esModule",{value:!0}),e);var A={};x(A,{Felt:()=>M});module.exports=k(A);function r(e,o){return n=>{let a=new MessageChannel,s=n.handler,i="options"in n?n.options:void 0,m=crypto.randomUUID();return e.postMessage({type:"felt.addListener",event:i?{eventName:o,id:m,options:i}:{eventName:o,id:m}},"*",[a.port2]),a.port1.onmessage=g=>{c(g)||s(g.data)},()=>{a.port1.onmessage=null,a.port1.close(),a.port2.close(),e.postMessage({type:"felt.removeListener",id:m},"*")}}}function t(e,o,n){return async a=>{let s=new MessageChannel,i=a&&n?await n(a):a;return e.postMessage({type:o,params:i},"*",[s.port2]),new Promise((m,g)=>{s.port1.onmessage=y=>{c(y)?g(new Error(y.data.__error__)):m(y.data),s.port1.close(),s.port2.close()}})}}function c(e){return e.data&&typeof e.data=="object"&&"__error__"in e.data}var C=e=>({getElement:t(e,"getElement"),getElementGeometry:t(e,"getElementGeometry"),getElements:t(e,"getElements"),setElementGroupVisibility:t(e,"setElementGroupVisibility"),getElementGroup:t(e,"getElementGroup"),getElementGroups:t(e,"getElementGroups"),onElementChange:r(e,"onElementChange"),onElementCreate:r(e,"onElementCreate"),onElementCreateEnd:r(e,"onElementCreateEnd"),onElementDelete:r(e,"onElementDelete"),onElementGroupChange:r(e,"onElementGroupChange"),createElement:t(e,"createElement"),updateElement:t(e,"updateElement"),deleteElement:t(e,"deleteElement")});var L=e=>({onPointerClick:r(e,"onPointerClick"),onPointerMove:r(e,"onPointerMove")});var P=e=>({getLayer:t(e,"getLayer"),getLayers:t(e,"getLayers"),setLayerVisibility:t(e,"setLayerVisibility"),setLayerStyle:t(e,"setLayerStyle"),setLayerLegendVisibility:t(e,"setLayerLegendVisibility"),onLayerChange:r(e,"onLayerChange"),createLayersFromGeoJson:t(e,"createLayersFromGeoJson",h),updateLayer:t(e,"updateLayer",h),deleteLayer:t(e,"deleteLayer"),getLayerGroup:t(e,"getLayerGroup"),getLayerGroups:t(e,"getLayerGroups"),setLayerGroupVisibility:t(e,"setLayerGroupVisibility"),setLayerGroupLegendVisibility:t(e,"setLayerGroupLegendVisibility"),onLayerGroupChange:r(e,"onLayerGroupChange"),getLegendItem:t(e,"getLegendItem"),getLegendItems:t(e,"getLegendItems"),setLegendItemVisibility:t(e,"setLegendItemVisibility"),onLegendItemChange:r(e,"onLegendItemChange"),getLayerFilters:t(e,"getLayerFilters"),setLayerFilters:t(e,"setLayerFilters"),onLayerFiltersChange:r(e,"onLayerFiltersChange"),getLayerBoundaries:t(e,"getLayerBoundaries"),setLayerBoundary:t(e,"setLayerBoundary"),onLayerBoundariesChange:r(e,"onLayerBoundariesChange"),getRenderedFeatures:t(e,"getRenderedFeatures"),getFeature:t(e,"getFeature"),getFeatures:t(e,"getFeatures"),getGeoJsonFeature:t(e,"getGeoJsonFeature"),getCategoryData:t(e,"getCategoryData"),getHistogramData:t(e,"getHistogramData"),getAggregates:t(e,"getAggregates"),getPrecomputedAggregates:t(e,"getPrecomputedAggregates"),getLayerSchema:t(e,"getLayerSchema")});async function h(e){let{source:o}=e;return o&&o.type==="geoJsonFile"?{...e,source:{type:"geoJsonData",data:JSON.parse(await o.file.text())}}:e}var T=e=>({getMapDetails:t(e,"getMapDetails")});var E=e=>({onSelectionChange:r(e,"onSelectionChange"),getSelection:t(e,"getSelection"),selectFeature:t(e,"selectFeature"),clearSelection:t(e,"clearSelection")});var v=e=>({setTool:t(e,"setTool"),getTool:t(e,"getTool"),onToolChange:r(e,"onToolChange"),setToolSettings:t(e,"setToolSettings"),getToolSettings:t(e,"getToolSettings"),onToolSettingsChange:r(e,"onToolSettingsChange")});var F=e=>({updateUiControls:t(e,"updateUiControls"),setOnMapInteractionsUi:t(e,"setOnMapInteractionsUi"),showLayerDataTable:t(e,"showLayerDataTable"),hideLayerDataTable:t(e,"hideLayerDataTable")});var G=e=>({getViewport:t(e,"getViewport"),setViewport:t(e,"setViewport"),getViewportConstraints:t(e,"getViewportConstraints"),setViewportConstraints:t(e,"setViewportConstraints"),fitViewportToBounds:t(e,"fitViewportToBounds"),onViewportMove:r(e,"onViewportMove"),onViewportMoveEnd:r(e,"onViewportMoveEnd"),onMapIdle:r(e,"onMapIdle")});function V(e){return{iframe:null,...G(e),...F(e),...P(e),...C(e),...E(e),...L(e),...v(e),...T(e)}}var M={embed(e,o,n){let a={uiControls:{showLegend:!0,cooperativeGestures:!0,fullScreenButton:!0,geolocation:!1,zoomControls:!0,scaleBar:!0},initialViewport:void 0,origin:"https://felt.com"},s=n?.origin??a.origin,i=new URL(`${s}/embed/map/${o}`),m={showLegend:"legend",cooperativeGestures:"cooperativeGestures",fullScreenButton:"link",geolocation:"geolocation",zoomControls:"zoomControls",scaleBar:"scaleBar"},g={...a.uiControls,...n?.uiControls};for(let[p,d]of K(g))d!=null&&i.searchParams.set(m[p],d?"1":"0");if(n?.token&&i.searchParams.set("token",n.token),n?.initialViewport){let p=n.initialViewport;i.searchParams.set("loc",`${p.center.latitude},${p.center.longitude},${p.zoom}z`)}let y=e.tagName==="IFRAME",l=y?e:e.ownerDocument.createElement("iframe");return l.src=i.toString(),y||(l.style.width="100%",l.style.height="100%",l.style.border="none",l.style.margin="0",e.appendChild(l)),l.referrerPolicy="strict-origin-when-cross-origin",new Promise((p,d)=>{l.addEventListener("load",()=>{l.contentWindow==null?d(new Error("Failed to load Felt map")):p(l.contentWindow)},{once:!0})}).then(M.connect).then(p=>(Object.defineProperties(p,{iframe:{value:l,writable:!1,configurable:!1}}),p))},connect(e){let o=V(e);return new Promise((n,a)=>{let s=setTimeout(()=>{a(new Error("Failed to load Felt map")),clearInterval(m)},5e3),i=new MessageChannel,m=setInterval(()=>{e.postMessage({type:"felt.ready"},"*",[i.port2])},100);i.port1.onmessage=g=>{g.data===!0&&(clearInterval(m),clearTimeout(s),i.port1.close(),i.port2.close(),n(o))}})}},K=Object.entries;0&&(module.exports={Felt});
|
package/dist/client.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { z as zInfer, U as UiControlsOptions, V as ViewportCenterZoom, F as FeltController } from './controller-
|
|
2
|
-
export { au as AggregationConfig, av as AggregationMethod, C as CircleElementCreate, a as CircleElementRead, b as CircleElementUpdate,
|
|
1
|
+
import { z as zInfer, U as UiControlsOptions, V as ViewportCenterZoom, F as FeltController } from './controller-CmThLnnL.cjs';
|
|
2
|
+
export { au as AggregationConfig, av as AggregationMethod, C as CircleElementCreate, a as CircleElementRead, b as CircleElementUpdate, b6 as CircleToolSettings, b7 as ConfigurableToolType, K as CreateLayersFromGeoJsonParams, O as DataOnlyLayer, E as Element, c as ElementChangeCallbackParams, d as ElementCreate, e as ElementGroup, f as ElementGroupChangeCallbackParams, aK as ElementGroupNode, aL as ElementNode, g as ElementUpdate, B as ElementsController, aM as EntityNode, aN as FeatureNode, aO as FeatureSelection, aS as FeltBoundary, Q as FeltTiledVectorSource, aT as FeltZoom, an as FilterExpression, ao as FilterLogicGate, ap as FilterTernary, aq as Filters, R as GeoJsonDataVectorSource, aU as GeoJsonFeature, S as GeoJsonFileVectorSource, aV as GeoJsonGeometry, aW as GeoJsonProperties, W as GeoJsonUrlVectorSource, ar as GeometryFilter, G as GetElementGroupsConstraint, h as GetElementsConstraint, aw as GetLayerCalculationParams, ax as GetLayerCategoriesGroup, ay as GetLayerCategoriesParams, X as GetLayerGroupsConstraint, az as GetLayerHistogramBin, aA as GetLayerHistogramParams, aB as GetLayerPrecomputedCalculationParams, Y as GetLayersConstraint, Z as GetRenderedFeaturesConstraint, aC as GridConfig, aD as GridType, H as HighlighterElementCreate, i as HighlighterElementRead, j as HighlighterElementUpdate, b8 as HighlighterToolSettings, I as ImageElementCreate, k as ImageElementRead, l as ImageElementUpdate, b9 as InputToolSettings, J as InteractionsController, aX as LatLng, _ as Layer, as as LayerBoundaries, $ as LayerChangeCallbackParams, a0 as LayerCommon, ad as LayerFeature, at as LayerFilters, a1 as LayerGroup, a2 as LayerGroupChangeCallbackParams, aP as LayerGroupNode, aQ as LayerNode, a3 as LayerProcessingStatus, af as LayerSchema, ag as LayerSchemaAttribute, ah as LayerSchemaBooleanAttribute, ai as LayerSchemaCommonAttribute, aj as LayerSchemaDateAttribute, ak as LayerSchemaDateTimeAttribute, al as LayerSchemaNumericAttribute, am as LayerSchemaTextAttribute, aH as LayersController, a4 as LegendItem, a5 as LegendItemChangeCallbackParams, a6 as LegendItemIdentifier, a7 as LegendItemsConstraint, aY as LineStringGeometry, ba as LineToolSettings, L as LinkElementRead, aZ as LngLatTuple, aI as MapDetails, D as MapInteractionEvent, M as MarkerElementCreate, m as MarkerElementRead, n as MarkerElementUpdate, bb as MarkerToolSettings, aJ as MiscController, aE as MultiAggregationConfig, a_ as MultiLineStringGeometry, a$ as MultiPointGeometry, b0 as MultiPolygonGeometry, N as NoteElementCreate, o as NoteElementRead, p as NoteElementUpdate, bc as NoteToolSettings, bn as OnMapInteractionsOptions, P as PathElementCreate, q as PathElementRead, r as PathElementUpdate, bd as PinToolSettings, s as PlaceElementCreate, t as PlaceElementRead, u as PlaceElementUpdate, be as PlaceFrame, bf as PlaceSymbol, b1 as PointGeometry, v as PolygonElementCreate, w as PolygonElementRead, x as PolygonElementUpdate, b2 as PolygonGeometry, bg as PolygonToolSettings, aF as PrecomputedAggregationMethod, a8 as RasterBand, a9 as RasterLayer, aa as RasterLayerSource, ae as RasterValue, bh as RouteToolSettings, aR as SelectionController, bp as SetViewportCenterZoomParams, b3 as SetVisibilityRequest, b4 as SortConfig, b5 as SortDirection, T as TextElementCreate, y as TextElementRead, A as TextElementUpdate, bi as TextToolSettings, bj as ToolSettingsChangeEvent, bk as ToolSettingsMap, bl as ToolType, bm as ToolsController, bo as UiController, ab as UpdateLayerParams, aG as ValueConfiguration, ac as VectorLayer, bq as ViewportConstraints, bt as ViewportController, br as ViewportFitBoundsParams, bs as ViewportState } from './controller-CmThLnnL.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { z as zInfer, U as UiControlsOptions, V as ViewportCenterZoom, F as FeltController } from './controller-
|
|
2
|
-
export { au as AggregationConfig, av as AggregationMethod, C as CircleElementCreate, a as CircleElementRead, b as CircleElementUpdate,
|
|
1
|
+
import { z as zInfer, U as UiControlsOptions, V as ViewportCenterZoom, F as FeltController } from './controller-CmThLnnL.js';
|
|
2
|
+
export { au as AggregationConfig, av as AggregationMethod, C as CircleElementCreate, a as CircleElementRead, b as CircleElementUpdate, b6 as CircleToolSettings, b7 as ConfigurableToolType, K as CreateLayersFromGeoJsonParams, O as DataOnlyLayer, E as Element, c as ElementChangeCallbackParams, d as ElementCreate, e as ElementGroup, f as ElementGroupChangeCallbackParams, aK as ElementGroupNode, aL as ElementNode, g as ElementUpdate, B as ElementsController, aM as EntityNode, aN as FeatureNode, aO as FeatureSelection, aS as FeltBoundary, Q as FeltTiledVectorSource, aT as FeltZoom, an as FilterExpression, ao as FilterLogicGate, ap as FilterTernary, aq as Filters, R as GeoJsonDataVectorSource, aU as GeoJsonFeature, S as GeoJsonFileVectorSource, aV as GeoJsonGeometry, aW as GeoJsonProperties, W as GeoJsonUrlVectorSource, ar as GeometryFilter, G as GetElementGroupsConstraint, h as GetElementsConstraint, aw as GetLayerCalculationParams, ax as GetLayerCategoriesGroup, ay as GetLayerCategoriesParams, X as GetLayerGroupsConstraint, az as GetLayerHistogramBin, aA as GetLayerHistogramParams, aB as GetLayerPrecomputedCalculationParams, Y as GetLayersConstraint, Z as GetRenderedFeaturesConstraint, aC as GridConfig, aD as GridType, H as HighlighterElementCreate, i as HighlighterElementRead, j as HighlighterElementUpdate, b8 as HighlighterToolSettings, I as ImageElementCreate, k as ImageElementRead, l as ImageElementUpdate, b9 as InputToolSettings, J as InteractionsController, aX as LatLng, _ as Layer, as as LayerBoundaries, $ as LayerChangeCallbackParams, a0 as LayerCommon, ad as LayerFeature, at as LayerFilters, a1 as LayerGroup, a2 as LayerGroupChangeCallbackParams, aP as LayerGroupNode, aQ as LayerNode, a3 as LayerProcessingStatus, af as LayerSchema, ag as LayerSchemaAttribute, ah as LayerSchemaBooleanAttribute, ai as LayerSchemaCommonAttribute, aj as LayerSchemaDateAttribute, ak as LayerSchemaDateTimeAttribute, al as LayerSchemaNumericAttribute, am as LayerSchemaTextAttribute, aH as LayersController, a4 as LegendItem, a5 as LegendItemChangeCallbackParams, a6 as LegendItemIdentifier, a7 as LegendItemsConstraint, aY as LineStringGeometry, ba as LineToolSettings, L as LinkElementRead, aZ as LngLatTuple, aI as MapDetails, D as MapInteractionEvent, M as MarkerElementCreate, m as MarkerElementRead, n as MarkerElementUpdate, bb as MarkerToolSettings, aJ as MiscController, aE as MultiAggregationConfig, a_ as MultiLineStringGeometry, a$ as MultiPointGeometry, b0 as MultiPolygonGeometry, N as NoteElementCreate, o as NoteElementRead, p as NoteElementUpdate, bc as NoteToolSettings, bn as OnMapInteractionsOptions, P as PathElementCreate, q as PathElementRead, r as PathElementUpdate, bd as PinToolSettings, s as PlaceElementCreate, t as PlaceElementRead, u as PlaceElementUpdate, be as PlaceFrame, bf as PlaceSymbol, b1 as PointGeometry, v as PolygonElementCreate, w as PolygonElementRead, x as PolygonElementUpdate, b2 as PolygonGeometry, bg as PolygonToolSettings, aF as PrecomputedAggregationMethod, a8 as RasterBand, a9 as RasterLayer, aa as RasterLayerSource, ae as RasterValue, bh as RouteToolSettings, aR as SelectionController, bp as SetViewportCenterZoomParams, b3 as SetVisibilityRequest, b4 as SortConfig, b5 as SortDirection, T as TextElementCreate, y as TextElementRead, A as TextElementUpdate, bi as TextToolSettings, bj as ToolSettingsChangeEvent, bk as ToolSettingsMap, bl as ToolType, bm as ToolsController, bo as UiController, ab as UpdateLayerParams, aG as ValueConfiguration, ac as VectorLayer, bq as ViewportConstraints, bt as ViewportController, br as ViewportFitBoundsParams, bs as ViewportState } from './controller-CmThLnnL.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function r(e,
|
|
1
|
+
function r(e,s){return o=>{let n=new MessageChannel,l=o.handler,a="options"in o?o.options:void 0,m=crypto.randomUUID();return e.postMessage({type:"felt.addListener",event:a?{eventName:s,id:m,options:a}:{eventName:s,id:m}},"*",[n.port2]),n.port1.onmessage=g=>{u(g)||l(g.data)},()=>{n.port1.onmessage=null,n.port1.close(),n.port2.close(),e.postMessage({type:"felt.removeListener",id:m},"*")}}}function t(e,s,o){return async n=>{let l=new MessageChannel,a=n&&o?await o(n):n;return e.postMessage({type:s,params:a},"*",[l.port2]),new Promise((m,g)=>{l.port1.onmessage=y=>{u(y)?g(new Error(y.data.__error__)):m(y.data),l.port1.close(),l.port2.close()}})}}function u(e){return e.data&&typeof e.data=="object"&&"__error__"in e.data}var c=e=>({getElement:t(e,"getElement"),getElementGeometry:t(e,"getElementGeometry"),getElements:t(e,"getElements"),setElementGroupVisibility:t(e,"setElementGroupVisibility"),getElementGroup:t(e,"getElementGroup"),getElementGroups:t(e,"getElementGroups"),onElementChange:r(e,"onElementChange"),onElementCreate:r(e,"onElementCreate"),onElementCreateEnd:r(e,"onElementCreateEnd"),onElementDelete:r(e,"onElementDelete"),onElementGroupChange:r(e,"onElementGroupChange"),createElement:t(e,"createElement"),updateElement:t(e,"updateElement"),deleteElement:t(e,"deleteElement")});var C=e=>({onPointerClick:r(e,"onPointerClick"),onPointerMove:r(e,"onPointerMove")});var h=e=>({getLayer:t(e,"getLayer"),getLayers:t(e,"getLayers"),setLayerVisibility:t(e,"setLayerVisibility"),setLayerStyle:t(e,"setLayerStyle"),setLayerLegendVisibility:t(e,"setLayerLegendVisibility"),onLayerChange:r(e,"onLayerChange"),createLayersFromGeoJson:t(e,"createLayersFromGeoJson",L),updateLayer:t(e,"updateLayer",L),deleteLayer:t(e,"deleteLayer"),getLayerGroup:t(e,"getLayerGroup"),getLayerGroups:t(e,"getLayerGroups"),setLayerGroupVisibility:t(e,"setLayerGroupVisibility"),setLayerGroupLegendVisibility:t(e,"setLayerGroupLegendVisibility"),onLayerGroupChange:r(e,"onLayerGroupChange"),getLegendItem:t(e,"getLegendItem"),getLegendItems:t(e,"getLegendItems"),setLegendItemVisibility:t(e,"setLegendItemVisibility"),onLegendItemChange:r(e,"onLegendItemChange"),getLayerFilters:t(e,"getLayerFilters"),setLayerFilters:t(e,"setLayerFilters"),onLayerFiltersChange:r(e,"onLayerFiltersChange"),getLayerBoundaries:t(e,"getLayerBoundaries"),setLayerBoundary:t(e,"setLayerBoundary"),onLayerBoundariesChange:r(e,"onLayerBoundariesChange"),getRenderedFeatures:t(e,"getRenderedFeatures"),getFeature:t(e,"getFeature"),getFeatures:t(e,"getFeatures"),getGeoJsonFeature:t(e,"getGeoJsonFeature"),getCategoryData:t(e,"getCategoryData"),getHistogramData:t(e,"getHistogramData"),getAggregates:t(e,"getAggregates"),getPrecomputedAggregates:t(e,"getPrecomputedAggregates"),getLayerSchema:t(e,"getLayerSchema")});async function L(e){let{source:s}=e;return s&&s.type==="geoJsonFile"?{...e,source:{type:"geoJsonData",data:JSON.parse(await s.file.text())}}:e}var P=e=>({getMapDetails:t(e,"getMapDetails")});var T=e=>({onSelectionChange:r(e,"onSelectionChange"),getSelection:t(e,"getSelection"),selectFeature:t(e,"selectFeature"),clearSelection:t(e,"clearSelection")});var E=e=>({setTool:t(e,"setTool"),getTool:t(e,"getTool"),onToolChange:r(e,"onToolChange"),setToolSettings:t(e,"setToolSettings"),getToolSettings:t(e,"getToolSettings"),onToolSettingsChange:r(e,"onToolSettingsChange")});var v=e=>({updateUiControls:t(e,"updateUiControls"),setOnMapInteractionsUi:t(e,"setOnMapInteractionsUi"),showLayerDataTable:t(e,"showLayerDataTable"),hideLayerDataTable:t(e,"hideLayerDataTable")});var F=e=>({getViewport:t(e,"getViewport"),setViewport:t(e,"setViewport"),getViewportConstraints:t(e,"getViewportConstraints"),setViewportConstraints:t(e,"setViewportConstraints"),fitViewportToBounds:t(e,"fitViewportToBounds"),onViewportMove:r(e,"onViewportMove"),onViewportMoveEnd:r(e,"onViewportMoveEnd"),onMapIdle:r(e,"onMapIdle")});function G(e){return{iframe:null,...F(e),...v(e),...h(e),...c(e),...T(e),...C(e),...E(e),...P(e)}}var V={embed(e,s,o){let n={uiControls:{showLegend:!0,cooperativeGestures:!0,fullScreenButton:!0,geolocation:!1,zoomControls:!0,scaleBar:!0},initialViewport:void 0,origin:"https://felt.com"},l=o?.origin??n.origin,a=new URL(`${l}/embed/map/${s}`),m={showLegend:"legend",cooperativeGestures:"cooperativeGestures",fullScreenButton:"link",geolocation:"geolocation",zoomControls:"zoomControls",scaleBar:"scaleBar"},g={...n.uiControls,...o?.uiControls};for(let[p,d]of M(g))d!=null&&a.searchParams.set(m[p],d?"1":"0");if(o?.token&&a.searchParams.set("token",o.token),o?.initialViewport){let p=o.initialViewport;a.searchParams.set("loc",`${p.center.latitude},${p.center.longitude},${p.zoom}z`)}let y=e.tagName==="IFRAME",i=y?e:e.ownerDocument.createElement("iframe");return i.src=a.toString(),y||(i.style.width="100%",i.style.height="100%",i.style.border="none",i.style.margin="0",e.appendChild(i)),i.referrerPolicy="strict-origin-when-cross-origin",new Promise((p,d)=>{i.addEventListener("load",()=>{i.contentWindow==null?d(new Error("Failed to load Felt map")):p(i.contentWindow)},{once:!0})}).then(V.connect).then(p=>(Object.defineProperties(p,{iframe:{value:i,writable:!1,configurable:!1}}),p))},connect(e){let s=G(e);return new Promise((o,n)=>{let l=setTimeout(()=>{n(new Error("Failed to load Felt map")),clearInterval(m)},5e3),a=new MessageChannel,m=setInterval(()=>{e.postMessage({type:"felt.ready"},"*",[a.port2])},100);a.port1.onmessage=g=>{g.data===!0&&(clearInterval(m),clearTimeout(l),a.port1.close(),a.port2.close(),o(s))}})}},M=Object.entries;export{V as Felt};
|
|
@@ -5782,6 +5782,7 @@ interface LayerBoundaries {
|
|
|
5782
5782
|
}
|
|
5783
5783
|
|
|
5784
5784
|
declare const AggregateMethodSchema: z.ZodEnum<["avg", "max", "min", "sum", "median"]>;
|
|
5785
|
+
declare const PrecomputedAggregateMethodSchema: z.ZodEnum<["avg", "max", "min", "sum", "count"]>;
|
|
5785
5786
|
declare const AggregationConfigSchema: z.ZodObject<{
|
|
5786
5787
|
/**
|
|
5787
5788
|
* The operation to use on the values from the features in the layer
|
|
@@ -5831,6 +5832,12 @@ interface AggregationConfig extends zInfer<typeof AggregationConfigSchema> {
|
|
|
5831
5832
|
* @group Stats
|
|
5832
5833
|
*/
|
|
5833
5834
|
type AggregationMethod = z.infer<typeof AggregateMethodSchema>;
|
|
5835
|
+
/**
|
|
5836
|
+
* The method to use for the precomputed aggregation.
|
|
5837
|
+
*
|
|
5838
|
+
* @group Stats
|
|
5839
|
+
*/
|
|
5840
|
+
type PrecomputedAggregationMethod = z.infer<typeof PrecomputedAggregateMethodSchema>;
|
|
5834
5841
|
/**
|
|
5835
5842
|
* Defines how to aggregate a value across features in a layer with multiple aggregations
|
|
5836
5843
|
* returned at once.
|
|
@@ -6468,6 +6475,165 @@ interface GetLayerCalculationParams<T extends AggregationMethod | "count"> exten
|
|
|
6468
6475
|
*/
|
|
6469
6476
|
aggregation: MultiAggregationConfig<T>;
|
|
6470
6477
|
}
|
|
6478
|
+
declare const GridTypeSchema: z.ZodEnum<["h3"]>;
|
|
6479
|
+
type GridType = z.infer<typeof GridTypeSchema>;
|
|
6480
|
+
declare const GridConfigSchema: z.ZodObject<{
|
|
6481
|
+
/**
|
|
6482
|
+
* The type of grid to use for the precomputed calculation.
|
|
6483
|
+
*/
|
|
6484
|
+
type: z.ZodEnum<["h3"]>;
|
|
6485
|
+
/**
|
|
6486
|
+
* The resolution of the grid to use for the precomputed calculation.
|
|
6487
|
+
*/
|
|
6488
|
+
resolution: z.ZodNumber;
|
|
6489
|
+
/**
|
|
6490
|
+
* The method to use for the precomputed calculation.
|
|
6491
|
+
*/
|
|
6492
|
+
method: z.ZodEnum<["avg", "max", "min", "sum", "count"]>;
|
|
6493
|
+
/**
|
|
6494
|
+
* The attribute to use for the precomputed calculation. This can be omitted if the aggregation method is "count".
|
|
6495
|
+
* Must be a numeric attribute otherwise.
|
|
6496
|
+
*/
|
|
6497
|
+
attribute: z.ZodOptional<z.ZodString>;
|
|
6498
|
+
}, "strip", z.ZodTypeAny, {
|
|
6499
|
+
type: "h3";
|
|
6500
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
6501
|
+
resolution: number;
|
|
6502
|
+
attribute?: string | undefined;
|
|
6503
|
+
}, {
|
|
6504
|
+
type: "h3";
|
|
6505
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
6506
|
+
resolution: number;
|
|
6507
|
+
attribute?: string | undefined;
|
|
6508
|
+
}>;
|
|
6509
|
+
interface GridConfig extends z.infer<typeof GridConfigSchema> {
|
|
6510
|
+
/**
|
|
6511
|
+
* The type of grid to use for the precomputed calculation.
|
|
6512
|
+
*/
|
|
6513
|
+
type: GridType;
|
|
6514
|
+
/**
|
|
6515
|
+
* The resolution of the grid to use for the precomputed calculation.
|
|
6516
|
+
*/
|
|
6517
|
+
resolution: number;
|
|
6518
|
+
/**
|
|
6519
|
+
* The method to use for the precomputed calculation.
|
|
6520
|
+
*/
|
|
6521
|
+
method: PrecomputedAggregationMethod;
|
|
6522
|
+
/**
|
|
6523
|
+
* The attribute to use for the precomputed calculation.
|
|
6524
|
+
*/
|
|
6525
|
+
attribute: string | undefined;
|
|
6526
|
+
}
|
|
6527
|
+
declare const GetLayerPrecomputedCalculationParamsSchema: z.ZodObject<{
|
|
6528
|
+
/**
|
|
6529
|
+
* The ID of the layer to calculate an aggregate value for.
|
|
6530
|
+
*/
|
|
6531
|
+
layerId: z.ZodString;
|
|
6532
|
+
boundary: z.ZodOptional<z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>, z.ZodObject<{
|
|
6533
|
+
type: z.ZodLiteral<"Polygon">;
|
|
6534
|
+
coordinates: z.ZodArray<z.ZodEffects<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">, [number, number][], [number, number][]>, "many">;
|
|
6535
|
+
}, "strip", z.ZodTypeAny, {
|
|
6536
|
+
type: "Polygon";
|
|
6537
|
+
coordinates: [number, number][][];
|
|
6538
|
+
}, {
|
|
6539
|
+
type: "Polygon";
|
|
6540
|
+
coordinates: [number, number][][];
|
|
6541
|
+
}>, z.ZodObject<{
|
|
6542
|
+
type: z.ZodLiteral<"MultiPolygon">;
|
|
6543
|
+
coordinates: z.ZodArray<z.ZodArray<z.ZodEffects<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">, [number, number][], [number, number][]>, "many">, "many">;
|
|
6544
|
+
}, "strip", z.ZodTypeAny, {
|
|
6545
|
+
type: "MultiPolygon";
|
|
6546
|
+
coordinates: [number, number][][][];
|
|
6547
|
+
}, {
|
|
6548
|
+
type: "MultiPolygon";
|
|
6549
|
+
coordinates: [number, number][][][];
|
|
6550
|
+
}>, z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">]>>;
|
|
6551
|
+
filters: z.ZodOptional<z.ZodUnion<[z.ZodType<FilterTernary, z.ZodTypeDef, FilterTernary>, z.ZodUnion<[z.ZodTuple<[z.ZodUnion<[z.ZodString, z.ZodNull]>, z.ZodEnum<["in", "ni"]>, z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>, "many">, z.ZodNull]>], null>, z.ZodTuple<[z.ZodUnion<[z.ZodString, z.ZodNull]>, z.ZodEnum<["lt", "gt", "le", "ge", "eq", "ne", "cn", "nc", "is", "isnt"]>, z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>], null>]>, z.ZodNull, z.ZodBoolean]>>;
|
|
6552
|
+
/**
|
|
6553
|
+
* The type of grid to use for the precomputed calculation.
|
|
6554
|
+
*/
|
|
6555
|
+
gridConfig: z.ZodObject<{
|
|
6556
|
+
/**
|
|
6557
|
+
* The type of grid to use for the precomputed calculation.
|
|
6558
|
+
*/
|
|
6559
|
+
type: z.ZodEnum<["h3"]>;
|
|
6560
|
+
/**
|
|
6561
|
+
* The resolution of the grid to use for the precomputed calculation.
|
|
6562
|
+
*/
|
|
6563
|
+
resolution: z.ZodNumber;
|
|
6564
|
+
/**
|
|
6565
|
+
* The method to use for the precomputed calculation.
|
|
6566
|
+
*/
|
|
6567
|
+
method: z.ZodEnum<["avg", "max", "min", "sum", "count"]>;
|
|
6568
|
+
/**
|
|
6569
|
+
* The attribute to use for the precomputed calculation. This can be omitted if the aggregation method is "count".
|
|
6570
|
+
* Must be a numeric attribute otherwise.
|
|
6571
|
+
*/
|
|
6572
|
+
attribute: z.ZodOptional<z.ZodString>;
|
|
6573
|
+
}, "strip", z.ZodTypeAny, {
|
|
6574
|
+
type: "h3";
|
|
6575
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
6576
|
+
resolution: number;
|
|
6577
|
+
attribute?: string | undefined;
|
|
6578
|
+
}, {
|
|
6579
|
+
type: "h3";
|
|
6580
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
6581
|
+
resolution: number;
|
|
6582
|
+
attribute?: string | undefined;
|
|
6583
|
+
}>;
|
|
6584
|
+
}, "strip", z.ZodTypeAny, {
|
|
6585
|
+
layerId: string;
|
|
6586
|
+
gridConfig: {
|
|
6587
|
+
type: "h3";
|
|
6588
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
6589
|
+
resolution: number;
|
|
6590
|
+
attribute?: string | undefined;
|
|
6591
|
+
};
|
|
6592
|
+
boundary?: [number, number, number, number] | [number, number][] | {
|
|
6593
|
+
type: "Polygon";
|
|
6594
|
+
coordinates: [number, number][][];
|
|
6595
|
+
} | {
|
|
6596
|
+
type: "MultiPolygon";
|
|
6597
|
+
coordinates: [number, number][][][];
|
|
6598
|
+
} | undefined;
|
|
6599
|
+
filters?: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null | undefined;
|
|
6600
|
+
}, {
|
|
6601
|
+
layerId: string;
|
|
6602
|
+
gridConfig: {
|
|
6603
|
+
type: "h3";
|
|
6604
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
6605
|
+
resolution: number;
|
|
6606
|
+
attribute?: string | undefined;
|
|
6607
|
+
};
|
|
6608
|
+
boundary?: [number, number, number, number] | [number, number][] | {
|
|
6609
|
+
type: "Polygon";
|
|
6610
|
+
coordinates: [number, number][][];
|
|
6611
|
+
} | {
|
|
6612
|
+
type: "MultiPolygon";
|
|
6613
|
+
coordinates: [number, number][][][];
|
|
6614
|
+
} | undefined;
|
|
6615
|
+
filters?: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null | undefined;
|
|
6616
|
+
}>;
|
|
6617
|
+
/**
|
|
6618
|
+
* The parameters for calculating a single aggregate value for a layer, passed to
|
|
6619
|
+
* the {@link LayersController.getPrecomputedAggregates} method.
|
|
6620
|
+
*
|
|
6621
|
+
* @group Stats
|
|
6622
|
+
*/
|
|
6623
|
+
interface GetLayerPrecomputedCalculationParams extends z.infer<typeof GetLayerPrecomputedCalculationParamsSchema> {
|
|
6624
|
+
/**
|
|
6625
|
+
* Attribute filters for the features to include when calculating the aggregate value.
|
|
6626
|
+
*/
|
|
6627
|
+
filters?: Filters;
|
|
6628
|
+
/**
|
|
6629
|
+
* The spatial boundary for the features to include when calculating the aggregate value.
|
|
6630
|
+
*/
|
|
6631
|
+
boundary?: GeometryFilter;
|
|
6632
|
+
/**
|
|
6633
|
+
* The grid configuration to use for the precomputed calculation.
|
|
6634
|
+
*/
|
|
6635
|
+
gridConfig: GridConfig;
|
|
6636
|
+
}
|
|
6471
6637
|
|
|
6472
6638
|
/**
|
|
6473
6639
|
* The Layers controller allows you to get information about the layers on the
|
|
@@ -7236,6 +7402,33 @@ interface LayersController {
|
|
|
7236
7402
|
* ```
|
|
7237
7403
|
*/
|
|
7238
7404
|
getAggregates<T extends AggregationMethod | "count">(params: GetLayerCalculationParams<T>): Promise<Record<T, number | null>>;
|
|
7405
|
+
/**
|
|
7406
|
+
* Calculates aggregates for spatial cells of a layer.
|
|
7407
|
+
*
|
|
7408
|
+
* @remarks
|
|
7409
|
+
* Performs statistical calculations on spatial cells of a layer, returning min, max, avg, sum, and count. You can focus your calculation on specific areas or subsets
|
|
7410
|
+
* of your data using boundaries and filters. When using the count method, an attribute is not required.
|
|
7411
|
+
*
|
|
7412
|
+
* @example
|
|
7413
|
+
* ```typescript
|
|
7414
|
+
* const aggregates = await felt.getPrecomputedAggregates({
|
|
7415
|
+
* layerId: "buildings",
|
|
7416
|
+
* gridConfig: {
|
|
7417
|
+
* type: "h3",
|
|
7418
|
+
* resolution: 10,
|
|
7419
|
+
* method: "avg",
|
|
7420
|
+
* attribute: "assessed_value"
|
|
7421
|
+
* },
|
|
7422
|
+
* });
|
|
7423
|
+
* ```
|
|
7424
|
+
*/
|
|
7425
|
+
getPrecomputedAggregates(params: GetLayerPrecomputedCalculationParams): Promise<{
|
|
7426
|
+
avg: number | null;
|
|
7427
|
+
max: number | null;
|
|
7428
|
+
min: number | null;
|
|
7429
|
+
sum: number | null;
|
|
7430
|
+
count: number | null;
|
|
7431
|
+
}>;
|
|
7239
7432
|
/**
|
|
7240
7433
|
* Get the schema for a layer.
|
|
7241
7434
|
*
|
|
@@ -7597,9 +7790,8 @@ interface SelectionController {
|
|
|
7597
7790
|
}): Promise<void>;
|
|
7598
7791
|
}
|
|
7599
7792
|
|
|
7600
|
-
|
|
7601
|
-
type
|
|
7602
|
-
type ConfigurableToolType = keyof ToolSettingsMap;
|
|
7793
|
+
type ToolType = "circle" | "highlighter" | "line" | "link" | "marker" | "note" | "pin" | "polygon" | "route" | "text";
|
|
7794
|
+
type ConfigurableToolType = Exclude<ToolType, "link">;
|
|
7603
7795
|
declare const PinToolSettingsSchema: z.ZodObject<{
|
|
7604
7796
|
symbol: z.ZodString;
|
|
7605
7797
|
color: z.ZodString;
|
|
@@ -8513,4 +8705,4 @@ interface FeltController extends ViewportController, UiController, LayersControl
|
|
|
8513
8705
|
iframe: HTMLIFrameElement | null;
|
|
8514
8706
|
}
|
|
8515
8707
|
|
|
8516
|
-
export type { LayerChangeCallbackParams as $, TextElementUpdate as A, ElementsController as B, CircleElementCreate as C, MapInteractionEvent as D, Element as E, FeltController as F, GetElementGroupsConstraint as G, HighlighterElementCreate as H, ImageElementCreate as I, InteractionsController as J, CreateLayersFromGeoJsonParams as K, LinkElementRead as L, MarkerElementCreate as M, NoteElementCreate as N, DataOnlyLayer as O, PathElementCreate as P, FeltTiledVectorSource as Q, GeoJsonDataVectorSource as R, GeoJsonFileVectorSource as S, TextElementCreate as T, UiControlsOptions as U, ViewportCenterZoom as V, GeoJsonUrlVectorSource as W, GetLayerGroupsConstraint as X, GetLayersConstraint as Y, GetRenderedFeaturesConstraint as Z, Layer as _, CircleElementRead as a,
|
|
8708
|
+
export type { LayerChangeCallbackParams as $, TextElementUpdate as A, ElementsController as B, CircleElementCreate as C, MapInteractionEvent as D, Element as E, FeltController as F, GetElementGroupsConstraint as G, HighlighterElementCreate as H, ImageElementCreate as I, InteractionsController as J, CreateLayersFromGeoJsonParams as K, LinkElementRead as L, MarkerElementCreate as M, NoteElementCreate as N, DataOnlyLayer as O, PathElementCreate as P, FeltTiledVectorSource as Q, GeoJsonDataVectorSource as R, GeoJsonFileVectorSource as S, TextElementCreate as T, UiControlsOptions as U, ViewportCenterZoom as V, GeoJsonUrlVectorSource as W, GetLayerGroupsConstraint as X, GetLayersConstraint as Y, GetRenderedFeaturesConstraint as Z, Layer as _, CircleElementRead as a, MultiPointGeometry as a$, LayerCommon as a0, LayerGroup as a1, LayerGroupChangeCallbackParams as a2, LayerProcessingStatus as a3, LegendItem as a4, LegendItemChangeCallbackParams as a5, LegendItemIdentifier as a6, LegendItemsConstraint as a7, RasterBand as a8, RasterLayer as a9, GetLayerHistogramParams as aA, GetLayerPrecomputedCalculationParams as aB, GridConfig as aC, GridType as aD, MultiAggregationConfig as aE, PrecomputedAggregationMethod as aF, ValueConfiguration as aG, LayersController as aH, MapDetails as aI, MiscController as aJ, ElementGroupNode as aK, ElementNode as aL, EntityNode as aM, FeatureNode as aN, FeatureSelection as aO, LayerGroupNode as aP, LayerNode as aQ, SelectionController as aR, FeltBoundary as aS, FeltZoom as aT, GeoJsonFeature as aU, GeoJsonGeometry as aV, GeoJsonProperties as aW, LatLng as aX, LineStringGeometry as aY, LngLatTuple as aZ, MultiLineStringGeometry as a_, RasterLayerSource as aa, UpdateLayerParams as ab, VectorLayer as ac, LayerFeature as ad, RasterValue as ae, LayerSchema as af, LayerSchemaAttribute as ag, LayerSchemaBooleanAttribute as ah, LayerSchemaCommonAttribute as ai, LayerSchemaDateAttribute as aj, LayerSchemaDateTimeAttribute as ak, LayerSchemaNumericAttribute as al, LayerSchemaTextAttribute as am, FilterExpression as an, FilterLogicGate as ao, FilterTernary as ap, Filters as aq, GeometryFilter as ar, LayerBoundaries as as, LayerFilters as at, AggregationConfig as au, AggregationMethod as av, GetLayerCalculationParams as aw, GetLayerCategoriesGroup as ax, GetLayerCategoriesParams as ay, GetLayerHistogramBin as az, CircleElementUpdate as b, MultiPolygonGeometry as b0, PointGeometry as b1, PolygonGeometry as b2, SetVisibilityRequest as b3, SortConfig as b4, SortDirection as b5, CircleToolSettings as b6, ConfigurableToolType as b7, HighlighterToolSettings as b8, InputToolSettings as b9, LineToolSettings as ba, MarkerToolSettings as bb, NoteToolSettings as bc, PinToolSettings as bd, PlaceFrame as be, PlaceSymbol as bf, PolygonToolSettings as bg, RouteToolSettings as bh, TextToolSettings as bi, ToolSettingsChangeEvent as bj, ToolSettingsMap as bk, ToolType as bl, ToolsController as bm, UiOnMapInteractionsOptions as bn, UiController as bo, SetViewportCenterZoomParams as bp, ViewportConstraints as bq, ViewportFitBoundsParams as br, ViewportState as bs, ViewportController as bt, UnwrapPromise as bu, UnionToIntersection as bv, PromiseOrNot as bw, ElementChangeCallbackParams as c, ElementCreate as d, ElementGroup as e, ElementGroupChangeCallbackParams as f, ElementUpdate as g, GetElementsConstraint as h, HighlighterElementRead as i, HighlighterElementUpdate as j, ImageElementRead as k, ImageElementUpdate as l, MarkerElementRead as m, MarkerElementUpdate as n, NoteElementRead as o, NoteElementUpdate as p, PathElementRead as q, PathElementUpdate as r, PlaceElementCreate as s, PlaceElementRead as t, PlaceElementUpdate as u, PolygonElementCreate as v, PolygonElementRead as w, PolygonElementUpdate as x, TextElementRead as y, zInfer as z };
|
|
@@ -5782,6 +5782,7 @@ interface LayerBoundaries {
|
|
|
5782
5782
|
}
|
|
5783
5783
|
|
|
5784
5784
|
declare const AggregateMethodSchema: z.ZodEnum<["avg", "max", "min", "sum", "median"]>;
|
|
5785
|
+
declare const PrecomputedAggregateMethodSchema: z.ZodEnum<["avg", "max", "min", "sum", "count"]>;
|
|
5785
5786
|
declare const AggregationConfigSchema: z.ZodObject<{
|
|
5786
5787
|
/**
|
|
5787
5788
|
* The operation to use on the values from the features in the layer
|
|
@@ -5831,6 +5832,12 @@ interface AggregationConfig extends zInfer<typeof AggregationConfigSchema> {
|
|
|
5831
5832
|
* @group Stats
|
|
5832
5833
|
*/
|
|
5833
5834
|
type AggregationMethod = z.infer<typeof AggregateMethodSchema>;
|
|
5835
|
+
/**
|
|
5836
|
+
* The method to use for the precomputed aggregation.
|
|
5837
|
+
*
|
|
5838
|
+
* @group Stats
|
|
5839
|
+
*/
|
|
5840
|
+
type PrecomputedAggregationMethod = z.infer<typeof PrecomputedAggregateMethodSchema>;
|
|
5834
5841
|
/**
|
|
5835
5842
|
* Defines how to aggregate a value across features in a layer with multiple aggregations
|
|
5836
5843
|
* returned at once.
|
|
@@ -6468,6 +6475,165 @@ interface GetLayerCalculationParams<T extends AggregationMethod | "count"> exten
|
|
|
6468
6475
|
*/
|
|
6469
6476
|
aggregation: MultiAggregationConfig<T>;
|
|
6470
6477
|
}
|
|
6478
|
+
declare const GridTypeSchema: z.ZodEnum<["h3"]>;
|
|
6479
|
+
type GridType = z.infer<typeof GridTypeSchema>;
|
|
6480
|
+
declare const GridConfigSchema: z.ZodObject<{
|
|
6481
|
+
/**
|
|
6482
|
+
* The type of grid to use for the precomputed calculation.
|
|
6483
|
+
*/
|
|
6484
|
+
type: z.ZodEnum<["h3"]>;
|
|
6485
|
+
/**
|
|
6486
|
+
* The resolution of the grid to use for the precomputed calculation.
|
|
6487
|
+
*/
|
|
6488
|
+
resolution: z.ZodNumber;
|
|
6489
|
+
/**
|
|
6490
|
+
* The method to use for the precomputed calculation.
|
|
6491
|
+
*/
|
|
6492
|
+
method: z.ZodEnum<["avg", "max", "min", "sum", "count"]>;
|
|
6493
|
+
/**
|
|
6494
|
+
* The attribute to use for the precomputed calculation. This can be omitted if the aggregation method is "count".
|
|
6495
|
+
* Must be a numeric attribute otherwise.
|
|
6496
|
+
*/
|
|
6497
|
+
attribute: z.ZodOptional<z.ZodString>;
|
|
6498
|
+
}, "strip", z.ZodTypeAny, {
|
|
6499
|
+
type: "h3";
|
|
6500
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
6501
|
+
resolution: number;
|
|
6502
|
+
attribute?: string | undefined;
|
|
6503
|
+
}, {
|
|
6504
|
+
type: "h3";
|
|
6505
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
6506
|
+
resolution: number;
|
|
6507
|
+
attribute?: string | undefined;
|
|
6508
|
+
}>;
|
|
6509
|
+
interface GridConfig extends z.infer<typeof GridConfigSchema> {
|
|
6510
|
+
/**
|
|
6511
|
+
* The type of grid to use for the precomputed calculation.
|
|
6512
|
+
*/
|
|
6513
|
+
type: GridType;
|
|
6514
|
+
/**
|
|
6515
|
+
* The resolution of the grid to use for the precomputed calculation.
|
|
6516
|
+
*/
|
|
6517
|
+
resolution: number;
|
|
6518
|
+
/**
|
|
6519
|
+
* The method to use for the precomputed calculation.
|
|
6520
|
+
*/
|
|
6521
|
+
method: PrecomputedAggregationMethod;
|
|
6522
|
+
/**
|
|
6523
|
+
* The attribute to use for the precomputed calculation.
|
|
6524
|
+
*/
|
|
6525
|
+
attribute: string | undefined;
|
|
6526
|
+
}
|
|
6527
|
+
declare const GetLayerPrecomputedCalculationParamsSchema: z.ZodObject<{
|
|
6528
|
+
/**
|
|
6529
|
+
* The ID of the layer to calculate an aggregate value for.
|
|
6530
|
+
*/
|
|
6531
|
+
layerId: z.ZodString;
|
|
6532
|
+
boundary: z.ZodOptional<z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>, z.ZodObject<{
|
|
6533
|
+
type: z.ZodLiteral<"Polygon">;
|
|
6534
|
+
coordinates: z.ZodArray<z.ZodEffects<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">, [number, number][], [number, number][]>, "many">;
|
|
6535
|
+
}, "strip", z.ZodTypeAny, {
|
|
6536
|
+
type: "Polygon";
|
|
6537
|
+
coordinates: [number, number][][];
|
|
6538
|
+
}, {
|
|
6539
|
+
type: "Polygon";
|
|
6540
|
+
coordinates: [number, number][][];
|
|
6541
|
+
}>, z.ZodObject<{
|
|
6542
|
+
type: z.ZodLiteral<"MultiPolygon">;
|
|
6543
|
+
coordinates: z.ZodArray<z.ZodArray<z.ZodEffects<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">, [number, number][], [number, number][]>, "many">, "many">;
|
|
6544
|
+
}, "strip", z.ZodTypeAny, {
|
|
6545
|
+
type: "MultiPolygon";
|
|
6546
|
+
coordinates: [number, number][][][];
|
|
6547
|
+
}, {
|
|
6548
|
+
type: "MultiPolygon";
|
|
6549
|
+
coordinates: [number, number][][][];
|
|
6550
|
+
}>, z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">]>>;
|
|
6551
|
+
filters: z.ZodOptional<z.ZodUnion<[z.ZodType<FilterTernary, z.ZodTypeDef, FilterTernary>, z.ZodUnion<[z.ZodTuple<[z.ZodUnion<[z.ZodString, z.ZodNull]>, z.ZodEnum<["in", "ni"]>, z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>, "many">, z.ZodNull]>], null>, z.ZodTuple<[z.ZodUnion<[z.ZodString, z.ZodNull]>, z.ZodEnum<["lt", "gt", "le", "ge", "eq", "ne", "cn", "nc", "is", "isnt"]>, z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>], null>]>, z.ZodNull, z.ZodBoolean]>>;
|
|
6552
|
+
/**
|
|
6553
|
+
* The type of grid to use for the precomputed calculation.
|
|
6554
|
+
*/
|
|
6555
|
+
gridConfig: z.ZodObject<{
|
|
6556
|
+
/**
|
|
6557
|
+
* The type of grid to use for the precomputed calculation.
|
|
6558
|
+
*/
|
|
6559
|
+
type: z.ZodEnum<["h3"]>;
|
|
6560
|
+
/**
|
|
6561
|
+
* The resolution of the grid to use for the precomputed calculation.
|
|
6562
|
+
*/
|
|
6563
|
+
resolution: z.ZodNumber;
|
|
6564
|
+
/**
|
|
6565
|
+
* The method to use for the precomputed calculation.
|
|
6566
|
+
*/
|
|
6567
|
+
method: z.ZodEnum<["avg", "max", "min", "sum", "count"]>;
|
|
6568
|
+
/**
|
|
6569
|
+
* The attribute to use for the precomputed calculation. This can be omitted if the aggregation method is "count".
|
|
6570
|
+
* Must be a numeric attribute otherwise.
|
|
6571
|
+
*/
|
|
6572
|
+
attribute: z.ZodOptional<z.ZodString>;
|
|
6573
|
+
}, "strip", z.ZodTypeAny, {
|
|
6574
|
+
type: "h3";
|
|
6575
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
6576
|
+
resolution: number;
|
|
6577
|
+
attribute?: string | undefined;
|
|
6578
|
+
}, {
|
|
6579
|
+
type: "h3";
|
|
6580
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
6581
|
+
resolution: number;
|
|
6582
|
+
attribute?: string | undefined;
|
|
6583
|
+
}>;
|
|
6584
|
+
}, "strip", z.ZodTypeAny, {
|
|
6585
|
+
layerId: string;
|
|
6586
|
+
gridConfig: {
|
|
6587
|
+
type: "h3";
|
|
6588
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
6589
|
+
resolution: number;
|
|
6590
|
+
attribute?: string | undefined;
|
|
6591
|
+
};
|
|
6592
|
+
boundary?: [number, number, number, number] | [number, number][] | {
|
|
6593
|
+
type: "Polygon";
|
|
6594
|
+
coordinates: [number, number][][];
|
|
6595
|
+
} | {
|
|
6596
|
+
type: "MultiPolygon";
|
|
6597
|
+
coordinates: [number, number][][][];
|
|
6598
|
+
} | undefined;
|
|
6599
|
+
filters?: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null | undefined;
|
|
6600
|
+
}, {
|
|
6601
|
+
layerId: string;
|
|
6602
|
+
gridConfig: {
|
|
6603
|
+
type: "h3";
|
|
6604
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
6605
|
+
resolution: number;
|
|
6606
|
+
attribute?: string | undefined;
|
|
6607
|
+
};
|
|
6608
|
+
boundary?: [number, number, number, number] | [number, number][] | {
|
|
6609
|
+
type: "Polygon";
|
|
6610
|
+
coordinates: [number, number][][];
|
|
6611
|
+
} | {
|
|
6612
|
+
type: "MultiPolygon";
|
|
6613
|
+
coordinates: [number, number][][][];
|
|
6614
|
+
} | undefined;
|
|
6615
|
+
filters?: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null | undefined;
|
|
6616
|
+
}>;
|
|
6617
|
+
/**
|
|
6618
|
+
* The parameters for calculating a single aggregate value for a layer, passed to
|
|
6619
|
+
* the {@link LayersController.getPrecomputedAggregates} method.
|
|
6620
|
+
*
|
|
6621
|
+
* @group Stats
|
|
6622
|
+
*/
|
|
6623
|
+
interface GetLayerPrecomputedCalculationParams extends z.infer<typeof GetLayerPrecomputedCalculationParamsSchema> {
|
|
6624
|
+
/**
|
|
6625
|
+
* Attribute filters for the features to include when calculating the aggregate value.
|
|
6626
|
+
*/
|
|
6627
|
+
filters?: Filters;
|
|
6628
|
+
/**
|
|
6629
|
+
* The spatial boundary for the features to include when calculating the aggregate value.
|
|
6630
|
+
*/
|
|
6631
|
+
boundary?: GeometryFilter;
|
|
6632
|
+
/**
|
|
6633
|
+
* The grid configuration to use for the precomputed calculation.
|
|
6634
|
+
*/
|
|
6635
|
+
gridConfig: GridConfig;
|
|
6636
|
+
}
|
|
6471
6637
|
|
|
6472
6638
|
/**
|
|
6473
6639
|
* The Layers controller allows you to get information about the layers on the
|
|
@@ -7236,6 +7402,33 @@ interface LayersController {
|
|
|
7236
7402
|
* ```
|
|
7237
7403
|
*/
|
|
7238
7404
|
getAggregates<T extends AggregationMethod | "count">(params: GetLayerCalculationParams<T>): Promise<Record<T, number | null>>;
|
|
7405
|
+
/**
|
|
7406
|
+
* Calculates aggregates for spatial cells of a layer.
|
|
7407
|
+
*
|
|
7408
|
+
* @remarks
|
|
7409
|
+
* Performs statistical calculations on spatial cells of a layer, returning min, max, avg, sum, and count. You can focus your calculation on specific areas or subsets
|
|
7410
|
+
* of your data using boundaries and filters. When using the count method, an attribute is not required.
|
|
7411
|
+
*
|
|
7412
|
+
* @example
|
|
7413
|
+
* ```typescript
|
|
7414
|
+
* const aggregates = await felt.getPrecomputedAggregates({
|
|
7415
|
+
* layerId: "buildings",
|
|
7416
|
+
* gridConfig: {
|
|
7417
|
+
* type: "h3",
|
|
7418
|
+
* resolution: 10,
|
|
7419
|
+
* method: "avg",
|
|
7420
|
+
* attribute: "assessed_value"
|
|
7421
|
+
* },
|
|
7422
|
+
* });
|
|
7423
|
+
* ```
|
|
7424
|
+
*/
|
|
7425
|
+
getPrecomputedAggregates(params: GetLayerPrecomputedCalculationParams): Promise<{
|
|
7426
|
+
avg: number | null;
|
|
7427
|
+
max: number | null;
|
|
7428
|
+
min: number | null;
|
|
7429
|
+
sum: number | null;
|
|
7430
|
+
count: number | null;
|
|
7431
|
+
}>;
|
|
7239
7432
|
/**
|
|
7240
7433
|
* Get the schema for a layer.
|
|
7241
7434
|
*
|
|
@@ -7597,9 +7790,8 @@ interface SelectionController {
|
|
|
7597
7790
|
}): Promise<void>;
|
|
7598
7791
|
}
|
|
7599
7792
|
|
|
7600
|
-
|
|
7601
|
-
type
|
|
7602
|
-
type ConfigurableToolType = keyof ToolSettingsMap;
|
|
7793
|
+
type ToolType = "circle" | "highlighter" | "line" | "link" | "marker" | "note" | "pin" | "polygon" | "route" | "text";
|
|
7794
|
+
type ConfigurableToolType = Exclude<ToolType, "link">;
|
|
7603
7795
|
declare const PinToolSettingsSchema: z.ZodObject<{
|
|
7604
7796
|
symbol: z.ZodString;
|
|
7605
7797
|
color: z.ZodString;
|
|
@@ -8513,4 +8705,4 @@ interface FeltController extends ViewportController, UiController, LayersControl
|
|
|
8513
8705
|
iframe: HTMLIFrameElement | null;
|
|
8514
8706
|
}
|
|
8515
8707
|
|
|
8516
|
-
export type { LayerChangeCallbackParams as $, TextElementUpdate as A, ElementsController as B, CircleElementCreate as C, MapInteractionEvent as D, Element as E, FeltController as F, GetElementGroupsConstraint as G, HighlighterElementCreate as H, ImageElementCreate as I, InteractionsController as J, CreateLayersFromGeoJsonParams as K, LinkElementRead as L, MarkerElementCreate as M, NoteElementCreate as N, DataOnlyLayer as O, PathElementCreate as P, FeltTiledVectorSource as Q, GeoJsonDataVectorSource as R, GeoJsonFileVectorSource as S, TextElementCreate as T, UiControlsOptions as U, ViewportCenterZoom as V, GeoJsonUrlVectorSource as W, GetLayerGroupsConstraint as X, GetLayersConstraint as Y, GetRenderedFeaturesConstraint as Z, Layer as _, CircleElementRead as a,
|
|
8708
|
+
export type { LayerChangeCallbackParams as $, TextElementUpdate as A, ElementsController as B, CircleElementCreate as C, MapInteractionEvent as D, Element as E, FeltController as F, GetElementGroupsConstraint as G, HighlighterElementCreate as H, ImageElementCreate as I, InteractionsController as J, CreateLayersFromGeoJsonParams as K, LinkElementRead as L, MarkerElementCreate as M, NoteElementCreate as N, DataOnlyLayer as O, PathElementCreate as P, FeltTiledVectorSource as Q, GeoJsonDataVectorSource as R, GeoJsonFileVectorSource as S, TextElementCreate as T, UiControlsOptions as U, ViewportCenterZoom as V, GeoJsonUrlVectorSource as W, GetLayerGroupsConstraint as X, GetLayersConstraint as Y, GetRenderedFeaturesConstraint as Z, Layer as _, CircleElementRead as a, MultiPointGeometry as a$, LayerCommon as a0, LayerGroup as a1, LayerGroupChangeCallbackParams as a2, LayerProcessingStatus as a3, LegendItem as a4, LegendItemChangeCallbackParams as a5, LegendItemIdentifier as a6, LegendItemsConstraint as a7, RasterBand as a8, RasterLayer as a9, GetLayerHistogramParams as aA, GetLayerPrecomputedCalculationParams as aB, GridConfig as aC, GridType as aD, MultiAggregationConfig as aE, PrecomputedAggregationMethod as aF, ValueConfiguration as aG, LayersController as aH, MapDetails as aI, MiscController as aJ, ElementGroupNode as aK, ElementNode as aL, EntityNode as aM, FeatureNode as aN, FeatureSelection as aO, LayerGroupNode as aP, LayerNode as aQ, SelectionController as aR, FeltBoundary as aS, FeltZoom as aT, GeoJsonFeature as aU, GeoJsonGeometry as aV, GeoJsonProperties as aW, LatLng as aX, LineStringGeometry as aY, LngLatTuple as aZ, MultiLineStringGeometry as a_, RasterLayerSource as aa, UpdateLayerParams as ab, VectorLayer as ac, LayerFeature as ad, RasterValue as ae, LayerSchema as af, LayerSchemaAttribute as ag, LayerSchemaBooleanAttribute as ah, LayerSchemaCommonAttribute as ai, LayerSchemaDateAttribute as aj, LayerSchemaDateTimeAttribute as ak, LayerSchemaNumericAttribute as al, LayerSchemaTextAttribute as am, FilterExpression as an, FilterLogicGate as ao, FilterTernary as ap, Filters as aq, GeometryFilter as ar, LayerBoundaries as as, LayerFilters as at, AggregationConfig as au, AggregationMethod as av, GetLayerCalculationParams as aw, GetLayerCategoriesGroup as ax, GetLayerCategoriesParams as ay, GetLayerHistogramBin as az, CircleElementUpdate as b, MultiPolygonGeometry as b0, PointGeometry as b1, PolygonGeometry as b2, SetVisibilityRequest as b3, SortConfig as b4, SortDirection as b5, CircleToolSettings as b6, ConfigurableToolType as b7, HighlighterToolSettings as b8, InputToolSettings as b9, LineToolSettings as ba, MarkerToolSettings as bb, NoteToolSettings as bc, PinToolSettings as bd, PlaceFrame as be, PlaceSymbol as bf, PolygonToolSettings as bg, RouteToolSettings as bh, TextToolSettings as bi, ToolSettingsChangeEvent as bj, ToolSettingsMap as bk, ToolType as bl, ToolsController as bm, UiOnMapInteractionsOptions as bn, UiController as bo, SetViewportCenterZoomParams as bp, ViewportConstraints as bq, ViewportFitBoundsParams as br, ViewportState as bs, ViewportController as bt, UnwrapPromise as bu, UnionToIntersection as bv, PromiseOrNot as bw, ElementChangeCallbackParams as c, ElementCreate as d, ElementGroup as e, ElementGroupChangeCallbackParams as f, ElementUpdate as g, GetElementsConstraint as h, HighlighterElementRead as i, HighlighterElementUpdate as j, ImageElementRead as k, ImageElementUpdate as l, MarkerElementRead as m, MarkerElementUpdate as n, NoteElementRead as o, NoteElementUpdate as p, PathElementRead as q, PathElementUpdate as r, PlaceElementCreate as s, PlaceElementRead as t, PlaceElementUpdate as u, PolygonElementCreate as v, PolygonElementRead as w, PolygonElementUpdate as x, TextElementRead as y, zInfer as z };
|
package/dist/handler.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var oe=Object.defineProperty;var lt=Object.getOwnPropertyDescriptor;var pt=Object.getOwnPropertyNames;var mt=Object.prototype.hasOwnProperty;var ct=(r,l)=>{for(var E in l)oe(r,E,{get:l[E],enumerable:!0})},gt=(r,l,E,P)=>{if(l&&typeof l=="object"||typeof l=="function")for(let C of pt(l))!mt.call(r,C)&&C!==E&&oe(r,C,{get:()=>l[C],enumerable:!(P=lt(l,C))||P.enumerable});return r};var yt=r=>gt(oe({},"__esModule",{value:!0}),r);var fr={};ct(fr,{createMessageHandler:()=>mr});module.exports=yt(fr);var g=require("zod");var d=require("zod");var S=require("zod");function t(r,l){return S.z.strictObject({type:S.z.literal(r),params:l})}function h(r,l){return S.z.strictObject({eventName:S.z.literal(r),id:S.z.string(),options:l})}function p(r){return S.z.strictObject({eventName:S.z.literal(r),id:S.z.string()})}var s=require("zod"),H=s.z.number(),J=s.z.number(),Z=s.z.object({latitude:J,longitude:H}),G=s.z.tuple([H,J]),w=s.z.object({type:s.z.literal("Polygon"),coordinates:s.z.array(s.z.array(G).min(4).refine(r=>r[0][0]===r[r.length-1][0]&&r[0][1]===r[r.length-1][1],"The last point of each ring must be identical to the first"))}),q=s.z.object({type:s.z.literal("MultiPolygon"),coordinates:s.z.array(w.shape.coordinates)}),dt=s.z.object({type:s.z.literal("LineString"),coordinates:s.z.array(G).min(2)}),U=s.z.object({type:s.z.literal("MultiLineString"),coordinates:s.z.array(dt.shape.coordinates)}),fe=s.z.number().min(1).max(23),x=s.z.tuple([H,J,H,J]),z=s.z.object({show:s.z.array(s.z.string()).optional(),hide:s.z.array(s.z.string()).optional()}),ut=s.z.enum(["asc","desc"]),W=s.z.object({attribute:s.z.string(),direction:ut});var e=require("zod");var f=e.z.object({id:e.z.string(),groupId:e.z.string().nullable(),color:e.z.string(),name:e.z.string().nullable(),description:e.z.string().nullable(),attributes:e.z.record(e.z.string(),e.z.unknown()),interaction:e.z.enum(["default","locked"]).optional()}),$=e.z.object({imageUrl:e.z.string().nullable()}),ae=e.z.object({strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"])}),ht=e.z.enum(["meter","kilometer","foot","mile"]),_=f.extend($.shape).extend({type:e.z.literal("Place"),coordinates:G,symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.z.boolean()}),O=f.extend($.shape).extend(ae.shape).extend({type:e.z.literal("Path"),coordinates:U.shape.coordinates,distanceMarker:e.z.boolean(),routingMode:e.z.enum(["driving","cycling","walking","flying"]).nullable(),endCaps:e.z.boolean()}),v=f.extend($.shape).extend(ae.shape).extend({type:e.z.literal("Polygon"),coordinates:w.shape.coordinates,fillOpacity:e.z.number().min(0).max(1),areaMarker:e.z.boolean()}),Q=f.extend($.shape).extend(ae.shape).extend({type:e.z.literal("Circle"),center:G,radius:e.z.number(),radiusMarker:e.z.boolean(),radiusDisplayAngle:e.z.number(),radiusDisplayUnit:ht.nullable(),fillOpacity:e.z.number().min(0).max(1)}),j=f.extend({type:e.z.literal("Marker"),coordinates:U.shape.coordinates,opacity:e.z.number().min(0).max(1),size:e.z.number().min(0).max(100),zoom:e.z.number().min(0).max(23)}),R=f.extend({type:e.z.literal("Highlighter"),coordinates:q.shape.coordinates,renderHoles:e.z.boolean(),opacity:e.z.number().min(0).max(1)}),Se=e.z.object({position:G,rotation:e.z.number(),scale:e.z.number(),zoom:e.z.number().min(0).max(23),text:e.z.string(),align:e.z.enum(["left","center","right"]),style:e.z.enum(["italic","light","regular","caps"]),name:e.z.string()}),re=f.extend(Se.shape).extend({type:e.z.literal("Text")}),ne=f.extend(Se.shape).extend({type:e.z.literal("Note"),widthScale:e.z.number().min(0)}),N=f.extend({type:e.z.literal("Image"),coordinates:U.shape.coordinates,imageUrl:e.z.string(),opacity:e.z.number().min(0).max(1)}).omit({color:!0}),ft=f.extend({type:e.z.literal("Link"),coordinates:U.shape.coordinates,url:e.z.string()}),F={type:!0,coordinates:!0},L={id:!0},ie=_.partial().extend(_.pick(F).shape).omit(L),K=O.partial().extend(O.pick(F).shape).omit(L),se=v.partial().extend(v.pick(F).shape).omit(L),le=Q.partial().extend(Q.pick({type:!0,center:!0,radius:!0}).shape).omit(L),pe=j.partial().extend(j.pick(F).shape).omit(L),me=R.partial().extend(R.pick(F).shape).omit(L),ce=re.partial().omit({...L,name:!0,type:!0}).extend({type:e.z.literal("Text"),text:e.z.string()}),ge=ne.partial().omit({...L,name:!0,type:!0}).extend({type:e.z.literal("Note"),text:e.z.string()}),St=N.partial().extend(N.pick({...F,imageUrl:!0}).shape).omit(L),xe=e.z.discriminatedUnion("type",[ie,K,se,le,pe,me,St,ce,ge]);var Cr=O.omit({coordinates:!0}),Gr=v.omit({coordinates:!0});var Ir=j.omit({coordinates:!0}),Tr=R.omit({coordinates:!0});var Er=N.omit({coordinates:!0}),zr=ft.omit({coordinates:!0}),b={type:!0,id:!0},xt=_.partial().extend(_.pick(b).shape),Lt=O.partial().extend(O.pick(b).shape),bt=v.partial().extend(v.pick(b).shape),Mt=Q.partial().extend(Q.pick(b).shape),Ct=j.partial().extend(j.pick(b).shape),Gt=R.partial().extend(R.pick(b).shape),It=re.partial().extend(re.pick(b).shape).omit({name:!0}),Tt=ne.partial().extend(ne.pick(b).shape).omit({name:!0}),Et=N.partial().extend(N.pick(b).shape),Le=e.z.discriminatedUnion("type",[xt,Lt,bt,Mt,Ct,Gt,It,Tt,Et]),be=e.z.object({ids:e.z.array(e.z.string()).optional()}),Me=e.z.object({ids:e.z.array(e.z.string()).optional()});var zt=t("getElement",d.z.string()),Pt=t("getElementGeometry",d.z.string()),Ft=t("getElements",be.optional()),kt=t("getElementGroup",d.z.string()),Vt=t("getElementGroups",Me.optional()),wt=t("setElementGroupVisibility",z),Ut=h("onElementChange",d.z.object({id:d.z.string()})),Ot=p("onElementCreate"),vt=p("onElementCreateEnd"),jt=h("onElementDelete",d.z.object({id:d.z.string()})),Rt=h("onElementGroupChange",d.z.object({id:d.z.string()})),Nt=t("createElement",xe),At=t("updateElement",Le),Bt=t("deleteElement",d.z.string()),Ce={methods:[zt,Pt,Ft,kt,Vt,wt,Nt,At,Bt],listeners:[Ut,Ot,vt,jt,Rt]};var Dt=p("onPointerClick"),Ht=p("onPointerMove"),Ge={methods:null,listeners:[Dt,Ht]};var a=require("zod");var i=require("zod");var Jt=i.z.enum(["in","ni"]),Zt=i.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),jr=i.z.enum(["and","or"]),Ie=i.z.union([i.z.number(),i.z.string(),i.z.boolean(),i.z.null()]),Te=i.z.string().or(i.z.null()),qt=i.z.tuple([Te,Jt,i.z.array(Ie).or(i.z.null())]),Wt=i.z.tuple([Te,Zt,Ie]),ye=i.z.union([qt,Wt]),de=i.z.tuple([i.z.lazy(()=>i.z.union([de,ye,i.z.null(),i.z.boolean()])),i.z.enum(["and","or"]),i.z.lazy(()=>i.z.union([de,ye,i.z.null(),i.z.boolean()]))]),I=i.z.union([de,ye,i.z.null(),i.z.boolean()]),T=i.z.union([x,w,q,i.z.array(G)]);var n=require("zod");var Ee=n.z.enum(["avg","max","min","sum","median"]),_t=n.z.object({method:Ee,attribute:n.z.string()}),Qt=n.z.object({methods:n.z.array(n.z.union([Ee,n.z.literal("count")])),attribute:n.z.string().optional()}),ze=n.z.object({boundary:T.optional(),filters:I.optional(),aggregation:_t.optional()}),Pe=n.z.object({layerId:n.z.string(),attribute:n.z.string(),limit:n.z.number().optional(),boundary:T.optional(),filters:I.optional(),values:ze.optional()}),Ar=n.z.object({key:n.z.union([n.z.number(),n.z.string(),n.z.boolean()]),value:n.z.number().nullable()}),$t=n.z.object({type:n.z.literal("equal-intervals"),count:n.z.number()}),Kt=n.z.object({type:n.z.literal("time-interval"),interval:n.z.enum(["hour","day","week","month","year"])}),Fe=n.z.object({layerId:n.z.string(),attribute:n.z.string(),steps:n.z.union([$t,Kt,n.z.array(n.z.number())]),boundary:T.optional(),filters:I.optional(),values:ze.optional()}),Br=n.z.object({min:n.z.number(),max:n.z.number(),value:n.z.number()}),ke=n.z.object({layerId:n.z.string(),boundary:T.optional(),filters:I.optional(),aggregation:Qt});var o=require("zod");var Jr=o.z.enum(["processing","completed","failed","incomplete"]),Ve=o.z.object({type:o.z.literal("geoJsonUrl"),url:o.z.string().url(),refreshInterval:o.z.number().min(250).max(5*60*1e3).nullable().optional()}),we=o.z.object({type:o.z.literal("geoJsonData"),data:o.z.object({}).passthrough().or(o.z.instanceof(ArrayBuffer))}),Ue=o.z.object({type:o.z.literal("geoJsonFile"),file:o.z.instanceof(File)}),Oe=o.z.object({id:o.z.string(),style:o.z.object({}).passthrough().optional(),shownInLegend:o.z.boolean().optional(),name:o.z.string().optional(),caption:o.z.string().optional(),description:o.z.string().optional(),bounds:x.optional(),source:o.z.union([Ve,we,Ue]).optional()}),ve=o.z.object({ids:o.z.array(o.z.string()).optional()}),je=o.z.object({ids:o.z.array(o.z.string()).optional()}),k=o.z.object({id:o.z.string(),layerId:o.z.string()}),Re=o.z.object({ids:k.array().optional(),layerIds:o.z.string().array().optional()}),Ne=o.z.object({layerIds:o.z.array(o.z.string()).optional(),areaQuery:o.z.union([o.z.object({coordinates:Z}),o.z.object({boundary:x})]).optional()}),Xt=o.z.object({Point:o.z.object({}).passthrough().optional(),Line:o.z.object({}).passthrough().optional(),Polygon:o.z.object({}).passthrough().optional()}),Ae=o.z.object({source:o.z.union([Ve,we,Ue]),name:o.z.string(),bounds:x.optional(),caption:o.z.string().optional(),description:o.z.string().optional(),geometryStyles:Xt.optional()});var Yt=t("getLayer",a.z.string()),eo=t("getLayers",ve.optional()),to=t("setLayerVisibility",z),oo=h("onLayerChange",a.z.object({id:a.z.string()})),ro=t("setLayerStyle",a.z.object({id:a.z.string(),style:a.z.object({}).passthrough()})),no=t("setLayerLegendVisibility",z),ao=t("createLayersFromGeoJson",Ae),io=t("updateLayer",Oe),so=t("deleteLayer",a.z.string()),lo=t("getLayerGroup",a.z.string()),po=t("getLayerGroups",je.optional()),mo=t("setLayerGroupVisibility",z),co=t("setLayerGroupLegendVisibility",z),go=h("onLayerGroupChange",a.z.object({id:a.z.string()})),yo=t("getLegendItem",k),uo=t("getLegendItems",Re.optional()),ho=h("onLegendItemChange",k),fo=t("setLegendItemVisibility",a.z.object({show:k.array().optional(),hide:k.array().optional()})),So=t("getLayerFilters",a.z.string()),xo=t("setLayerFilters",a.z.object({layerId:a.z.string(),filters:I,note:a.z.string().optional()})),Lo=h("onLayerFiltersChange",a.z.object({layerId:a.z.string()})),bo=t("getLayerBoundaries",a.z.string()),Mo=t("setLayerBoundary",a.z.object({layerIds:a.z.array(a.z.string()),boundary:T.nullable()})),Co=h("onLayerBoundariesChange",a.z.object({layerId:a.z.string()})),Go=t("getRenderedFeatures",Ne.optional()),Io=t("getFeature",a.z.object({id:a.z.string().or(a.z.number()),layerId:a.z.string()})),To=t("getFeatures",a.z.object({layerId:a.z.string(),filters:I.optional(),sorting:W.optional(),boundary:T.optional(),search:a.z.string().optional(),pagination:a.z.string().optional().nullish()})),Eo=t("getGeoJsonFeature",a.z.object({id:a.z.string().or(a.z.number()),layerId:a.z.string()})),zo=t("getCategoryData",Pe),Po=t("getHistogramData",Fe),Fo=t("getAggregates",ke),ko=t("getLayerSchema",a.z.string()),Be={methods:[Yt,eo,to,ro,no,ao,so,io,lo,po,mo,co,yo,uo,fo,So,xo,bo,Mo,Go,Io,To,Eo,zo,Po,Fo,ko],listeners:[oo,go,ho,Lo,Co]};var De=require("zod");var Vo=t("getMapDetails",De.z.undefined()),He={methods:[Vo],listeners:[]};var A=require("zod");var M=require("zod"),Je=M.z.object({id:M.z.string().or(M.z.number()),layerId:M.z.string(),showPopup:M.z.boolean().optional(),fitViewport:M.z.boolean().or(M.z.object({maxZoom:M.z.number()})).optional()});var wo=t("getSelection",A.z.undefined()),Uo=p("onSelectionChange"),Oo=t("selectFeature",Je),vo=t("clearSelection",A.z.object({features:A.z.boolean().optional(),elements:A.z.boolean().optional()}).optional()),Ze={methods:[wo,Oo,vo],listeners:[Uo]};var $e=require("zod");var m=require("zod");var qe=["pin","line","route","polygon","circle","marker","highlighter","text","note"],We=m.z.enum([...qe,"link"]),_e=m.z.enum(qe),jo=ie.pick({color:!0,symbol:!0,frame:!0}).extend({afterCreation:m.z.enum(["enter name","add another","select"])}).required(),Ro=K.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),No=K.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),Ao=se.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),Bo=le.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),Do=pe.pick({color:!0,opacity:!0,size:!0}).required(),Ho=me.pick({color:!0,opacity:!0,renderHoles:!0}).extend({size:m.z.number().min(0).max(200)}).required(),Jo=ce.pick({color:!0,align:!0,style:!0}).required(),Zo=ge.pick({color:!0,align:!0,style:!0}).required(),Qe=m.z.discriminatedUnion("tool",[jo.partial().extend({tool:m.z.literal("pin")}),Ro.partial().extend({tool:m.z.literal("line")}),No.partial().extend({tool:m.z.literal("route")}),Ao.partial().extend({tool:m.z.literal("polygon")}),Bo.partial().extend({tool:m.z.literal("circle")}),Do.partial().extend({tool:m.z.literal("marker")}),Ho.partial().extend({tool:m.z.literal("highlighter")}),Jo.partial().extend({tool:m.z.literal("text")}),Zo.partial().extend({tool:m.z.literal("note")})]);var qo=t("setTool",We.nullable()),Wo=t("getTool",$e.z.undefined()),_o=p("onToolChange"),Qo=t("setToolSettings",Qe),$o=t("getToolSettings",_e),Ko=p("onToolSettingsChange"),Ke={methods:[qo,Wo,Qo,$o],listeners:[_o,Ko]};var X=require("zod");var c=require("zod"),Xe=c.z.object({showLegend:c.z.boolean().optional(),cooperativeGestures:c.z.boolean().optional(),fullScreenButton:c.z.boolean().optional(),geolocation:c.z.boolean().optional(),zoomControls:c.z.boolean().optional(),scaleBar:c.z.boolean().optional()}),Ye=c.z.object({featureSelectPanel:c.z.boolean().optional(),featureHoverPanel:c.z.boolean().optional(),elementSelectPanel:c.z.boolean().optional(),linkClickOpen:c.z.boolean().optional(),imageLightboxOpen:c.z.boolean().optional()});var Xo=t("updateUiControls",Xe),Yo=t("setOnMapInteractionsUi",Ye),er=t("showLayerDataTable",X.z.object({layerId:X.z.string(),sorting:W.optional()}).optional()),tr=t("hideLayerDataTable",X.z.undefined()),et={methods:[Xo,Yo,er,tr],listeners:null};var ue=require("zod");var B=require("zod");var Y=B.z.object({center:Z,zoom:fe}),tt=B.z.object({center:Y.shape.center.optional(),zoom:Y.shape.zoom.optional()}),ot=B.z.object({minZoom:Y.shape.zoom.nullish(),maxZoom:Y.shape.zoom.nullish(),bounds:x.nullish()}).nullable(),rt=B.z.object({bounds:x});var or=t("getViewport",ue.z.undefined()),rr=t("setViewport",tt),nr=t("getViewportConstraints",ue.z.undefined()),ar=t("setViewportConstraints",ot),ir=t("fitViewportToBounds",rt),sr=p("onViewportMove"),lr=p("onViewportMoveEnd"),pr=p("onMapIdle"),nt={methods:[rr,or,nr,ar,ir],listeners:[sr,lr,pr]};var he=[et,nt,Be,Ce,Ze,Ge,Ke,He];function mr(r,l,E){let P=new Map;async function C(u){if(!ur.safeParse(u.data).success){E?.onUnknownMessage?.(u.data);return}let D=st.safeParse(u.data);if(!D.success){E?.onInvalidMessage?.(u.data,D.error),u.ports[0]?.postMessage(at(D.error.message));return}let{data:y}=D;if(y.type==="felt.ready")u.ports[0]?.postMessage(!0);else if(y.type==="felt.addListener"){if(y.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let V="options"in y.event?{options:"options"in y.event?y.event.options:void 0,handler:te=>{u.ports[0]?.postMessage(te)}}:{handler:te=>{u.ports[0]?.postMessage(te)}},ee=l.listeners[y.event.eventName](V);P.set(y.event.id,ee)}else if(y.type==="felt.removeListener")P.get(y.id)?.(),P.delete(y.id);else try{let V=l.methods[y.type],ee=await V(y.params);u.ports[0]?.postMessage(ee)}catch(V){u.ports[0]?.postMessage(at(V))}}return r.addEventListener("message",C),()=>{r.removeEventListener("message",C)}}var it={methods:he.map(r=>r.methods??[]).flat(),listeners:he.map(r=>r.listeners??[]).flat()},cr=g.z.discriminatedUnion("eventName",[g.z.strictObject({eventName:g.z.literal("")}),...it.listeners]),gr=g.z.strictObject({type:g.z.literal("felt.addListener"),event:cr}),yr=g.z.strictObject({type:g.z.literal("felt.removeListener"),id:g.z.string()}),dr=g.z.strictObject({type:g.z.literal("felt.ready")}),st=g.z.discriminatedUnion("type",[dr,gr,yr,...it.methods]),ur=g.z.object({type:g.z.enum(st.options.map(r=>r.shape.type.value))});function at(r){return{__error__:hr(r)}}function hr(r){return r instanceof Error?r.message:typeof r=="object"&&r!==null&&"message"in r?String(r.message):typeof r=="string"?r:"Unknown error"}0&&(module.exports={createMessageHandler});
|
|
1
|
+
"use strict";var oe=Object.defineProperty;var pt=Object.getOwnPropertyDescriptor;var ct=Object.getOwnPropertyNames;var mt=Object.prototype.hasOwnProperty;var gt=(n,l)=>{for(var P in l)oe(n,P,{get:l[P],enumerable:!0})},yt=(n,l,P,z)=>{if(l&&typeof l=="object"||typeof l=="function")for(let I of ct(l))!mt.call(n,I)&&I!==P&&oe(n,I,{get:()=>l[I],enumerable:!(z=pt(l,I))||z.enumerable});return n};var dt=n=>yt(oe({},"__esModule",{value:!0}),n);var Cr={};gt(Cr,{createMessageHandler:()=>hr});module.exports=dt(Cr);var g=require("zod");var d=require("zod");var S=require("zod");function t(n,l){return S.z.strictObject({type:S.z.literal(n),params:l})}function h(n,l){return S.z.strictObject({eventName:S.z.literal(n),id:S.z.string(),options:l})}function p(n){return S.z.strictObject({eventName:S.z.literal(n),id:S.z.string()})}var s=require("zod"),H=s.z.number(),J=s.z.number(),Z=s.z.object({latitude:J,longitude:H}),T=s.z.tuple([H,J]),w=s.z.object({type:s.z.literal("Polygon"),coordinates:s.z.array(s.z.array(T).min(4).refine(n=>n[0][0]===n[n.length-1][0]&&n[0][1]===n[n.length-1][1],"The last point of each ring must be identical to the first"))}),q=s.z.object({type:s.z.literal("MultiPolygon"),coordinates:s.z.array(w.shape.coordinates)}),ut=s.z.object({type:s.z.literal("LineString"),coordinates:s.z.array(T).min(2)}),U=s.z.object({type:s.z.literal("MultiLineString"),coordinates:s.z.array(ut.shape.coordinates)}),fe=s.z.number().min(1).max(23),x=s.z.tuple([H,J,H,J]),E=s.z.object({show:s.z.array(s.z.string()).optional(),hide:s.z.array(s.z.string()).optional()}),ht=s.z.enum(["asc","desc"]),W=s.z.object({attribute:s.z.string(),direction:ht});var e=require("zod");var f=e.z.object({id:e.z.string(),groupId:e.z.string().nullable(),color:e.z.string(),name:e.z.string().nullable(),description:e.z.string().nullable(),attributes:e.z.record(e.z.string(),e.z.unknown()),interaction:e.z.enum(["default","locked"]).optional()}),$=e.z.object({imageUrl:e.z.string().nullable()}),ae=e.z.object({strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"])}),ft=e.z.enum(["meter","kilometer","foot","mile"]),_=f.extend($.shape).extend({type:e.z.literal("Place"),coordinates:T,symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.z.boolean()}),O=f.extend($.shape).extend(ae.shape).extend({type:e.z.literal("Path"),coordinates:U.shape.coordinates,distanceMarker:e.z.boolean(),routingMode:e.z.enum(["driving","cycling","walking","flying"]).nullable(),endCaps:e.z.boolean()}),v=f.extend($.shape).extend(ae.shape).extend({type:e.z.literal("Polygon"),coordinates:w.shape.coordinates,fillOpacity:e.z.number().min(0).max(1),areaMarker:e.z.boolean()}),Q=f.extend($.shape).extend(ae.shape).extend({type:e.z.literal("Circle"),center:T,radius:e.z.number(),radiusMarker:e.z.boolean(),radiusDisplayAngle:e.z.number(),radiusDisplayUnit:ft.nullable(),fillOpacity:e.z.number().min(0).max(1)}),j=f.extend({type:e.z.literal("Marker"),coordinates:U.shape.coordinates,opacity:e.z.number().min(0).max(1),size:e.z.number().min(0).max(100),zoom:e.z.number().min(0).max(23)}),R=f.extend({type:e.z.literal("Highlighter"),coordinates:q.shape.coordinates,renderHoles:e.z.boolean(),opacity:e.z.number().min(0).max(1)}),Se=e.z.object({position:T,rotation:e.z.number(),scale:e.z.number(),zoom:e.z.number().min(0).max(23),text:e.z.string(),align:e.z.enum(["left","center","right"]),style:e.z.enum(["italic","light","regular","caps"]),name:e.z.string()}),re=f.extend(Se.shape).extend({type:e.z.literal("Text")}),ne=f.extend(Se.shape).extend({type:e.z.literal("Note"),widthScale:e.z.number().min(0)}),N=f.extend({type:e.z.literal("Image"),coordinates:U.shape.coordinates,imageUrl:e.z.string(),opacity:e.z.number().min(0).max(1)}).omit({color:!0}),St=f.extend({type:e.z.literal("Link"),coordinates:U.shape.coordinates,url:e.z.string()}),F={type:!0,coordinates:!0},L={id:!0},ie=_.partial().extend(_.pick(F).shape).omit(L),K=O.partial().extend(O.pick(F).shape).omit(L),se=v.partial().extend(v.pick(F).shape).omit(L),le=Q.partial().extend(Q.pick({type:!0,center:!0,radius:!0}).shape).omit(L),pe=j.partial().extend(j.pick(F).shape).omit(L),ce=R.partial().extend(R.pick(F).shape).omit(L),me=re.partial().omit({...L,name:!0,type:!0}).extend({type:e.z.literal("Text"),text:e.z.string()}),ge=ne.partial().omit({...L,name:!0,type:!0}).extend({type:e.z.literal("Note"),text:e.z.string()}),xt=N.partial().extend(N.pick({...F,imageUrl:!0}).shape).omit(L),xe=e.z.discriminatedUnion("type",[ie,K,se,le,pe,ce,xt,me,ge]);var zr=O.omit({coordinates:!0}),Fr=v.omit({coordinates:!0});var kr=j.omit({coordinates:!0}),Vr=R.omit({coordinates:!0});var wr=N.omit({coordinates:!0}),Ur=St.omit({coordinates:!0}),b={type:!0,id:!0},Lt=_.partial().extend(_.pick(b).shape),bt=O.partial().extend(O.pick(b).shape),Mt=v.partial().extend(v.pick(b).shape),Ct=Q.partial().extend(Q.pick(b).shape),Gt=j.partial().extend(j.pick(b).shape),It=R.partial().extend(R.pick(b).shape),Tt=re.partial().extend(re.pick(b).shape).omit({name:!0}),Pt=ne.partial().extend(ne.pick(b).shape).omit({name:!0}),Et=N.partial().extend(N.pick(b).shape),Le=e.z.discriminatedUnion("type",[Lt,bt,Mt,Ct,Gt,It,Tt,Pt,Et]),be=e.z.object({ids:e.z.array(e.z.string()).optional()}),Me=e.z.object({ids:e.z.array(e.z.string()).optional()});var zt=t("getElement",d.z.string()),Ft=t("getElementGeometry",d.z.string()),kt=t("getElements",be.optional()),Vt=t("getElementGroup",d.z.string()),wt=t("getElementGroups",Me.optional()),Ut=t("setElementGroupVisibility",E),Ot=h("onElementChange",d.z.object({id:d.z.string()})),vt=p("onElementCreate"),jt=p("onElementCreateEnd"),Rt=h("onElementDelete",d.z.object({id:d.z.string()})),Nt=h("onElementGroupChange",d.z.object({id:d.z.string()})),At=t("createElement",xe),Bt=t("updateElement",Le),Dt=t("deleteElement",d.z.string()),Ce={methods:[zt,Ft,kt,Vt,wt,Ut,At,Bt,Dt],listeners:[Ot,vt,jt,Rt,Nt]};var Ht=p("onPointerClick"),Jt=p("onPointerMove"),Ge={methods:null,listeners:[Ht,Jt]};var a=require("zod");var i=require("zod");var Zt=i.z.enum(["in","ni"]),qt=i.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),Hr=i.z.enum(["and","or"]),Ie=i.z.union([i.z.number(),i.z.string(),i.z.boolean(),i.z.null()]),Te=i.z.string().or(i.z.null()),Wt=i.z.tuple([Te,Zt,i.z.array(Ie).or(i.z.null())]),_t=i.z.tuple([Te,qt,Ie]),ye=i.z.union([Wt,_t]),de=i.z.tuple([i.z.lazy(()=>i.z.union([de,ye,i.z.null(),i.z.boolean()])),i.z.enum(["and","or"]),i.z.lazy(()=>i.z.union([de,ye,i.z.null(),i.z.boolean()]))]),M=i.z.union([de,ye,i.z.null(),i.z.boolean()]),C=i.z.union([x,w,q,i.z.array(T)]);var r=require("zod");var Pe=r.z.enum(["avg","max","min","sum","median"]),Qt=r.z.enum(["avg","max","min","sum","count"]),$t=r.z.object({method:Pe,attribute:r.z.string()}),Kt=r.z.object({methods:r.z.array(r.z.union([Pe,r.z.literal("count")])),attribute:r.z.string().optional()}),Ee=r.z.object({boundary:C.optional(),filters:M.optional(),aggregation:$t.optional()}),ze=r.z.object({layerId:r.z.string(),attribute:r.z.string(),limit:r.z.number().optional(),boundary:C.optional(),filters:M.optional(),values:Ee.optional()}),qr=r.z.object({key:r.z.union([r.z.number(),r.z.string(),r.z.boolean()]),value:r.z.number().nullable()}),Xt=r.z.object({type:r.z.literal("equal-intervals"),count:r.z.number()}),Yt=r.z.object({type:r.z.literal("time-interval"),interval:r.z.enum(["hour","day","week","month","year"])}),Fe=r.z.object({layerId:r.z.string(),attribute:r.z.string(),steps:r.z.union([Xt,Yt,r.z.array(r.z.number())]),boundary:C.optional(),filters:M.optional(),values:Ee.optional()}),Wr=r.z.object({min:r.z.number(),max:r.z.number(),value:r.z.number()}),ke=r.z.object({layerId:r.z.string(),boundary:C.optional(),filters:M.optional(),aggregation:Kt}),eo=r.z.enum(["h3"]),to=r.z.object({type:eo,resolution:r.z.number(),method:Qt,attribute:r.z.string().optional()}),Ve=r.z.object({layerId:r.z.string(),boundary:C.optional(),filters:M.optional(),gridConfig:to});var o=require("zod");var $r=o.z.enum(["processing","completed","failed","incomplete"]),we=o.z.object({type:o.z.literal("geoJsonUrl"),url:o.z.string().url(),refreshInterval:o.z.number().min(250).max(5*60*1e3).nullable().optional()}),Ue=o.z.object({type:o.z.literal("geoJsonData"),data:o.z.object({}).passthrough().or(o.z.instanceof(ArrayBuffer))}),Oe=o.z.object({type:o.z.literal("geoJsonFile"),file:o.z.instanceof(File)}),ve=o.z.object({id:o.z.string(),style:o.z.object({}).passthrough().optional(),shownInLegend:o.z.boolean().optional(),name:o.z.string().optional(),caption:o.z.string().optional(),description:o.z.string().optional(),bounds:x.optional(),source:o.z.union([we,Ue,Oe]).optional()}),je=o.z.object({ids:o.z.array(o.z.string()).optional()}),Re=o.z.object({ids:o.z.array(o.z.string()).optional()}),k=o.z.object({id:o.z.string(),layerId:o.z.string()}),Ne=o.z.object({ids:k.array().optional(),layerIds:o.z.string().array().optional()}),Ae=o.z.object({layerIds:o.z.array(o.z.string()).optional(),areaQuery:o.z.union([o.z.object({coordinates:Z}),o.z.object({boundary:x})]).optional()}),oo=o.z.object({Point:o.z.object({}).passthrough().optional(),Line:o.z.object({}).passthrough().optional(),Polygon:o.z.object({}).passthrough().optional()}),Be=o.z.object({source:o.z.union([we,Ue,Oe]),name:o.z.string(),bounds:x.optional(),caption:o.z.string().optional(),description:o.z.string().optional(),geometryStyles:oo.optional()});var ro=t("getLayer",a.z.string()),no=t("getLayers",je.optional()),ao=t("setLayerVisibility",E),io=h("onLayerChange",a.z.object({id:a.z.string()})),so=t("setLayerStyle",a.z.object({id:a.z.string(),style:a.z.object({}).passthrough()})),lo=t("setLayerLegendVisibility",E),po=t("createLayersFromGeoJson",Be),co=t("updateLayer",ve),mo=t("deleteLayer",a.z.string()),go=t("getLayerGroup",a.z.string()),yo=t("getLayerGroups",Re.optional()),uo=t("setLayerGroupVisibility",E),ho=t("setLayerGroupLegendVisibility",E),fo=h("onLayerGroupChange",a.z.object({id:a.z.string()})),So=t("getLegendItem",k),xo=t("getLegendItems",Ne.optional()),Lo=h("onLegendItemChange",k),bo=t("setLegendItemVisibility",a.z.object({show:k.array().optional(),hide:k.array().optional()})),Mo=t("getLayerFilters",a.z.string()),Co=t("setLayerFilters",a.z.object({layerId:a.z.string(),filters:M,note:a.z.string().optional()})),Go=h("onLayerFiltersChange",a.z.object({layerId:a.z.string()})),Io=t("getLayerBoundaries",a.z.string()),To=t("setLayerBoundary",a.z.object({layerIds:a.z.array(a.z.string()),boundary:C.nullable()})),Po=h("onLayerBoundariesChange",a.z.object({layerId:a.z.string()})),Eo=t("getRenderedFeatures",Ae.optional()),zo=t("getFeature",a.z.object({id:a.z.string().or(a.z.number()),layerId:a.z.string()})),Fo=t("getFeatures",a.z.object({layerId:a.z.string(),filters:M.optional(),sorting:W.optional(),boundary:C.optional(),search:a.z.string().optional(),pagination:a.z.string().optional().nullish()})),ko=t("getGeoJsonFeature",a.z.object({id:a.z.string().or(a.z.number()),layerId:a.z.string()})),Vo=t("getCategoryData",ze),wo=t("getHistogramData",Fe),Uo=t("getAggregates",ke),Oo=t("getPrecomputedAggregates",Ve),vo=t("getLayerSchema",a.z.string()),De={methods:[ro,no,ao,so,lo,po,mo,co,go,yo,uo,ho,So,xo,bo,Mo,Co,Io,To,Eo,zo,Fo,ko,Vo,wo,Uo,Oo,vo],listeners:[io,fo,Lo,Go,Po]};var He=require("zod");var jo=t("getMapDetails",He.z.undefined()),Je={methods:[jo],listeners:[]};var A=require("zod");var G=require("zod"),Ze=G.z.object({id:G.z.string().or(G.z.number()),layerId:G.z.string(),showPopup:G.z.boolean().optional(),fitViewport:G.z.boolean().or(G.z.object({maxZoom:G.z.number()})).optional()});var Ro=t("getSelection",A.z.undefined()),No=p("onSelectionChange"),Ao=t("selectFeature",Ze),Bo=t("clearSelection",A.z.object({features:A.z.boolean().optional(),elements:A.z.boolean().optional()}).optional()),qe={methods:[Ro,Ao,Bo],listeners:[No]};var Ke=require("zod");var c=require("zod");var We=["circle","highlighter","line","marker","note","pin","polygon","route","text"],Do=[...We,"link"],_e=c.z.enum(Do),Qe=c.z.enum(We),Ho=ie.pick({color:!0,symbol:!0,frame:!0}).extend({afterCreation:c.z.enum(["enter name","add another","select"])}).required(),Jo=K.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),Zo=K.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),qo=se.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),Wo=le.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),_o=pe.pick({color:!0,opacity:!0,size:!0}).required(),Qo=ce.pick({color:!0,opacity:!0,renderHoles:!0}).extend({size:c.z.number().min(0).max(200)}).required(),$o=me.pick({color:!0,align:!0,style:!0}).required(),Ko=ge.pick({color:!0,align:!0,style:!0}).required(),$e=c.z.discriminatedUnion("tool",[Ho.partial().extend({tool:c.z.literal("pin")}),Jo.partial().extend({tool:c.z.literal("line")}),Zo.partial().extend({tool:c.z.literal("route")}),qo.partial().extend({tool:c.z.literal("polygon")}),Wo.partial().extend({tool:c.z.literal("circle")}),_o.partial().extend({tool:c.z.literal("marker")}),Qo.partial().extend({tool:c.z.literal("highlighter")}),$o.partial().extend({tool:c.z.literal("text")}),Ko.partial().extend({tool:c.z.literal("note")})]);var Xo=t("setTool",_e.nullable()),Yo=t("getTool",Ke.z.undefined()),er=p("onToolChange"),tr=t("setToolSettings",$e),or=t("getToolSettings",Qe),rr=p("onToolSettingsChange"),Xe={methods:[Xo,Yo,tr,or],listeners:[er,rr]};var X=require("zod");var m=require("zod"),Ye=m.z.object({showLegend:m.z.boolean().optional(),cooperativeGestures:m.z.boolean().optional(),fullScreenButton:m.z.boolean().optional(),geolocation:m.z.boolean().optional(),zoomControls:m.z.boolean().optional(),scaleBar:m.z.boolean().optional()}),et=m.z.object({featureSelectPanel:m.z.boolean().optional(),featureHoverPanel:m.z.boolean().optional(),elementSelectPanel:m.z.boolean().optional(),linkClickOpen:m.z.boolean().optional(),imageLightboxOpen:m.z.boolean().optional()});var nr=t("updateUiControls",Ye),ar=t("setOnMapInteractionsUi",et),ir=t("showLayerDataTable",X.z.object({layerId:X.z.string(),sorting:W.optional()}).optional()),sr=t("hideLayerDataTable",X.z.undefined()),tt={methods:[nr,ar,ir,sr],listeners:null};var ue=require("zod");var B=require("zod");var Y=B.z.object({center:Z,zoom:fe}),ot=B.z.object({center:Y.shape.center.optional(),zoom:Y.shape.zoom.optional()}),rt=B.z.object({minZoom:Y.shape.zoom.nullish(),maxZoom:Y.shape.zoom.nullish(),bounds:x.nullish()}).nullable(),nt=B.z.object({bounds:x});var lr=t("getViewport",ue.z.undefined()),pr=t("setViewport",ot),cr=t("getViewportConstraints",ue.z.undefined()),mr=t("setViewportConstraints",rt),gr=t("fitViewportToBounds",nt),yr=p("onViewportMove"),dr=p("onViewportMoveEnd"),ur=p("onMapIdle"),at={methods:[pr,lr,cr,mr,gr],listeners:[yr,dr,ur]};var he=[tt,at,De,Ce,qe,Ge,Xe,Je];function hr(n,l,P){let z=new Map;async function I(u){if(!br.safeParse(u.data).success){P?.onUnknownMessage?.(u.data);return}let D=lt.safeParse(u.data);if(!D.success){P?.onInvalidMessage?.(u.data,D.error),u.ports[0]?.postMessage(it(D.error.message));return}let{data:y}=D;if(y.type==="felt.ready")u.ports[0]?.postMessage(!0);else if(y.type==="felt.addListener"){if(y.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let V="options"in y.event?{options:"options"in y.event?y.event.options:void 0,handler:te=>{u.ports[0]?.postMessage(te)}}:{handler:te=>{u.ports[0]?.postMessage(te)}},ee=l.listeners[y.event.eventName](V);z.set(y.event.id,ee)}else if(y.type==="felt.removeListener")z.get(y.id)?.(),z.delete(y.id);else try{let V=l.methods[y.type],ee=await V(y.params);u.ports[0]?.postMessage(ee)}catch(V){u.ports[0]?.postMessage(it(V))}}return n.addEventListener("message",I),()=>{n.removeEventListener("message",I)}}var st={methods:he.map(n=>n.methods??[]).flat(),listeners:he.map(n=>n.listeners??[]).flat()},fr=g.z.discriminatedUnion("eventName",[g.z.strictObject({eventName:g.z.literal("")}),...st.listeners]),Sr=g.z.strictObject({type:g.z.literal("felt.addListener"),event:fr}),xr=g.z.strictObject({type:g.z.literal("felt.removeListener"),id:g.z.string()}),Lr=g.z.strictObject({type:g.z.literal("felt.ready")}),lt=g.z.discriminatedUnion("type",[Lr,Sr,xr,...st.methods]),br=g.z.object({type:g.z.enum(lt.options.map(n=>n.shape.type.value))});function it(n){return{__error__:Mr(n)}}function Mr(n){return n instanceof Error?n.message:typeof n=="object"&&n!==null&&"message"in n?String(n.message):typeof n=="string"?n:"Unknown error"}0&&(module.exports={createMessageHandler});
|
package/dist/handler.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z, ZodError } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { bu as UnwrapPromise, F as FeltController, z as zInfer, c as ElementChangeCallbackParams, f as ElementGroupChangeCallbackParams, E as Element, D as MapInteractionEvent, $ as LayerChangeCallbackParams, a2 as LayerGroupChangeCallbackParams, a5 as LegendItemChangeCallbackParams, at as LayerFilters, as as LayerBoundaries, ap as FilterTernary, aM as EntityNode, bl as ToolType, bj as ToolSettingsChangeEvent, bs as ViewportState, bv as UnionToIntersection, bw as PromiseOrNot } from './controller-CmThLnnL.cjs';
|
|
3
3
|
|
|
4
4
|
type FeltControllerFunctions = Omit<FeltController, "iframe">;
|
|
5
5
|
type Method<TRequest extends {
|
|
@@ -3435,6 +3435,118 @@ declare const GetLayerCalculationMessage: z.ZodObject<{
|
|
|
3435
3435
|
};
|
|
3436
3436
|
type: "getAggregates";
|
|
3437
3437
|
}>;
|
|
3438
|
+
declare const GetLayerPrecomputedCalculationMessage: z.ZodObject<{
|
|
3439
|
+
type: z.ZodLiteral<"getPrecomputedAggregates">;
|
|
3440
|
+
params: z.ZodObject<{
|
|
3441
|
+
layerId: z.ZodString;
|
|
3442
|
+
boundary: z.ZodOptional<z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>, z.ZodObject<{
|
|
3443
|
+
type: z.ZodLiteral<"Polygon">;
|
|
3444
|
+
coordinates: z.ZodArray<z.ZodEffects<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">, [number, number][], [number, number][]>, "many">;
|
|
3445
|
+
}, "strip", z.ZodTypeAny, {
|
|
3446
|
+
type: "Polygon";
|
|
3447
|
+
coordinates: [number, number][][];
|
|
3448
|
+
}, {
|
|
3449
|
+
type: "Polygon";
|
|
3450
|
+
coordinates: [number, number][][];
|
|
3451
|
+
}>, z.ZodObject<{
|
|
3452
|
+
type: z.ZodLiteral<"MultiPolygon">;
|
|
3453
|
+
coordinates: z.ZodArray<z.ZodArray<z.ZodEffects<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">, [number, number][], [number, number][]>, "many">, "many">;
|
|
3454
|
+
}, "strip", z.ZodTypeAny, {
|
|
3455
|
+
type: "MultiPolygon";
|
|
3456
|
+
coordinates: [number, number][][][];
|
|
3457
|
+
}, {
|
|
3458
|
+
type: "MultiPolygon";
|
|
3459
|
+
coordinates: [number, number][][][];
|
|
3460
|
+
}>, z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">]>>;
|
|
3461
|
+
filters: z.ZodOptional<z.ZodUnion<[z.ZodType<FilterTernary, z.ZodTypeDef, FilterTernary>, z.ZodUnion<[z.ZodTuple<[z.ZodUnion<[z.ZodString, z.ZodNull]>, z.ZodEnum<["in", "ni"]>, z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>, "many">, z.ZodNull]>], null>, z.ZodTuple<[z.ZodUnion<[z.ZodString, z.ZodNull]>, z.ZodEnum<["lt", "gt", "le", "ge", "eq", "ne", "cn", "nc", "is", "isnt"]>, z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>], null>]>, z.ZodNull, z.ZodBoolean]>>;
|
|
3462
|
+
gridConfig: z.ZodObject<{
|
|
3463
|
+
type: z.ZodEnum<["h3"]>;
|
|
3464
|
+
resolution: z.ZodNumber;
|
|
3465
|
+
method: z.ZodEnum<["avg", "max", "min", "sum", "count"]>;
|
|
3466
|
+
attribute: z.ZodOptional<z.ZodString>;
|
|
3467
|
+
}, "strip", z.ZodTypeAny, {
|
|
3468
|
+
type: "h3";
|
|
3469
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
3470
|
+
resolution: number;
|
|
3471
|
+
attribute?: string | undefined;
|
|
3472
|
+
}, {
|
|
3473
|
+
type: "h3";
|
|
3474
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
3475
|
+
resolution: number;
|
|
3476
|
+
attribute?: string | undefined;
|
|
3477
|
+
}>;
|
|
3478
|
+
}, "strip", z.ZodTypeAny, {
|
|
3479
|
+
layerId: string;
|
|
3480
|
+
gridConfig: {
|
|
3481
|
+
type: "h3";
|
|
3482
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
3483
|
+
resolution: number;
|
|
3484
|
+
attribute?: string | undefined;
|
|
3485
|
+
};
|
|
3486
|
+
boundary?: [number, number, number, number] | [number, number][] | {
|
|
3487
|
+
type: "Polygon";
|
|
3488
|
+
coordinates: [number, number][][];
|
|
3489
|
+
} | {
|
|
3490
|
+
type: "MultiPolygon";
|
|
3491
|
+
coordinates: [number, number][][][];
|
|
3492
|
+
} | undefined;
|
|
3493
|
+
filters?: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null | undefined;
|
|
3494
|
+
}, {
|
|
3495
|
+
layerId: string;
|
|
3496
|
+
gridConfig: {
|
|
3497
|
+
type: "h3";
|
|
3498
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
3499
|
+
resolution: number;
|
|
3500
|
+
attribute?: string | undefined;
|
|
3501
|
+
};
|
|
3502
|
+
boundary?: [number, number, number, number] | [number, number][] | {
|
|
3503
|
+
type: "Polygon";
|
|
3504
|
+
coordinates: [number, number][][];
|
|
3505
|
+
} | {
|
|
3506
|
+
type: "MultiPolygon";
|
|
3507
|
+
coordinates: [number, number][][][];
|
|
3508
|
+
} | undefined;
|
|
3509
|
+
filters?: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null | undefined;
|
|
3510
|
+
}>;
|
|
3511
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
3512
|
+
params: {
|
|
3513
|
+
layerId: string;
|
|
3514
|
+
gridConfig: {
|
|
3515
|
+
type: "h3";
|
|
3516
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
3517
|
+
resolution: number;
|
|
3518
|
+
attribute?: string | undefined;
|
|
3519
|
+
};
|
|
3520
|
+
boundary?: [number, number, number, number] | [number, number][] | {
|
|
3521
|
+
type: "Polygon";
|
|
3522
|
+
coordinates: [number, number][][];
|
|
3523
|
+
} | {
|
|
3524
|
+
type: "MultiPolygon";
|
|
3525
|
+
coordinates: [number, number][][][];
|
|
3526
|
+
} | undefined;
|
|
3527
|
+
filters?: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null | undefined;
|
|
3528
|
+
};
|
|
3529
|
+
type: "getPrecomputedAggregates";
|
|
3530
|
+
}, {
|
|
3531
|
+
params: {
|
|
3532
|
+
layerId: string;
|
|
3533
|
+
gridConfig: {
|
|
3534
|
+
type: "h3";
|
|
3535
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
3536
|
+
resolution: number;
|
|
3537
|
+
attribute?: string | undefined;
|
|
3538
|
+
};
|
|
3539
|
+
boundary?: [number, number, number, number] | [number, number][] | {
|
|
3540
|
+
type: "Polygon";
|
|
3541
|
+
coordinates: [number, number][][];
|
|
3542
|
+
} | {
|
|
3543
|
+
type: "MultiPolygon";
|
|
3544
|
+
coordinates: [number, number][][][];
|
|
3545
|
+
} | undefined;
|
|
3546
|
+
filters?: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null | undefined;
|
|
3547
|
+
};
|
|
3548
|
+
type: "getPrecomputedAggregates";
|
|
3549
|
+
}>;
|
|
3438
3550
|
declare const GetLayerSchemaMessage: z.ZodObject<{
|
|
3439
3551
|
type: z.ZodLiteral<"getLayerSchema">;
|
|
3440
3552
|
params: z.ZodString;
|
|
@@ -3473,6 +3585,7 @@ type LayersSchema = {
|
|
|
3473
3585
|
getCategoryData: Method<zInfer<typeof GetLayerCategoriesMessage>>;
|
|
3474
3586
|
getHistogramData: Method<zInfer<typeof GetLayerHistogramMessage>>;
|
|
3475
3587
|
getAggregates: Method<zInfer<typeof GetLayerCalculationMessage>>;
|
|
3588
|
+
getPrecomputedAggregates: Method<zInfer<typeof GetLayerPrecomputedCalculationMessage>>;
|
|
3476
3589
|
getLayerSchema: Method<zInfer<typeof GetLayerSchemaMessage>>;
|
|
3477
3590
|
};
|
|
3478
3591
|
listeners: {
|
|
@@ -3600,12 +3713,12 @@ type SelectionSchema = {
|
|
|
3600
3713
|
|
|
3601
3714
|
declare const SetToolMessage: z.ZodObject<{
|
|
3602
3715
|
type: z.ZodLiteral<"setTool">;
|
|
3603
|
-
params: z.ZodNullable<z.ZodEnum<["
|
|
3716
|
+
params: z.ZodNullable<z.ZodEnum<["circle", "highlighter", "line", "marker", "note", "pin", "polygon", "route", "text", "link"]>>;
|
|
3604
3717
|
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
3605
|
-
params: "text" | "note" | "
|
|
3718
|
+
params: "text" | "note" | "circle" | "highlighter" | "line" | "link" | "marker" | "pin" | "polygon" | "route" | null;
|
|
3606
3719
|
type: "setTool";
|
|
3607
3720
|
}, {
|
|
3608
|
-
params: "text" | "note" | "
|
|
3721
|
+
params: "text" | "note" | "circle" | "highlighter" | "line" | "link" | "marker" | "pin" | "polygon" | "route" | null;
|
|
3609
3722
|
type: "setTool";
|
|
3610
3723
|
}>;
|
|
3611
3724
|
declare const GetToolMessage: z.ZodObject<{
|
|
@@ -3934,12 +4047,12 @@ declare const SetToolSettingsMessage: z.ZodObject<{
|
|
|
3934
4047
|
}>;
|
|
3935
4048
|
declare const GetToolSettingsMessage: z.ZodObject<{
|
|
3936
4049
|
type: z.ZodLiteral<"getToolSettings">;
|
|
3937
|
-
params: z.ZodEnum<["
|
|
4050
|
+
params: z.ZodEnum<["circle", "highlighter", "line", "marker", "note", "pin", "polygon", "route", "text"]>;
|
|
3938
4051
|
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
3939
|
-
params: "text" | "note" | "
|
|
4052
|
+
params: "text" | "note" | "circle" | "highlighter" | "line" | "marker" | "pin" | "polygon" | "route";
|
|
3940
4053
|
type: "getToolSettings";
|
|
3941
4054
|
}, {
|
|
3942
|
-
params: "text" | "note" | "
|
|
4055
|
+
params: "text" | "note" | "circle" | "highlighter" | "line" | "marker" | "pin" | "polygon" | "route";
|
|
3943
4056
|
type: "getToolSettings";
|
|
3944
4057
|
}>;
|
|
3945
4058
|
type ToolsSchema = {
|
package/dist/handler.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z, ZodError } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { bu as UnwrapPromise, F as FeltController, z as zInfer, c as ElementChangeCallbackParams, f as ElementGroupChangeCallbackParams, E as Element, D as MapInteractionEvent, $ as LayerChangeCallbackParams, a2 as LayerGroupChangeCallbackParams, a5 as LegendItemChangeCallbackParams, at as LayerFilters, as as LayerBoundaries, ap as FilterTernary, aM as EntityNode, bl as ToolType, bj as ToolSettingsChangeEvent, bs as ViewportState, bv as UnionToIntersection, bw as PromiseOrNot } from './controller-CmThLnnL.js';
|
|
3
3
|
|
|
4
4
|
type FeltControllerFunctions = Omit<FeltController, "iframe">;
|
|
5
5
|
type Method<TRequest extends {
|
|
@@ -3435,6 +3435,118 @@ declare const GetLayerCalculationMessage: z.ZodObject<{
|
|
|
3435
3435
|
};
|
|
3436
3436
|
type: "getAggregates";
|
|
3437
3437
|
}>;
|
|
3438
|
+
declare const GetLayerPrecomputedCalculationMessage: z.ZodObject<{
|
|
3439
|
+
type: z.ZodLiteral<"getPrecomputedAggregates">;
|
|
3440
|
+
params: z.ZodObject<{
|
|
3441
|
+
layerId: z.ZodString;
|
|
3442
|
+
boundary: z.ZodOptional<z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>, z.ZodObject<{
|
|
3443
|
+
type: z.ZodLiteral<"Polygon">;
|
|
3444
|
+
coordinates: z.ZodArray<z.ZodEffects<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">, [number, number][], [number, number][]>, "many">;
|
|
3445
|
+
}, "strip", z.ZodTypeAny, {
|
|
3446
|
+
type: "Polygon";
|
|
3447
|
+
coordinates: [number, number][][];
|
|
3448
|
+
}, {
|
|
3449
|
+
type: "Polygon";
|
|
3450
|
+
coordinates: [number, number][][];
|
|
3451
|
+
}>, z.ZodObject<{
|
|
3452
|
+
type: z.ZodLiteral<"MultiPolygon">;
|
|
3453
|
+
coordinates: z.ZodArray<z.ZodArray<z.ZodEffects<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">, [number, number][], [number, number][]>, "many">, "many">;
|
|
3454
|
+
}, "strip", z.ZodTypeAny, {
|
|
3455
|
+
type: "MultiPolygon";
|
|
3456
|
+
coordinates: [number, number][][][];
|
|
3457
|
+
}, {
|
|
3458
|
+
type: "MultiPolygon";
|
|
3459
|
+
coordinates: [number, number][][][];
|
|
3460
|
+
}>, z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, "many">]>>;
|
|
3461
|
+
filters: z.ZodOptional<z.ZodUnion<[z.ZodType<FilterTernary, z.ZodTypeDef, FilterTernary>, z.ZodUnion<[z.ZodTuple<[z.ZodUnion<[z.ZodString, z.ZodNull]>, z.ZodEnum<["in", "ni"]>, z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>, "many">, z.ZodNull]>], null>, z.ZodTuple<[z.ZodUnion<[z.ZodString, z.ZodNull]>, z.ZodEnum<["lt", "gt", "le", "ge", "eq", "ne", "cn", "nc", "is", "isnt"]>, z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>], null>]>, z.ZodNull, z.ZodBoolean]>>;
|
|
3462
|
+
gridConfig: z.ZodObject<{
|
|
3463
|
+
type: z.ZodEnum<["h3"]>;
|
|
3464
|
+
resolution: z.ZodNumber;
|
|
3465
|
+
method: z.ZodEnum<["avg", "max", "min", "sum", "count"]>;
|
|
3466
|
+
attribute: z.ZodOptional<z.ZodString>;
|
|
3467
|
+
}, "strip", z.ZodTypeAny, {
|
|
3468
|
+
type: "h3";
|
|
3469
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
3470
|
+
resolution: number;
|
|
3471
|
+
attribute?: string | undefined;
|
|
3472
|
+
}, {
|
|
3473
|
+
type: "h3";
|
|
3474
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
3475
|
+
resolution: number;
|
|
3476
|
+
attribute?: string | undefined;
|
|
3477
|
+
}>;
|
|
3478
|
+
}, "strip", z.ZodTypeAny, {
|
|
3479
|
+
layerId: string;
|
|
3480
|
+
gridConfig: {
|
|
3481
|
+
type: "h3";
|
|
3482
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
3483
|
+
resolution: number;
|
|
3484
|
+
attribute?: string | undefined;
|
|
3485
|
+
};
|
|
3486
|
+
boundary?: [number, number, number, number] | [number, number][] | {
|
|
3487
|
+
type: "Polygon";
|
|
3488
|
+
coordinates: [number, number][][];
|
|
3489
|
+
} | {
|
|
3490
|
+
type: "MultiPolygon";
|
|
3491
|
+
coordinates: [number, number][][][];
|
|
3492
|
+
} | undefined;
|
|
3493
|
+
filters?: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null | undefined;
|
|
3494
|
+
}, {
|
|
3495
|
+
layerId: string;
|
|
3496
|
+
gridConfig: {
|
|
3497
|
+
type: "h3";
|
|
3498
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
3499
|
+
resolution: number;
|
|
3500
|
+
attribute?: string | undefined;
|
|
3501
|
+
};
|
|
3502
|
+
boundary?: [number, number, number, number] | [number, number][] | {
|
|
3503
|
+
type: "Polygon";
|
|
3504
|
+
coordinates: [number, number][][];
|
|
3505
|
+
} | {
|
|
3506
|
+
type: "MultiPolygon";
|
|
3507
|
+
coordinates: [number, number][][][];
|
|
3508
|
+
} | undefined;
|
|
3509
|
+
filters?: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null | undefined;
|
|
3510
|
+
}>;
|
|
3511
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
3512
|
+
params: {
|
|
3513
|
+
layerId: string;
|
|
3514
|
+
gridConfig: {
|
|
3515
|
+
type: "h3";
|
|
3516
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
3517
|
+
resolution: number;
|
|
3518
|
+
attribute?: string | undefined;
|
|
3519
|
+
};
|
|
3520
|
+
boundary?: [number, number, number, number] | [number, number][] | {
|
|
3521
|
+
type: "Polygon";
|
|
3522
|
+
coordinates: [number, number][][];
|
|
3523
|
+
} | {
|
|
3524
|
+
type: "MultiPolygon";
|
|
3525
|
+
coordinates: [number, number][][][];
|
|
3526
|
+
} | undefined;
|
|
3527
|
+
filters?: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null | undefined;
|
|
3528
|
+
};
|
|
3529
|
+
type: "getPrecomputedAggregates";
|
|
3530
|
+
}, {
|
|
3531
|
+
params: {
|
|
3532
|
+
layerId: string;
|
|
3533
|
+
gridConfig: {
|
|
3534
|
+
type: "h3";
|
|
3535
|
+
method: "avg" | "max" | "min" | "sum" | "count";
|
|
3536
|
+
resolution: number;
|
|
3537
|
+
attribute?: string | undefined;
|
|
3538
|
+
};
|
|
3539
|
+
boundary?: [number, number, number, number] | [number, number][] | {
|
|
3540
|
+
type: "Polygon";
|
|
3541
|
+
coordinates: [number, number][][];
|
|
3542
|
+
} | {
|
|
3543
|
+
type: "MultiPolygon";
|
|
3544
|
+
coordinates: [number, number][][][];
|
|
3545
|
+
} | undefined;
|
|
3546
|
+
filters?: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null | undefined;
|
|
3547
|
+
};
|
|
3548
|
+
type: "getPrecomputedAggregates";
|
|
3549
|
+
}>;
|
|
3438
3550
|
declare const GetLayerSchemaMessage: z.ZodObject<{
|
|
3439
3551
|
type: z.ZodLiteral<"getLayerSchema">;
|
|
3440
3552
|
params: z.ZodString;
|
|
@@ -3473,6 +3585,7 @@ type LayersSchema = {
|
|
|
3473
3585
|
getCategoryData: Method<zInfer<typeof GetLayerCategoriesMessage>>;
|
|
3474
3586
|
getHistogramData: Method<zInfer<typeof GetLayerHistogramMessage>>;
|
|
3475
3587
|
getAggregates: Method<zInfer<typeof GetLayerCalculationMessage>>;
|
|
3588
|
+
getPrecomputedAggregates: Method<zInfer<typeof GetLayerPrecomputedCalculationMessage>>;
|
|
3476
3589
|
getLayerSchema: Method<zInfer<typeof GetLayerSchemaMessage>>;
|
|
3477
3590
|
};
|
|
3478
3591
|
listeners: {
|
|
@@ -3600,12 +3713,12 @@ type SelectionSchema = {
|
|
|
3600
3713
|
|
|
3601
3714
|
declare const SetToolMessage: z.ZodObject<{
|
|
3602
3715
|
type: z.ZodLiteral<"setTool">;
|
|
3603
|
-
params: z.ZodNullable<z.ZodEnum<["
|
|
3716
|
+
params: z.ZodNullable<z.ZodEnum<["circle", "highlighter", "line", "marker", "note", "pin", "polygon", "route", "text", "link"]>>;
|
|
3604
3717
|
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
3605
|
-
params: "text" | "note" | "
|
|
3718
|
+
params: "text" | "note" | "circle" | "highlighter" | "line" | "link" | "marker" | "pin" | "polygon" | "route" | null;
|
|
3606
3719
|
type: "setTool";
|
|
3607
3720
|
}, {
|
|
3608
|
-
params: "text" | "note" | "
|
|
3721
|
+
params: "text" | "note" | "circle" | "highlighter" | "line" | "link" | "marker" | "pin" | "polygon" | "route" | null;
|
|
3609
3722
|
type: "setTool";
|
|
3610
3723
|
}>;
|
|
3611
3724
|
declare const GetToolMessage: z.ZodObject<{
|
|
@@ -3934,12 +4047,12 @@ declare const SetToolSettingsMessage: z.ZodObject<{
|
|
|
3934
4047
|
}>;
|
|
3935
4048
|
declare const GetToolSettingsMessage: z.ZodObject<{
|
|
3936
4049
|
type: z.ZodLiteral<"getToolSettings">;
|
|
3937
|
-
params: z.ZodEnum<["
|
|
4050
|
+
params: z.ZodEnum<["circle", "highlighter", "line", "marker", "note", "pin", "polygon", "route", "text"]>;
|
|
3938
4051
|
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
3939
|
-
params: "text" | "note" | "
|
|
4052
|
+
params: "text" | "note" | "circle" | "highlighter" | "line" | "marker" | "pin" | "polygon" | "route";
|
|
3940
4053
|
type: "getToolSettings";
|
|
3941
4054
|
}, {
|
|
3942
|
-
params: "text" | "note" | "
|
|
4055
|
+
params: "text" | "note" | "circle" | "highlighter" | "line" | "marker" | "pin" | "polygon" | "route";
|
|
3943
4056
|
type: "getToolSettings";
|
|
3944
4057
|
}>;
|
|
3945
4058
|
type ToolsSchema = {
|
package/dist/handler.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as g}from"zod";import{z as h}from"zod";import{z as L}from"zod";function t(a,T){return L.strictObject({type:L.literal(a),params:T})}function d(a,T){return L.strictObject({eventName:L.literal(a),id:L.string(),options:T})}function l(a){return L.strictObject({eventName:L.literal(a),id:L.string()})}import{z as s}from"zod";var R=s.number(),N=s.number(),A=s.object({latitude:N,longitude:R}),b=s.tuple([R,N]),F=s.object({type:s.literal("Polygon"),coordinates:s.array(s.array(b).min(4).refine(a=>a[0][0]===a[a.length-1][0]&&a[0][1]===a[a.length-1][1],"The last point of each ring must be identical to the first"))}),B=s.object({type:s.literal("MultiPolygon"),coordinates:s.array(F.shape.coordinates)}),at=s.object({type:s.literal("LineString"),coordinates:s.array(b).min(2)}),k=s.object({type:s.literal("MultiLineString"),coordinates:s.array(at.shape.coordinates)}),ue=s.number().min(1).max(23),f=s.tuple([R,N,R,N]),I=s.object({show:s.array(s.string()).optional(),hide:s.array(s.string()).optional()}),it=s.enum(["asc","desc"]),D=s.object({attribute:s.string(),direction:it});import{z as e}from"zod";var u=e.object({id:e.string(),groupId:e.string().nullable(),color:e.string(),name:e.string().nullable(),description:e.string().nullable(),attributes:e.record(e.string(),e.unknown()),interaction:e.enum(["default","locked"]).optional()}),Z=e.object({imageUrl:e.string().nullable()}),te=e.object({strokeOpacity:e.number(),strokeWidth:e.number(),strokeStyle:e.enum(["solid","dashed","dotted"])}),st=e.enum(["meter","kilometer","foot","mile"]),H=u.extend(Z.shape).extend({type:e.literal("Place"),coordinates:b,symbol:e.string(),frame:e.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.boolean()}),V=u.extend(Z.shape).extend(te.shape).extend({type:e.literal("Path"),coordinates:k.shape.coordinates,distanceMarker:e.boolean(),routingMode:e.enum(["driving","cycling","walking","flying"]).nullable(),endCaps:e.boolean()}),w=u.extend(Z.shape).extend(te.shape).extend({type:e.literal("Polygon"),coordinates:F.shape.coordinates,fillOpacity:e.number().min(0).max(1),areaMarker:e.boolean()}),J=u.extend(Z.shape).extend(te.shape).extend({type:e.literal("Circle"),center:b,radius:e.number(),radiusMarker:e.boolean(),radiusDisplayAngle:e.number(),radiusDisplayUnit:st.nullable(),fillOpacity:e.number().min(0).max(1)}),U=u.extend({type:e.literal("Marker"),coordinates:k.shape.coordinates,opacity:e.number().min(0).max(1),size:e.number().min(0).max(100),zoom:e.number().min(0).max(23)}),O=u.extend({type:e.literal("Highlighter"),coordinates:B.shape.coordinates,renderHoles:e.boolean(),opacity:e.number().min(0).max(1)}),he=e.object({position:b,rotation:e.number(),scale:e.number(),zoom:e.number().min(0).max(23),text:e.string(),align:e.enum(["left","center","right"]),style:e.enum(["italic","light","regular","caps"]),name:e.string()}),Y=u.extend(he.shape).extend({type:e.literal("Text")}),ee=u.extend(he.shape).extend({type:e.literal("Note"),widthScale:e.number().min(0)}),v=u.extend({type:e.literal("Image"),coordinates:k.shape.coordinates,imageUrl:e.string(),opacity:e.number().min(0).max(1)}).omit({color:!0}),lt=u.extend({type:e.literal("Link"),coordinates:k.shape.coordinates,url:e.string()}),E={type:!0,coordinates:!0},S={id:!0},oe=H.partial().extend(H.pick(E).shape).omit(S),q=V.partial().extend(V.pick(E).shape).omit(S),re=w.partial().extend(w.pick(E).shape).omit(S),ne=J.partial().extend(J.pick({type:!0,center:!0,radius:!0}).shape).omit(S),ae=U.partial().extend(U.pick(E).shape).omit(S),ie=O.partial().extend(O.pick(E).shape).omit(S),se=Y.partial().omit({...S,name:!0,type:!0}).extend({type:e.literal("Text"),text:e.string()}),le=ee.partial().omit({...S,name:!0,type:!0}).extend({type:e.literal("Note"),text:e.string()}),pt=v.partial().extend(v.pick({...E,imageUrl:!0}).shape).omit(S),fe=e.discriminatedUnion("type",[oe,q,re,ne,ae,ie,pt,se,le]);var hr=V.omit({coordinates:!0}),fr=w.omit({coordinates:!0});var Sr=U.omit({coordinates:!0}),xr=O.omit({coordinates:!0});var Lr=v.omit({coordinates:!0}),br=lt.omit({coordinates:!0}),x={type:!0,id:!0},mt=H.partial().extend(H.pick(x).shape),ct=V.partial().extend(V.pick(x).shape),gt=w.partial().extend(w.pick(x).shape),yt=J.partial().extend(J.pick(x).shape),dt=U.partial().extend(U.pick(x).shape),ut=O.partial().extend(O.pick(x).shape),ht=Y.partial().extend(Y.pick(x).shape).omit({name:!0}),ft=ee.partial().extend(ee.pick(x).shape).omit({name:!0}),St=v.partial().extend(v.pick(x).shape),Se=e.discriminatedUnion("type",[mt,ct,gt,yt,dt,ut,ht,ft,St]),xe=e.object({ids:e.array(e.string()).optional()}),Le=e.object({ids:e.array(e.string()).optional()});var xt=t("getElement",h.string()),Lt=t("getElementGeometry",h.string()),bt=t("getElements",xe.optional()),Mt=t("getElementGroup",h.string()),Ct=t("getElementGroups",Le.optional()),Gt=t("setElementGroupVisibility",I),It=d("onElementChange",h.object({id:h.string()})),Tt=l("onElementCreate"),Et=l("onElementCreateEnd"),zt=d("onElementDelete",h.object({id:h.string()})),Pt=d("onElementGroupChange",h.object({id:h.string()})),Ft=t("createElement",fe),kt=t("updateElement",Se),Vt=t("deleteElement",h.string()),be={methods:[xt,Lt,bt,Mt,Ct,Gt,Ft,kt,Vt],listeners:[It,Tt,Et,zt,Pt]};var wt=l("onPointerClick"),Ut=l("onPointerMove"),Me={methods:null,listeners:[wt,Ut]};import{z as n}from"zod";import{z as i}from"zod";var Ot=i.enum(["in","ni"]),vt=i.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),Vr=i.enum(["and","or"]),Ce=i.union([i.number(),i.string(),i.boolean(),i.null()]),Ge=i.string().or(i.null()),jt=i.tuple([Ge,Ot,i.array(Ce).or(i.null())]),Rt=i.tuple([Ge,vt,Ce]),pe=i.union([jt,Rt]),me=i.tuple([i.lazy(()=>i.union([me,pe,i.null(),i.boolean()])),i.enum(["and","or"]),i.lazy(()=>i.union([me,pe,i.null(),i.boolean()]))]),M=i.union([me,pe,i.null(),i.boolean()]),C=i.union([f,F,B,i.array(b)]);import{z as r}from"zod";var Ie=r.enum(["avg","max","min","sum","median"]),Nt=r.object({method:Ie,attribute:r.string()}),At=r.object({methods:r.array(r.union([Ie,r.literal("count")])),attribute:r.string().optional()}),Te=r.object({boundary:C.optional(),filters:M.optional(),aggregation:Nt.optional()}),Ee=r.object({layerId:r.string(),attribute:r.string(),limit:r.number().optional(),boundary:C.optional(),filters:M.optional(),values:Te.optional()}),vr=r.object({key:r.union([r.number(),r.string(),r.boolean()]),value:r.number().nullable()}),Bt=r.object({type:r.literal("equal-intervals"),count:r.number()}),Dt=r.object({type:r.literal("time-interval"),interval:r.enum(["hour","day","week","month","year"])}),ze=r.object({layerId:r.string(),attribute:r.string(),steps:r.union([Bt,Dt,r.array(r.number())]),boundary:C.optional(),filters:M.optional(),values:Te.optional()}),jr=r.object({min:r.number(),max:r.number(),value:r.number()}),Pe=r.object({layerId:r.string(),boundary:C.optional(),filters:M.optional(),aggregation:At});import{z as o}from"zod";var Br=o.enum(["processing","completed","failed","incomplete"]),Fe=o.object({type:o.literal("geoJsonUrl"),url:o.string().url(),refreshInterval:o.number().min(250).max(5*60*1e3).nullable().optional()}),ke=o.object({type:o.literal("geoJsonData"),data:o.object({}).passthrough().or(o.instanceof(ArrayBuffer))}),Ve=o.object({type:o.literal("geoJsonFile"),file:o.instanceof(File)}),we=o.object({id:o.string(),style:o.object({}).passthrough().optional(),shownInLegend:o.boolean().optional(),name:o.string().optional(),caption:o.string().optional(),description:o.string().optional(),bounds:f.optional(),source:o.union([Fe,ke,Ve]).optional()}),Ue=o.object({ids:o.array(o.string()).optional()}),Oe=o.object({ids:o.array(o.string()).optional()}),z=o.object({id:o.string(),layerId:o.string()}),ve=o.object({ids:z.array().optional(),layerIds:o.string().array().optional()}),je=o.object({layerIds:o.array(o.string()).optional(),areaQuery:o.union([o.object({coordinates:A}),o.object({boundary:f})]).optional()}),Ht=o.object({Point:o.object({}).passthrough().optional(),Line:o.object({}).passthrough().optional(),Polygon:o.object({}).passthrough().optional()}),Re=o.object({source:o.union([Fe,ke,Ve]),name:o.string(),bounds:f.optional(),caption:o.string().optional(),description:o.string().optional(),geometryStyles:Ht.optional()});var Jt=t("getLayer",n.string()),Zt=t("getLayers",Ue.optional()),qt=t("setLayerVisibility",I),Wt=d("onLayerChange",n.object({id:n.string()})),_t=t("setLayerStyle",n.object({id:n.string(),style:n.object({}).passthrough()})),Qt=t("setLayerLegendVisibility",I),$t=t("createLayersFromGeoJson",Re),Kt=t("updateLayer",we),Xt=t("deleteLayer",n.string()),Yt=t("getLayerGroup",n.string()),eo=t("getLayerGroups",Oe.optional()),to=t("setLayerGroupVisibility",I),oo=t("setLayerGroupLegendVisibility",I),ro=d("onLayerGroupChange",n.object({id:n.string()})),no=t("getLegendItem",z),ao=t("getLegendItems",ve.optional()),io=d("onLegendItemChange",z),so=t("setLegendItemVisibility",n.object({show:z.array().optional(),hide:z.array().optional()})),lo=t("getLayerFilters",n.string()),po=t("setLayerFilters",n.object({layerId:n.string(),filters:M,note:n.string().optional()})),mo=d("onLayerFiltersChange",n.object({layerId:n.string()})),co=t("getLayerBoundaries",n.string()),go=t("setLayerBoundary",n.object({layerIds:n.array(n.string()),boundary:C.nullable()})),yo=d("onLayerBoundariesChange",n.object({layerId:n.string()})),uo=t("getRenderedFeatures",je.optional()),ho=t("getFeature",n.object({id:n.string().or(n.number()),layerId:n.string()})),fo=t("getFeatures",n.object({layerId:n.string(),filters:M.optional(),sorting:D.optional(),boundary:C.optional(),search:n.string().optional(),pagination:n.string().optional().nullish()})),So=t("getGeoJsonFeature",n.object({id:n.string().or(n.number()),layerId:n.string()})),xo=t("getCategoryData",Ee),Lo=t("getHistogramData",ze),bo=t("getAggregates",Pe),Mo=t("getLayerSchema",n.string()),Ne={methods:[Jt,Zt,qt,_t,Qt,$t,Xt,Kt,Yt,eo,to,oo,no,ao,so,lo,po,co,go,uo,ho,fo,So,xo,Lo,bo,Mo],listeners:[Wt,ro,io,mo,yo]};import{z as Co}from"zod";var Go=t("getMapDetails",Co.undefined()),Ae={methods:[Go],listeners:[]};import{z as W}from"zod";import{z as G}from"zod";var Be=G.object({id:G.string().or(G.number()),layerId:G.string(),showPopup:G.boolean().optional(),fitViewport:G.boolean().or(G.object({maxZoom:G.number()})).optional()});var Io=t("getSelection",W.undefined()),To=l("onSelectionChange"),Eo=t("selectFeature",Be),zo=t("clearSelection",W.object({features:W.boolean().optional(),elements:W.boolean().optional()}).optional()),De={methods:[Io,Eo,zo],listeners:[To]};import{z as Ro}from"zod";import{z as p}from"zod";var He=["pin","line","route","polygon","circle","marker","highlighter","text","note"],Je=p.enum([...He,"link"]),Ze=p.enum(He),Po=oe.pick({color:!0,symbol:!0,frame:!0}).extend({afterCreation:p.enum(["enter name","add another","select"])}).required(),Fo=q.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),ko=q.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),Vo=re.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),wo=ne.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),Uo=ae.pick({color:!0,opacity:!0,size:!0}).required(),Oo=ie.pick({color:!0,opacity:!0,renderHoles:!0}).extend({size:p.number().min(0).max(200)}).required(),vo=se.pick({color:!0,align:!0,style:!0}).required(),jo=le.pick({color:!0,align:!0,style:!0}).required(),qe=p.discriminatedUnion("tool",[Po.partial().extend({tool:p.literal("pin")}),Fo.partial().extend({tool:p.literal("line")}),ko.partial().extend({tool:p.literal("route")}),Vo.partial().extend({tool:p.literal("polygon")}),wo.partial().extend({tool:p.literal("circle")}),Uo.partial().extend({tool:p.literal("marker")}),Oo.partial().extend({tool:p.literal("highlighter")}),vo.partial().extend({tool:p.literal("text")}),jo.partial().extend({tool:p.literal("note")})]);var No=t("setTool",Je.nullable()),Ao=t("getTool",Ro.undefined()),Bo=l("onToolChange"),Do=t("setToolSettings",qe),Ho=t("getToolSettings",Ze),Jo=l("onToolSettingsChange"),We={methods:[No,Ao,Do,Ho],listeners:[Bo,Jo]};import{z as ce}from"zod";import{z as c}from"zod";var _e=c.object({showLegend:c.boolean().optional(),cooperativeGestures:c.boolean().optional(),fullScreenButton:c.boolean().optional(),geolocation:c.boolean().optional(),zoomControls:c.boolean().optional(),scaleBar:c.boolean().optional()}),Qe=c.object({featureSelectPanel:c.boolean().optional(),featureHoverPanel:c.boolean().optional(),elementSelectPanel:c.boolean().optional(),linkClickOpen:c.boolean().optional(),imageLightboxOpen:c.boolean().optional()});var Zo=t("updateUiControls",_e),qo=t("setOnMapInteractionsUi",Qe),Wo=t("showLayerDataTable",ce.object({layerId:ce.string(),sorting:D.optional()}).optional()),_o=t("hideLayerDataTable",ce.undefined()),$e={methods:[Zo,qo,Wo,_o],listeners:null};import{z as et}from"zod";import{z as Q}from"zod";var _=Q.object({center:A,zoom:ue}),Ke=Q.object({center:_.shape.center.optional(),zoom:_.shape.zoom.optional()}),Xe=Q.object({minZoom:_.shape.zoom.nullish(),maxZoom:_.shape.zoom.nullish(),bounds:f.nullish()}).nullable(),Ye=Q.object({bounds:f});var Qo=t("getViewport",et.undefined()),$o=t("setViewport",Ke),Ko=t("getViewportConstraints",et.undefined()),Xo=t("setViewportConstraints",Xe),Yo=t("fitViewportToBounds",Ye),er=l("onViewportMove"),tr=l("onViewportMoveEnd"),or=l("onMapIdle"),tt={methods:[$o,Qo,Ko,Xo,Yo],listeners:[er,tr,or]};var ge=[$e,tt,Ne,be,De,Me,We,Ae];function Nn(a,T,ye){let $=new Map;async function de(y){if(!sr.safeParse(y.data).success){ye?.onUnknownMessage?.(y.data);return}let j=nt.safeParse(y.data);if(!j.success){ye?.onInvalidMessage?.(y.data,j.error),y.ports[0]?.postMessage(ot(j.error.message));return}let{data:m}=j;if(m.type==="felt.ready")y.ports[0]?.postMessage(!0);else if(m.type==="felt.addListener"){if(m.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let P="options"in m.event?{options:"options"in m.event?m.event.options:void 0,handler:X=>{y.ports[0]?.postMessage(X)}}:{handler:X=>{y.ports[0]?.postMessage(X)}},K=T.listeners[m.event.eventName](P);$.set(m.event.id,K)}else if(m.type==="felt.removeListener")$.get(m.id)?.(),$.delete(m.id);else try{let P=T.methods[m.type],K=await P(m.params);y.ports[0]?.postMessage(K)}catch(P){y.ports[0]?.postMessage(ot(P))}}return a.addEventListener("message",de),()=>{a.removeEventListener("message",de)}}var rt={methods:ge.map(a=>a.methods??[]).flat(),listeners:ge.map(a=>a.listeners??[]).flat()},rr=g.discriminatedUnion("eventName",[g.strictObject({eventName:g.literal("")}),...rt.listeners]),nr=g.strictObject({type:g.literal("felt.addListener"),event:rr}),ar=g.strictObject({type:g.literal("felt.removeListener"),id:g.string()}),ir=g.strictObject({type:g.literal("felt.ready")}),nt=g.discriminatedUnion("type",[ir,nr,ar,...rt.methods]),sr=g.object({type:g.enum(nt.options.map(a=>a.shape.type.value))});function ot(a){return{__error__:lr(a)}}function lr(a){return a instanceof Error?a.message:typeof a=="object"&&a!==null&&"message"in a?String(a.message):typeof a=="string"?a:"Unknown error"}export{Nn as createMessageHandler};
|
|
1
|
+
import{z as g}from"zod";import{z as h}from"zod";import{z as M}from"zod";function t(a,T){return M.strictObject({type:M.literal(a),params:T})}function d(a,T){return M.strictObject({eventName:M.literal(a),id:M.string(),options:T})}function l(a){return M.strictObject({eventName:M.literal(a),id:M.string()})}import{z as s}from"zod";var R=s.number(),N=s.number(),A=s.object({latitude:N,longitude:R}),C=s.tuple([R,N]),F=s.object({type:s.literal("Polygon"),coordinates:s.array(s.array(C).min(4).refine(a=>a[0][0]===a[a.length-1][0]&&a[0][1]===a[a.length-1][1],"The last point of each ring must be identical to the first"))}),B=s.object({type:s.literal("MultiPolygon"),coordinates:s.array(F.shape.coordinates)}),it=s.object({type:s.literal("LineString"),coordinates:s.array(C).min(2)}),k=s.object({type:s.literal("MultiLineString"),coordinates:s.array(it.shape.coordinates)}),ue=s.number().min(1).max(23),f=s.tuple([R,N,R,N]),I=s.object({show:s.array(s.string()).optional(),hide:s.array(s.string()).optional()}),st=s.enum(["asc","desc"]),D=s.object({attribute:s.string(),direction:st});import{z as e}from"zod";var u=e.object({id:e.string(),groupId:e.string().nullable(),color:e.string(),name:e.string().nullable(),description:e.string().nullable(),attributes:e.record(e.string(),e.unknown()),interaction:e.enum(["default","locked"]).optional()}),Z=e.object({imageUrl:e.string().nullable()}),te=e.object({strokeOpacity:e.number(),strokeWidth:e.number(),strokeStyle:e.enum(["solid","dashed","dotted"])}),lt=e.enum(["meter","kilometer","foot","mile"]),H=u.extend(Z.shape).extend({type:e.literal("Place"),coordinates:C,symbol:e.string(),frame:e.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.boolean()}),V=u.extend(Z.shape).extend(te.shape).extend({type:e.literal("Path"),coordinates:k.shape.coordinates,distanceMarker:e.boolean(),routingMode:e.enum(["driving","cycling","walking","flying"]).nullable(),endCaps:e.boolean()}),w=u.extend(Z.shape).extend(te.shape).extend({type:e.literal("Polygon"),coordinates:F.shape.coordinates,fillOpacity:e.number().min(0).max(1),areaMarker:e.boolean()}),J=u.extend(Z.shape).extend(te.shape).extend({type:e.literal("Circle"),center:C,radius:e.number(),radiusMarker:e.boolean(),radiusDisplayAngle:e.number(),radiusDisplayUnit:lt.nullable(),fillOpacity:e.number().min(0).max(1)}),U=u.extend({type:e.literal("Marker"),coordinates:k.shape.coordinates,opacity:e.number().min(0).max(1),size:e.number().min(0).max(100),zoom:e.number().min(0).max(23)}),O=u.extend({type:e.literal("Highlighter"),coordinates:B.shape.coordinates,renderHoles:e.boolean(),opacity:e.number().min(0).max(1)}),he=e.object({position:C,rotation:e.number(),scale:e.number(),zoom:e.number().min(0).max(23),text:e.string(),align:e.enum(["left","center","right"]),style:e.enum(["italic","light","regular","caps"]),name:e.string()}),Y=u.extend(he.shape).extend({type:e.literal("Text")}),ee=u.extend(he.shape).extend({type:e.literal("Note"),widthScale:e.number().min(0)}),v=u.extend({type:e.literal("Image"),coordinates:k.shape.coordinates,imageUrl:e.string(),opacity:e.number().min(0).max(1)}).omit({color:!0}),pt=u.extend({type:e.literal("Link"),coordinates:k.shape.coordinates,url:e.string()}),P={type:!0,coordinates:!0},S={id:!0},oe=H.partial().extend(H.pick(P).shape).omit(S),q=V.partial().extend(V.pick(P).shape).omit(S),re=w.partial().extend(w.pick(P).shape).omit(S),ne=J.partial().extend(J.pick({type:!0,center:!0,radius:!0}).shape).omit(S),ae=U.partial().extend(U.pick(P).shape).omit(S),ie=O.partial().extend(O.pick(P).shape).omit(S),se=Y.partial().omit({...S,name:!0,type:!0}).extend({type:e.literal("Text"),text:e.string()}),le=ee.partial().omit({...S,name:!0,type:!0}).extend({type:e.literal("Note"),text:e.string()}),ct=v.partial().extend(v.pick({...P,imageUrl:!0}).shape).omit(S),fe=e.discriminatedUnion("type",[oe,q,re,ne,ae,ie,ct,se,le]);var Mr=V.omit({coordinates:!0}),Cr=w.omit({coordinates:!0});var Gr=U.omit({coordinates:!0}),Ir=O.omit({coordinates:!0});var Tr=v.omit({coordinates:!0}),Pr=pt.omit({coordinates:!0}),x={type:!0,id:!0},mt=H.partial().extend(H.pick(x).shape),gt=V.partial().extend(V.pick(x).shape),yt=w.partial().extend(w.pick(x).shape),dt=J.partial().extend(J.pick(x).shape),ut=U.partial().extend(U.pick(x).shape),ht=O.partial().extend(O.pick(x).shape),ft=Y.partial().extend(Y.pick(x).shape).omit({name:!0}),St=ee.partial().extend(ee.pick(x).shape).omit({name:!0}),xt=v.partial().extend(v.pick(x).shape),Se=e.discriminatedUnion("type",[mt,gt,yt,dt,ut,ht,ft,St,xt]),xe=e.object({ids:e.array(e.string()).optional()}),Le=e.object({ids:e.array(e.string()).optional()});var Lt=t("getElement",h.string()),bt=t("getElementGeometry",h.string()),Mt=t("getElements",xe.optional()),Ct=t("getElementGroup",h.string()),Gt=t("getElementGroups",Le.optional()),It=t("setElementGroupVisibility",I),Tt=d("onElementChange",h.object({id:h.string()})),Pt=l("onElementCreate"),Et=l("onElementCreateEnd"),zt=d("onElementDelete",h.object({id:h.string()})),Ft=d("onElementGroupChange",h.object({id:h.string()})),kt=t("createElement",fe),Vt=t("updateElement",Se),wt=t("deleteElement",h.string()),be={methods:[Lt,bt,Mt,Ct,Gt,It,kt,Vt,wt],listeners:[Tt,Pt,Et,zt,Ft]};var Ut=l("onPointerClick"),Ot=l("onPointerMove"),Me={methods:null,listeners:[Ut,Ot]};import{z as n}from"zod";import{z as i}from"zod";var vt=i.enum(["in","ni"]),jt=i.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),Rr=i.enum(["and","or"]),Ce=i.union([i.number(),i.string(),i.boolean(),i.null()]),Ge=i.string().or(i.null()),Rt=i.tuple([Ge,vt,i.array(Ce).or(i.null())]),Nt=i.tuple([Ge,jt,Ce]),pe=i.union([Rt,Nt]),ce=i.tuple([i.lazy(()=>i.union([ce,pe,i.null(),i.boolean()])),i.enum(["and","or"]),i.lazy(()=>i.union([ce,pe,i.null(),i.boolean()]))]),L=i.union([ce,pe,i.null(),i.boolean()]),b=i.union([f,F,B,i.array(C)]);import{z as r}from"zod";var Ie=r.enum(["avg","max","min","sum","median"]),At=r.enum(["avg","max","min","sum","count"]),Bt=r.object({method:Ie,attribute:r.string()}),Dt=r.object({methods:r.array(r.union([Ie,r.literal("count")])),attribute:r.string().optional()}),Te=r.object({boundary:b.optional(),filters:L.optional(),aggregation:Bt.optional()}),Pe=r.object({layerId:r.string(),attribute:r.string(),limit:r.number().optional(),boundary:b.optional(),filters:L.optional(),values:Te.optional()}),Dr=r.object({key:r.union([r.number(),r.string(),r.boolean()]),value:r.number().nullable()}),Ht=r.object({type:r.literal("equal-intervals"),count:r.number()}),Jt=r.object({type:r.literal("time-interval"),interval:r.enum(["hour","day","week","month","year"])}),Ee=r.object({layerId:r.string(),attribute:r.string(),steps:r.union([Ht,Jt,r.array(r.number())]),boundary:b.optional(),filters:L.optional(),values:Te.optional()}),Hr=r.object({min:r.number(),max:r.number(),value:r.number()}),ze=r.object({layerId:r.string(),boundary:b.optional(),filters:L.optional(),aggregation:Dt}),Zt=r.enum(["h3"]),qt=r.object({type:Zt,resolution:r.number(),method:At,attribute:r.string().optional()}),Fe=r.object({layerId:r.string(),boundary:b.optional(),filters:L.optional(),gridConfig:qt});import{z as o}from"zod";var Wr=o.enum(["processing","completed","failed","incomplete"]),ke=o.object({type:o.literal("geoJsonUrl"),url:o.string().url(),refreshInterval:o.number().min(250).max(5*60*1e3).nullable().optional()}),Ve=o.object({type:o.literal("geoJsonData"),data:o.object({}).passthrough().or(o.instanceof(ArrayBuffer))}),we=o.object({type:o.literal("geoJsonFile"),file:o.instanceof(File)}),Ue=o.object({id:o.string(),style:o.object({}).passthrough().optional(),shownInLegend:o.boolean().optional(),name:o.string().optional(),caption:o.string().optional(),description:o.string().optional(),bounds:f.optional(),source:o.union([ke,Ve,we]).optional()}),Oe=o.object({ids:o.array(o.string()).optional()}),ve=o.object({ids:o.array(o.string()).optional()}),E=o.object({id:o.string(),layerId:o.string()}),je=o.object({ids:E.array().optional(),layerIds:o.string().array().optional()}),Re=o.object({layerIds:o.array(o.string()).optional(),areaQuery:o.union([o.object({coordinates:A}),o.object({boundary:f})]).optional()}),Wt=o.object({Point:o.object({}).passthrough().optional(),Line:o.object({}).passthrough().optional(),Polygon:o.object({}).passthrough().optional()}),Ne=o.object({source:o.union([ke,Ve,we]),name:o.string(),bounds:f.optional(),caption:o.string().optional(),description:o.string().optional(),geometryStyles:Wt.optional()});var _t=t("getLayer",n.string()),Qt=t("getLayers",Oe.optional()),$t=t("setLayerVisibility",I),Kt=d("onLayerChange",n.object({id:n.string()})),Xt=t("setLayerStyle",n.object({id:n.string(),style:n.object({}).passthrough()})),Yt=t("setLayerLegendVisibility",I),eo=t("createLayersFromGeoJson",Ne),to=t("updateLayer",Ue),oo=t("deleteLayer",n.string()),ro=t("getLayerGroup",n.string()),no=t("getLayerGroups",ve.optional()),ao=t("setLayerGroupVisibility",I),io=t("setLayerGroupLegendVisibility",I),so=d("onLayerGroupChange",n.object({id:n.string()})),lo=t("getLegendItem",E),po=t("getLegendItems",je.optional()),co=d("onLegendItemChange",E),mo=t("setLegendItemVisibility",n.object({show:E.array().optional(),hide:E.array().optional()})),go=t("getLayerFilters",n.string()),yo=t("setLayerFilters",n.object({layerId:n.string(),filters:L,note:n.string().optional()})),uo=d("onLayerFiltersChange",n.object({layerId:n.string()})),ho=t("getLayerBoundaries",n.string()),fo=t("setLayerBoundary",n.object({layerIds:n.array(n.string()),boundary:b.nullable()})),So=d("onLayerBoundariesChange",n.object({layerId:n.string()})),xo=t("getRenderedFeatures",Re.optional()),Lo=t("getFeature",n.object({id:n.string().or(n.number()),layerId:n.string()})),bo=t("getFeatures",n.object({layerId:n.string(),filters:L.optional(),sorting:D.optional(),boundary:b.optional(),search:n.string().optional(),pagination:n.string().optional().nullish()})),Mo=t("getGeoJsonFeature",n.object({id:n.string().or(n.number()),layerId:n.string()})),Co=t("getCategoryData",Pe),Go=t("getHistogramData",Ee),Io=t("getAggregates",ze),To=t("getPrecomputedAggregates",Fe),Po=t("getLayerSchema",n.string()),Ae={methods:[_t,Qt,$t,Xt,Yt,eo,oo,to,ro,no,ao,io,lo,po,mo,go,yo,ho,fo,xo,Lo,bo,Mo,Co,Go,Io,To,Po],listeners:[Kt,so,co,uo,So]};import{z as Eo}from"zod";var zo=t("getMapDetails",Eo.undefined()),Be={methods:[zo],listeners:[]};import{z as W}from"zod";import{z as G}from"zod";var De=G.object({id:G.string().or(G.number()),layerId:G.string(),showPopup:G.boolean().optional(),fitViewport:G.boolean().or(G.object({maxZoom:G.number()})).optional()});var Fo=t("getSelection",W.undefined()),ko=l("onSelectionChange"),Vo=t("selectFeature",De),wo=t("clearSelection",W.object({features:W.boolean().optional(),elements:W.boolean().optional()}).optional()),He={methods:[Fo,Vo,wo],listeners:[ko]};import{z as Jo}from"zod";import{z as p}from"zod";var Je=["circle","highlighter","line","marker","note","pin","polygon","route","text"],Uo=[...Je,"link"],Ze=p.enum(Uo),qe=p.enum(Je),Oo=oe.pick({color:!0,symbol:!0,frame:!0}).extend({afterCreation:p.enum(["enter name","add another","select"])}).required(),vo=q.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),jo=q.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),Ro=re.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),No=ne.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),Ao=ae.pick({color:!0,opacity:!0,size:!0}).required(),Bo=ie.pick({color:!0,opacity:!0,renderHoles:!0}).extend({size:p.number().min(0).max(200)}).required(),Do=se.pick({color:!0,align:!0,style:!0}).required(),Ho=le.pick({color:!0,align:!0,style:!0}).required(),We=p.discriminatedUnion("tool",[Oo.partial().extend({tool:p.literal("pin")}),vo.partial().extend({tool:p.literal("line")}),jo.partial().extend({tool:p.literal("route")}),Ro.partial().extend({tool:p.literal("polygon")}),No.partial().extend({tool:p.literal("circle")}),Ao.partial().extend({tool:p.literal("marker")}),Bo.partial().extend({tool:p.literal("highlighter")}),Do.partial().extend({tool:p.literal("text")}),Ho.partial().extend({tool:p.literal("note")})]);var Zo=t("setTool",Ze.nullable()),qo=t("getTool",Jo.undefined()),Wo=l("onToolChange"),_o=t("setToolSettings",We),Qo=t("getToolSettings",qe),$o=l("onToolSettingsChange"),_e={methods:[Zo,qo,_o,Qo],listeners:[Wo,$o]};import{z as me}from"zod";import{z as m}from"zod";var Qe=m.object({showLegend:m.boolean().optional(),cooperativeGestures:m.boolean().optional(),fullScreenButton:m.boolean().optional(),geolocation:m.boolean().optional(),zoomControls:m.boolean().optional(),scaleBar:m.boolean().optional()}),$e=m.object({featureSelectPanel:m.boolean().optional(),featureHoverPanel:m.boolean().optional(),elementSelectPanel:m.boolean().optional(),linkClickOpen:m.boolean().optional(),imageLightboxOpen:m.boolean().optional()});var Ko=t("updateUiControls",Qe),Xo=t("setOnMapInteractionsUi",$e),Yo=t("showLayerDataTable",me.object({layerId:me.string(),sorting:D.optional()}).optional()),er=t("hideLayerDataTable",me.undefined()),Ke={methods:[Ko,Xo,Yo,er],listeners:null};import{z as tt}from"zod";import{z as Q}from"zod";var _=Q.object({center:A,zoom:ue}),Xe=Q.object({center:_.shape.center.optional(),zoom:_.shape.zoom.optional()}),Ye=Q.object({minZoom:_.shape.zoom.nullish(),maxZoom:_.shape.zoom.nullish(),bounds:f.nullish()}).nullable(),et=Q.object({bounds:f});var tr=t("getViewport",tt.undefined()),or=t("setViewport",Xe),rr=t("getViewportConstraints",tt.undefined()),nr=t("setViewportConstraints",Ye),ar=t("fitViewportToBounds",et),ir=l("onViewportMove"),sr=l("onViewportMoveEnd"),lr=l("onMapIdle"),ot={methods:[or,tr,rr,nr,ar],listeners:[ir,sr,lr]};var ge=[Ke,ot,Ae,be,He,Me,_e,Be];function Zn(a,T,ye){let $=new Map;async function de(y){if(!yr.safeParse(y.data).success){ye?.onUnknownMessage?.(y.data);return}let j=at.safeParse(y.data);if(!j.success){ye?.onInvalidMessage?.(y.data,j.error),y.ports[0]?.postMessage(rt(j.error.message));return}let{data:c}=j;if(c.type==="felt.ready")y.ports[0]?.postMessage(!0);else if(c.type==="felt.addListener"){if(c.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let z="options"in c.event?{options:"options"in c.event?c.event.options:void 0,handler:X=>{y.ports[0]?.postMessage(X)}}:{handler:X=>{y.ports[0]?.postMessage(X)}},K=T.listeners[c.event.eventName](z);$.set(c.event.id,K)}else if(c.type==="felt.removeListener")$.get(c.id)?.(),$.delete(c.id);else try{let z=T.methods[c.type],K=await z(c.params);y.ports[0]?.postMessage(K)}catch(z){y.ports[0]?.postMessage(rt(z))}}return a.addEventListener("message",de),()=>{a.removeEventListener("message",de)}}var nt={methods:ge.map(a=>a.methods??[]).flat(),listeners:ge.map(a=>a.listeners??[]).flat()},pr=g.discriminatedUnion("eventName",[g.strictObject({eventName:g.literal("")}),...nt.listeners]),cr=g.strictObject({type:g.literal("felt.addListener"),event:pr}),mr=g.strictObject({type:g.literal("felt.removeListener"),id:g.string()}),gr=g.strictObject({type:g.literal("felt.ready")}),at=g.discriminatedUnion("type",[gr,cr,mr,...nt.methods]),yr=g.object({type:g.enum(at.options.map(a=>a.shape.type.value))});function rt(a){return{__error__:dr(a)}}function dr(a){return a instanceof Error?a.message:typeof a=="object"&&a!==null&&"message"in a?String(a.message):typeof a=="string"?a:"Unknown error"}export{Zn as createMessageHandler};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feltmaps/js-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0-next.0",
|
|
4
4
|
"description": "An SDK for Felt maps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"felt",
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"check:types": "tsc",
|
|
71
71
|
"check:unused": "knip",
|
|
72
72
|
"check": "npm run check:client-bundle && npm run check:format && npm run check:api && npm run check:unused && npm run check:types && npm run check:test && npm run check:docs",
|
|
73
|
+
"format:write": "prettier --write .",
|
|
73
74
|
"ci": "npm run build && npm run check",
|
|
74
75
|
"enter-prerelease": "git checkout prerelease && git pull && changeset pre enter next",
|
|
75
76
|
"exit-prerelease": "git checkout prerelease && git pull && changeset pre exit",
|