@feltmaps/js-sdk 1.5.0-next.11 → 1.5.0-next.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.cjs +1 -1
- package/dist/client.d.cts +41 -3
- package/dist/client.d.ts +41 -3
- package/dist/client.js +1 -1
- package/dist/handler.cjs +1 -1
- package/dist/handler.d.cts +251 -3
- package/dist/handler.d.ts +251 -3
- package/dist/handler.js +1 -1
- package/dist/{types-CI-GVo6N.d.cts → types-PSY3LPGC.d.cts} +159 -7
- package/dist/{types-CI-GVo6N.d.ts → types-PSY3LPGC.d.ts} +159 -7
- package/handler.d.ts +251 -3
- package/handler.js +1 -1
- package/package.json +1 -1
- package/{types-CI-GVo6N.d.ts → types-PSY3LPGC.d.ts} +159 -7
package/dist/client.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var c=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var b=(e,r)=>{for(var n in r)c(e,n,{get:r[n],enumerable:!0})},I=(e,r,n,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of V(r))!M.call(e,s)&&s!==n&&c(e,s,{get:()=>r[s],enumerable:!(a=S(r,s))||a.enumerable});return e};var f=e=>I(c({},"__esModule",{value:!0}),e);var K={};b(K,{Felt:()=>G});module.exports=f(K);function o(e,r){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:r,id:m,options:i}:{eventName:r,id:m}},"*",[a.port2]),a.port1.onmessage=d=>{s(d.data)},()=>{a.port1.onmessage=null,a.port1.close(),a.port2.close(),e.postMessage({type:"felt.removeListener",id:m},"*")}}}function t(e,r,n){return async a=>{let s=new MessageChannel,i=a&&n?await n(a):a;return e.postMessage({type:r,params:i},"*",[s.port2]),new Promise((m,d)=>{s.port1.onmessage=y=>{y.data&&typeof y.data=="object"&&"__error__"in y.data?d(new Error(y.data.__error__)):m(y.data),s.port1.close(),s.port2.close()}})}}var u=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:o(e,"onElementChange"),onElementCreate:o(e,"onElementCreate"),onElementCreateEnd:o(e,"onElementCreateEnd"),onElementDelete:o(e,"onElementDelete"),onElementGroupChange:o(e,"onElementGroupChange"),createElement:t(e,"createElement"),updateElement:t(e,"updateElement"),deleteElement:t(e,"deleteElement")});var C=e=>({onPointerClick:o(e,"onPointerClick"),onPointerMove:o(e,"onPointerMove")});var L=e=>({getLayer:t(e,"getLayer"),getLayers:t(e,"getLayers"),setLayerVisibility:t(e,"setLayerVisibility"),setLayerStyle:t(e,"setLayerStyle"),setLayerLegendVisibility:t(e,"setLayerLegendVisibility"),onLayerChange:o(e,"onLayerChange"),createLayer:t(e,"createLayer",async r=>"url"in r.source||"arrayBuffer"in r.source?r:{...r,source:{type:"application/geo+json",name:r.source.name,arrayBuffer:await r.source.file.arrayBuffer()}}),deleteLayer:t(e,"deleteLayer"),getLayerGroup:t(e,"getLayerGroup"),getLayerGroups:t(e,"getLayerGroups"),setLayerGroupVisibility:t(e,"setLayerGroupVisibility"),setLayerGroupLegendVisibility:t(e,"setLayerGroupLegendVisibility"),onLayerGroupChange:o(e,"onLayerGroupChange"),getLegendItem:t(e,"getLegendItem"),getLegendItems:t(e,"getLegendItems"),setLegendItemVisibility:t(e,"setLegendItemVisibility"),onLegendItemChange:o(e,"onLegendItemChange"),getLayerFilters:t(e,"getLayerFilters"),setLayerFilters:t(e,"setLayerFilters"),onLayerFiltersChange:o(e,"onLayerFiltersChange"),getRenderedFeatures:t(e,"getRenderedFeatures"),getFeature:t(e,"getFeature"),getGeoJsonFeature:t(e,"getGeoJsonFeature"),getCategoryData:t(e,"getCategoryData"),getHistogramData:t(e,"getHistogramData"),getAggregates:t(e,"getAggregates"),getLayerSchema:t(e,"getLayerSchema")});var h=e=>({getMapDetails:t(e,"getMapDetails")});var T=e=>({onSelectionChange:o(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:o(e,"onToolChange"),setToolSettings:t(e,"setToolSettings"),getToolSettings:t(e,"getToolSettings"),onToolSettingsChange:o(e,"onToolSettingsChange")});var v=e=>({updateUiControls:t(e,"updateUiControls"),setOnMapInteractionsUi:t(e,"setOnMapInteractionsUi"),showLayerDataTable:t(e,"showLayerDataTable"),hideLayerDataTable:t(e,"hideLayerDataTable")});var P=e=>({getViewport:t(e,"getViewport"),setViewport:t(e,"setViewport"),getViewportConstraints:t(e,"getViewportConstraints"),setViewportConstraints:t(e,"setViewportConstraints"),fitViewportToBounds:t(e,"fitViewportToBounds"),onViewportMove:o(e,"onViewportMove"),onViewportMoveEnd:o(e,"onViewportMoveEnd"),onMapIdle:o(e,"onMapIdle")});function F(e){return{iframe:null,...P(e),...v(e),...L(e),...u(e),...T(e),...C(e),...E(e),...h(e)}}var G={embed(e,r,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/${r}`),m={showLegend:"legend",cooperativeGestures:"cooperativeGestures",fullScreenButton:"link",geolocation:"geolocation",zoomControls:"zoomControls",scaleBar:"scaleBar"},d={...a.uiControls,...n?.uiControls};for(let[p,g]of x(d))g!=null&&i.searchParams.set(m[p],g?"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,g)=>{l.addEventListener("load",()=>{l.contentWindow==null?g(new Error("Failed to load Felt map")):p(l.contentWindow)},{once:!0})}).then(G.connect).then(p=>(Object.defineProperties(p,{iframe:{value:l,writable:!1,configurable:!1}}),p))},connect(e){let r=F(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=d=>{d.data===!0&&(clearInterval(m),clearTimeout(s),i.port1.close(),i.port2.close(),n(r))}})}},x=Object.entries;0&&(module.exports={Felt});
|
package/dist/client.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as Element, G as GeoJsonGeometry, a as GetElementsConstraint, b as ElementGroup, c as GetElementGroupsConstraint, S as SetVisibilityRequest, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, f as ElementCreate, g as ElementUpdate, L as Layer, h as GetLayersConstraint, i as LayerChangeCallbackParams, j as
|
|
2
|
-
export {
|
|
1
|
+
import { E as Element, G as GeoJsonGeometry, a as GetElementsConstraint, b as ElementGroup, c as GetElementGroupsConstraint, S as SetVisibilityRequest, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, f as ElementCreate, g as ElementUpdate, L as Layer, h as GetLayersConstraint, i as LayerChangeCallbackParams, j as GeoJsonArrayBufferSource, k as GeoJsonFileSource, l as GeoJsonUrlSource, m as LayerGroup, n as GetLayerGroupsConstraint, o as LayerGroupChangeCallbackParams, p as LegendItemIdentifier, q as LegendItem, r as LegendItemsConstraint, s as LegendItemChangeCallbackParams, t as LayerFilters, F as Filters, u as GetRenderedFeaturesConstraint, v as LayerFeature, w as GeoJsonFeature, x as GetLayerCategoriesParams, y as GetLayerCategoriesGroup, z as GetLayerHistogramParams, A as GetLayerHistogramBin, B as AggregationMethod, C as GetLayerCalculationParams, D as LayerSchema, M as MapInteractionEvent, H as MapDetails, I as EntityNode, J as FeatureSelection, T as ToolType, K as InputToolSettings, N as ConfigurableToolType, O as ToolSettingsMap, P as ToolSettingsChangeEvent, Q as zInfer, R as SortConfig, V as ViewportState, U as SetViewportCenterZoomParams, W as ViewportConstraints, X as ViewportFitBoundsParams, Y as ViewportCenterZoom } from './types-PSY3LPGC.cjs';
|
|
2
|
+
export { aC as AggregationConfig, Z as CircleElementCreate, _ as CircleElementRead, $ as CircleElementUpdate, aW as CircleToolSettings, aF as ElementGroupNode, aG as ElementNode, ap as EphemeralLayerSource, aH as FeatureNode, aK as FeltBoundary, aL as FeltZoom, az as FilterExpression, aA as FilterLogicGate, aB as FilterTernary, aM as GeoJsonProperties, a0 as HighlighterElementCreate, a1 as HighlighterElementRead, a2 as HighlighterElementUpdate, aX as HighlighterToolSettings, a3 as ImageElementCreate, a4 as ImageElementRead, a5 as ImageElementUpdate, aN as LatLng, aI as LayerGroupNode, aJ as LayerNode, aq as LayerProcessingStatus, as as LayerSchemaAttribute, at as LayerSchemaBooleanAttribute, au as LayerSchemaCommonAttribute, av as LayerSchemaDateAttribute, aw as LayerSchemaDateTimeAttribute, ax as LayerSchemaNumericAttribute, ay as LayerSchemaTextAttribute, aO as LineStringGeometry, aY as LineToolSettings, a6 as LinkElementRead, aP as LngLatTuple, a7 as MarkerElementCreate, a8 as MarkerElementRead, a9 as MarkerElementUpdate, aZ as MarkerToolSettings, aD as MultiAggregationConfig, aQ as MultiLineStringGeometry, aR as MultiPointGeometry, aS as MultiPolygonGeometry, aa as NoteElementCreate, ab as NoteElementRead, ac as NoteElementUpdate, a_ as NoteToolSettings, ad as PathElementCreate, ae as PathElementRead, af as PathElementUpdate, a$ as PinToolSettings, ag as PlaceElementCreate, ah as PlaceElementRead, ai as PlaceElementUpdate, b0 as PlaceFrame, b1 as PlaceSymbol, aT as PointGeometry, aj as PolygonElementCreate, ak as PolygonElementRead, al as PolygonElementUpdate, aU as PolygonGeometry, b2 as PolygonToolSettings, ar as RasterValue, b3 as RouteToolSettings, aV as SortDirection, am as TextElementCreate, an as TextElementRead, ao as TextElementUpdate, b4 as TextToolSettings, aE as ValueConfiguration } from './types-PSY3LPGC.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -140,6 +140,7 @@ interface ElementsController {
|
|
|
140
140
|
*
|
|
141
141
|
* @returns A function to unsubscribe from the listener
|
|
142
142
|
*
|
|
143
|
+
* @event
|
|
143
144
|
* @example
|
|
144
145
|
* ```typescript
|
|
145
146
|
* const unsubscribe = felt.onToolCreatedElement({
|
|
@@ -426,6 +427,43 @@ interface LayersController {
|
|
|
426
427
|
*/
|
|
427
428
|
change: LayerChangeCallbackParams) => void;
|
|
428
429
|
}): VoidFunction;
|
|
430
|
+
/**
|
|
431
|
+
* Adds layers to the map from file or URL sources.
|
|
432
|
+
*
|
|
433
|
+
* @remarks This allows you to add temporary layers to the map that don't depend on
|
|
434
|
+
* any processing by Felt. This is useful for viewing data from external sources or
|
|
435
|
+
* remote files.
|
|
436
|
+
*
|
|
437
|
+
* @returns The layer groups that were created.
|
|
438
|
+
*
|
|
439
|
+
* @example
|
|
440
|
+
* ```typescript
|
|
441
|
+
* const layerFromFile = await felt.createLayer({
|
|
442
|
+
* source: { type: "application/geo+json", name: "Parcels", file: someFile},
|
|
443
|
+
* });
|
|
444
|
+
*
|
|
445
|
+
* const layerFromUrl = await felt.createLayer({
|
|
446
|
+
* source: { type: "application/geo+json", name: "Parcels", url: "https://example.com/parcels.geojson" },
|
|
447
|
+
* });
|
|
448
|
+
* ```
|
|
449
|
+
*/
|
|
450
|
+
createLayer(params: {
|
|
451
|
+
/**
|
|
452
|
+
* The source that you want to add to the map. These can be GeoJSON files or URLs.
|
|
453
|
+
*/
|
|
454
|
+
source: GeoJsonArrayBufferSource | GeoJsonFileSource | GeoJsonUrlSource;
|
|
455
|
+
}): Promise<LayerGroup | null>;
|
|
456
|
+
/**
|
|
457
|
+
* Delete a layer from the map by its id.
|
|
458
|
+
*
|
|
459
|
+
* @remarks This only works for layers created via the SDK `createLayer` method, not layers added via the Felt UI.
|
|
460
|
+
*
|
|
461
|
+
* @example
|
|
462
|
+
* ```typescript
|
|
463
|
+
* await felt.deleteLayer("layer-1");
|
|
464
|
+
* ```
|
|
465
|
+
*/
|
|
466
|
+
deleteLayer(id: string): Promise<void>;
|
|
429
467
|
/**
|
|
430
468
|
* Get a layer group from the map by its id.
|
|
431
469
|
*
|
|
@@ -1711,4 +1749,4 @@ declare const Felt: {
|
|
|
1711
1749
|
connect(feltWindow: Window): Promise<FeltController>;
|
|
1712
1750
|
};
|
|
1713
1751
|
|
|
1714
|
-
export { AggregationMethod, ConfigurableToolType, Element, ElementChangeCallbackParams, ElementCreate, ElementGroup, ElementGroupChangeCallbackParams, ElementUpdate, type ElementsController, EntityNode, FeatureSelection, Felt, type FeltController, type FeltEmbedOptions, Filters, GeoJsonFeature, GeoJsonGeometry, GetElementGroupsConstraint, GetElementsConstraint, GetLayerCalculationParams, GetLayerCategoriesGroup, GetLayerCategoriesParams, GetLayerGroupsConstraint, GetLayerHistogramBin, GetLayerHistogramParams, GetLayersConstraint, GetRenderedFeaturesConstraint, InputToolSettings, type InteractionsController, Layer, LayerChangeCallbackParams, LayerFeature, LayerFilters, LayerGroup, LayerGroupChangeCallbackParams, LayerSchema, type LayersController, LegendItem, LegendItemChangeCallbackParams, LegendItemIdentifier, LegendItemsConstraint, MapDetails, MapInteractionEvent, type MiscController, type UiOnMapInteractionsOptions as OnMapInteractionsOptions, type SelectionController, SetViewportCenterZoomParams, SetVisibilityRequest, SortConfig, ToolSettingsChangeEvent, ToolSettingsMap, ToolType, type ToolsController, type UiController, type UiControlsOptions, ViewportCenterZoom, ViewportConstraints, type ViewportController, ViewportFitBoundsParams, ViewportState };
|
|
1752
|
+
export { AggregationMethod, ConfigurableToolType, Element, ElementChangeCallbackParams, ElementCreate, ElementGroup, ElementGroupChangeCallbackParams, ElementUpdate, type ElementsController, EntityNode, FeatureSelection, Felt, type FeltController, type FeltEmbedOptions, Filters, GeoJsonArrayBufferSource, GeoJsonFeature, GeoJsonFileSource, GeoJsonGeometry, GeoJsonUrlSource, GetElementGroupsConstraint, GetElementsConstraint, GetLayerCalculationParams, GetLayerCategoriesGroup, GetLayerCategoriesParams, GetLayerGroupsConstraint, GetLayerHistogramBin, GetLayerHistogramParams, GetLayersConstraint, GetRenderedFeaturesConstraint, InputToolSettings, type InteractionsController, Layer, LayerChangeCallbackParams, LayerFeature, LayerFilters, LayerGroup, LayerGroupChangeCallbackParams, LayerSchema, type LayersController, LegendItem, LegendItemChangeCallbackParams, LegendItemIdentifier, LegendItemsConstraint, MapDetails, MapInteractionEvent, type MiscController, type UiOnMapInteractionsOptions as OnMapInteractionsOptions, type SelectionController, SetViewportCenterZoomParams, SetVisibilityRequest, SortConfig, ToolSettingsChangeEvent, ToolSettingsMap, ToolType, type ToolsController, type UiController, type UiControlsOptions, ViewportCenterZoom, ViewportConstraints, type ViewportController, ViewportFitBoundsParams, ViewportState };
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as Element, G as GeoJsonGeometry, a as GetElementsConstraint, b as ElementGroup, c as GetElementGroupsConstraint, S as SetVisibilityRequest, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, f as ElementCreate, g as ElementUpdate, L as Layer, h as GetLayersConstraint, i as LayerChangeCallbackParams, j as
|
|
2
|
-
export {
|
|
1
|
+
import { E as Element, G as GeoJsonGeometry, a as GetElementsConstraint, b as ElementGroup, c as GetElementGroupsConstraint, S as SetVisibilityRequest, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, f as ElementCreate, g as ElementUpdate, L as Layer, h as GetLayersConstraint, i as LayerChangeCallbackParams, j as GeoJsonArrayBufferSource, k as GeoJsonFileSource, l as GeoJsonUrlSource, m as LayerGroup, n as GetLayerGroupsConstraint, o as LayerGroupChangeCallbackParams, p as LegendItemIdentifier, q as LegendItem, r as LegendItemsConstraint, s as LegendItemChangeCallbackParams, t as LayerFilters, F as Filters, u as GetRenderedFeaturesConstraint, v as LayerFeature, w as GeoJsonFeature, x as GetLayerCategoriesParams, y as GetLayerCategoriesGroup, z as GetLayerHistogramParams, A as GetLayerHistogramBin, B as AggregationMethod, C as GetLayerCalculationParams, D as LayerSchema, M as MapInteractionEvent, H as MapDetails, I as EntityNode, J as FeatureSelection, T as ToolType, K as InputToolSettings, N as ConfigurableToolType, O as ToolSettingsMap, P as ToolSettingsChangeEvent, Q as zInfer, R as SortConfig, V as ViewportState, U as SetViewportCenterZoomParams, W as ViewportConstraints, X as ViewportFitBoundsParams, Y as ViewportCenterZoom } from './types-PSY3LPGC.js';
|
|
2
|
+
export { aC as AggregationConfig, Z as CircleElementCreate, _ as CircleElementRead, $ as CircleElementUpdate, aW as CircleToolSettings, aF as ElementGroupNode, aG as ElementNode, ap as EphemeralLayerSource, aH as FeatureNode, aK as FeltBoundary, aL as FeltZoom, az as FilterExpression, aA as FilterLogicGate, aB as FilterTernary, aM as GeoJsonProperties, a0 as HighlighterElementCreate, a1 as HighlighterElementRead, a2 as HighlighterElementUpdate, aX as HighlighterToolSettings, a3 as ImageElementCreate, a4 as ImageElementRead, a5 as ImageElementUpdate, aN as LatLng, aI as LayerGroupNode, aJ as LayerNode, aq as LayerProcessingStatus, as as LayerSchemaAttribute, at as LayerSchemaBooleanAttribute, au as LayerSchemaCommonAttribute, av as LayerSchemaDateAttribute, aw as LayerSchemaDateTimeAttribute, ax as LayerSchemaNumericAttribute, ay as LayerSchemaTextAttribute, aO as LineStringGeometry, aY as LineToolSettings, a6 as LinkElementRead, aP as LngLatTuple, a7 as MarkerElementCreate, a8 as MarkerElementRead, a9 as MarkerElementUpdate, aZ as MarkerToolSettings, aD as MultiAggregationConfig, aQ as MultiLineStringGeometry, aR as MultiPointGeometry, aS as MultiPolygonGeometry, aa as NoteElementCreate, ab as NoteElementRead, ac as NoteElementUpdate, a_ as NoteToolSettings, ad as PathElementCreate, ae as PathElementRead, af as PathElementUpdate, a$ as PinToolSettings, ag as PlaceElementCreate, ah as PlaceElementRead, ai as PlaceElementUpdate, b0 as PlaceFrame, b1 as PlaceSymbol, aT as PointGeometry, aj as PolygonElementCreate, ak as PolygonElementRead, al as PolygonElementUpdate, aU as PolygonGeometry, b2 as PolygonToolSettings, ar as RasterValue, b3 as RouteToolSettings, aV as SortDirection, am as TextElementCreate, an as TextElementRead, ao as TextElementUpdate, b4 as TextToolSettings, aE as ValueConfiguration } from './types-PSY3LPGC.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -140,6 +140,7 @@ interface ElementsController {
|
|
|
140
140
|
*
|
|
141
141
|
* @returns A function to unsubscribe from the listener
|
|
142
142
|
*
|
|
143
|
+
* @event
|
|
143
144
|
* @example
|
|
144
145
|
* ```typescript
|
|
145
146
|
* const unsubscribe = felt.onToolCreatedElement({
|
|
@@ -426,6 +427,43 @@ interface LayersController {
|
|
|
426
427
|
*/
|
|
427
428
|
change: LayerChangeCallbackParams) => void;
|
|
428
429
|
}): VoidFunction;
|
|
430
|
+
/**
|
|
431
|
+
* Adds layers to the map from file or URL sources.
|
|
432
|
+
*
|
|
433
|
+
* @remarks This allows you to add temporary layers to the map that don't depend on
|
|
434
|
+
* any processing by Felt. This is useful for viewing data from external sources or
|
|
435
|
+
* remote files.
|
|
436
|
+
*
|
|
437
|
+
* @returns The layer groups that were created.
|
|
438
|
+
*
|
|
439
|
+
* @example
|
|
440
|
+
* ```typescript
|
|
441
|
+
* const layerFromFile = await felt.createLayer({
|
|
442
|
+
* source: { type: "application/geo+json", name: "Parcels", file: someFile},
|
|
443
|
+
* });
|
|
444
|
+
*
|
|
445
|
+
* const layerFromUrl = await felt.createLayer({
|
|
446
|
+
* source: { type: "application/geo+json", name: "Parcels", url: "https://example.com/parcels.geojson" },
|
|
447
|
+
* });
|
|
448
|
+
* ```
|
|
449
|
+
*/
|
|
450
|
+
createLayer(params: {
|
|
451
|
+
/**
|
|
452
|
+
* The source that you want to add to the map. These can be GeoJSON files or URLs.
|
|
453
|
+
*/
|
|
454
|
+
source: GeoJsonArrayBufferSource | GeoJsonFileSource | GeoJsonUrlSource;
|
|
455
|
+
}): Promise<LayerGroup | null>;
|
|
456
|
+
/**
|
|
457
|
+
* Delete a layer from the map by its id.
|
|
458
|
+
*
|
|
459
|
+
* @remarks This only works for layers created via the SDK `createLayer` method, not layers added via the Felt UI.
|
|
460
|
+
*
|
|
461
|
+
* @example
|
|
462
|
+
* ```typescript
|
|
463
|
+
* await felt.deleteLayer("layer-1");
|
|
464
|
+
* ```
|
|
465
|
+
*/
|
|
466
|
+
deleteLayer(id: string): Promise<void>;
|
|
429
467
|
/**
|
|
430
468
|
* Get a layer group from the map by its id.
|
|
431
469
|
*
|
|
@@ -1711,4 +1749,4 @@ declare const Felt: {
|
|
|
1711
1749
|
connect(feltWindow: Window): Promise<FeltController>;
|
|
1712
1750
|
};
|
|
1713
1751
|
|
|
1714
|
-
export { AggregationMethod, ConfigurableToolType, Element, ElementChangeCallbackParams, ElementCreate, ElementGroup, ElementGroupChangeCallbackParams, ElementUpdate, type ElementsController, EntityNode, FeatureSelection, Felt, type FeltController, type FeltEmbedOptions, Filters, GeoJsonFeature, GeoJsonGeometry, GetElementGroupsConstraint, GetElementsConstraint, GetLayerCalculationParams, GetLayerCategoriesGroup, GetLayerCategoriesParams, GetLayerGroupsConstraint, GetLayerHistogramBin, GetLayerHistogramParams, GetLayersConstraint, GetRenderedFeaturesConstraint, InputToolSettings, type InteractionsController, Layer, LayerChangeCallbackParams, LayerFeature, LayerFilters, LayerGroup, LayerGroupChangeCallbackParams, LayerSchema, type LayersController, LegendItem, LegendItemChangeCallbackParams, LegendItemIdentifier, LegendItemsConstraint, MapDetails, MapInteractionEvent, type MiscController, type UiOnMapInteractionsOptions as OnMapInteractionsOptions, type SelectionController, SetViewportCenterZoomParams, SetVisibilityRequest, SortConfig, ToolSettingsChangeEvent, ToolSettingsMap, ToolType, type ToolsController, type UiController, type UiControlsOptions, ViewportCenterZoom, ViewportConstraints, type ViewportController, ViewportFitBoundsParams, ViewportState };
|
|
1752
|
+
export { AggregationMethod, ConfigurableToolType, Element, ElementChangeCallbackParams, ElementCreate, ElementGroup, ElementGroupChangeCallbackParams, ElementUpdate, type ElementsController, EntityNode, FeatureSelection, Felt, type FeltController, type FeltEmbedOptions, Filters, GeoJsonArrayBufferSource, GeoJsonFeature, GeoJsonFileSource, GeoJsonGeometry, GeoJsonUrlSource, GetElementGroupsConstraint, GetElementsConstraint, GetLayerCalculationParams, GetLayerCategoriesGroup, GetLayerCategoriesParams, GetLayerGroupsConstraint, GetLayerHistogramBin, GetLayerHistogramParams, GetLayersConstraint, GetRenderedFeaturesConstraint, InputToolSettings, type InteractionsController, Layer, LayerChangeCallbackParams, LayerFeature, LayerFilters, LayerGroup, LayerGroupChangeCallbackParams, LayerSchema, type LayersController, LegendItem, LegendItemChangeCallbackParams, LegendItemIdentifier, LegendItemsConstraint, MapDetails, MapInteractionEvent, type MiscController, type UiOnMapInteractionsOptions as OnMapInteractionsOptions, type SelectionController, SetViewportCenterZoomParams, SetVisibilityRequest, SortConfig, ToolSettingsChangeEvent, ToolSettingsMap, ToolType, type ToolsController, type UiController, type UiControlsOptions, ViewportCenterZoom, ViewportConstraints, type ViewportController, ViewportFitBoundsParams, ViewportState };
|
package/dist/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function r(e,
|
|
1
|
+
function r(e,o){return n=>{let a=new MessageChannel,l=n.handler,s="options"in n?n.options:void 0,m=crypto.randomUUID();return e.postMessage({type:"felt.addListener",event:s?{eventName:o,id:m,options:s}:{eventName:o,id:m}},"*",[a.port2]),a.port1.onmessage=d=>{l(d.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 l=new MessageChannel,s=a&&n?await n(a):a;return e.postMessage({type:o,params:s},"*",[l.port2]),new Promise((m,d)=>{l.port1.onmessage=y=>{y.data&&typeof y.data=="object"&&"__error__"in y.data?d(new Error(y.data.__error__)):m(y.data),l.port1.close(),l.port2.close()}})}}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 u=e=>({onPointerClick:r(e,"onPointerClick"),onPointerMove:r(e,"onPointerMove")});var C=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"),createLayer:t(e,"createLayer",async o=>"url"in o.source||"arrayBuffer"in o.source?o:{...o,source:{type:"application/geo+json",name:o.source.name,arrayBuffer:await o.source.file.arrayBuffer()}}),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"),getRenderedFeatures:t(e,"getRenderedFeatures"),getFeature:t(e,"getFeature"),getGeoJsonFeature:t(e,"getGeoJsonFeature"),getCategoryData:t(e,"getCategoryData"),getHistogramData:t(e,"getHistogramData"),getAggregates:t(e,"getAggregates"),getLayerSchema:t(e,"getLayerSchema")});var L=e=>({getMapDetails:t(e,"getMapDetails")});var h=e=>({onSelectionChange:r(e,"onSelectionChange"),getSelection:t(e,"getSelection"),selectFeature:t(e,"selectFeature"),clearSelection:t(e,"clearSelection")});var T=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 E=e=>({updateUiControls:t(e,"updateUiControls"),setOnMapInteractionsUi:t(e,"setOnMapInteractionsUi"),showLayerDataTable:t(e,"showLayerDataTable"),hideLayerDataTable:t(e,"hideLayerDataTable")});var v=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 P(e){return{iframe:null,...v(e),...E(e),...C(e),...c(e),...h(e),...u(e),...T(e),...L(e)}}var F={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"},l=n?.origin??a.origin,s=new URL(`${l}/embed/map/${o}`),m={showLegend:"legend",cooperativeGestures:"cooperativeGestures",fullScreenButton:"link",geolocation:"geolocation",zoomControls:"zoomControls",scaleBar:"scaleBar"},d={...a.uiControls,...n?.uiControls};for(let[p,g]of G(d))g!=null&&s.searchParams.set(m[p],g?"1":"0");if(n?.token&&s.searchParams.set("token",n.token),n?.initialViewport){let p=n.initialViewport;s.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=s.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,g)=>{i.addEventListener("load",()=>{i.contentWindow==null?g(new Error("Failed to load Felt map")):p(i.contentWindow)},{once:!0})}).then(F.connect).then(p=>(Object.defineProperties(p,{iframe:{value:i,writable:!1,configurable:!1}}),p))},connect(e){let o=P(e);return new Promise((n,a)=>{let l=setTimeout(()=>{a(new Error("Failed to load Felt map")),clearInterval(m)},5e3),s=new MessageChannel,m=setInterval(()=>{e.postMessage({type:"felt.ready"},"*",[s.port2])},100);s.port1.onmessage=d=>{d.data===!0&&(clearInterval(m),clearTimeout(l),s.port1.close(),s.port2.close(),n(o))}})}},G=Object.entries;export{F as Felt};
|
package/dist/handler.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Z=Object.defineProperty;var rt=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var at=Object.prototype.hasOwnProperty;var it=(r,l)=>{for(var E in l)Z(r,E,{get:l[E],enumerable:!0})},st=(r,l,E,F)=>{if(l&&typeof l=="object"||typeof l=="function")for(let C of nt(l))!at.call(r,C)&&C!==E&&Z(r,C,{get:()=>l[C],enumerable:!(F=rt(l,C))||F.enumerable});return r};var lt=r=>st(Z({},"__esModule",{value:!0}),r);var nr={};it(nr,{createMessageHandler:()=>Ko});module.exports=lt(nr);var g=require("zod");var d=require("zod");var f=require("zod");function t(r,l){return f.z.strictObject({type:f.z.literal(r),params:l})}function S(r,l){return f.z.strictObject({eventName:f.z.literal(r),id:f.z.string(),options:l})}function m(r){return f.z.strictObject({eventName:f.z.literal(r),id:f.z.string()})}var a=require("zod"),O=a.z.number(),U=a.z.number(),N=a.z.object({latitude:U,longitude:O}),G=a.z.tuple([O,U]),ge=a.z.object({type:a.z.literal("Point"),coordinates:G}),ye=a.z.object({type:a.z.literal("Polygon"),coordinates:a.z.array(a.z.array(G))}),mt=a.z.object({type:a.z.literal("LineString"),coordinates:a.z.array(G)}),I=a.z.object({type:a.z.literal("MultiLineString"),coordinates:a.z.array(mt.shape.coordinates)}),de=a.z.number().min(1).max(23),T=a.z.tuple([O,U,O,U]),z=a.z.object({show:a.z.array(a.z.string()).optional(),hide:a.z.array(a.z.string()).optional()}),pt=a.z.enum(["asc","desc"]),ue=a.z.object({attribute:a.z.string(),direction:pt});var e=require("zod");var u=e.z.object({id:e.z.string(),groupId:e.z.string().nullable(),color:e.z.string(),name:e.z.union([e.z.string(),e.z.null()]),description:e.z.union([e.z.string(),e.z.null()]),attributes:e.z.record(e.z.string(),e.z.unknown()),interaction:e.z.enum(["default","locked"]).optional()}),R=e.z.object({imageUrl:e.z.string().nullable()}),J=e.z.object({strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"])}),ct=e.z.enum(["meter","kilometer","foot","mile"]),he=u.extend(R.shape).extend({type:e.z.literal("Place"),coordinates:ge.shape.coordinates,symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.z.boolean()}),W=u.extend(R.shape).extend(J.shape).extend({type:e.z.literal("Path"),coordinates:I.shape.coordinates,distanceMarker:e.z.boolean(),endCaps:e.z.boolean(),routingMode:e.z.enum(["driving","cycling","walking","flying"]).nullable()}),_=u.extend(R.shape).extend(J.shape).extend({type:e.z.literal("Polygon"),coordinates:I.shape.coordinates,fillOpacity:e.z.number().min(0).max(1),areaMarker:e.z.boolean()}),fe=u.extend(R.shape).extend(J.shape).extend({type:e.z.literal("Circle"),coordinates:G,radius:e.z.number(),radiusDisplayAngle:e.z.number(),radiusDisplayUnit:ct.nullable(),fillOpacity:e.z.number().min(0).max(1),radiusMarker:e.z.boolean()}),Q=u.extend({type:e.z.literal("Marker"),coordinates:I.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)}),$=u.extend({type:e.z.literal("Highlighter"),coordinates:I.shape.coordinates,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),coordinates:I.shape.coordinates}),xe=e.z.object({text:e.z.string(),align:e.z.enum(["left","center","right"]),style:e.z.enum(["italic","light","regular","caps"]),name:e.z.string()}),K=u.extend(Se.shape).extend(xe.shape).extend({type:e.z.literal("Text")}),X=u.extend(Se.shape).extend(xe.shape).extend({type:e.z.literal("Note"),widthScale:e.z.number().min(0)}),Y=u.extend({type:e.z.literal("Image"),coordinates:I.shape.coordinates,imageUrl:e.z.string(),opacity:e.z.number().min(0).max(1)}).omit({color:!0}),gt=u.extend({type:e.z.literal("Link"),coordinates:I.shape.coordinates,url:e.z.string()}),x={type:!0,coordinates:!0},b={id:!0},ee=he.partial().required(x).omit(b),j=W.partial().required(x).omit(b),te=_.partial().required(x).omit(b),oe=fe.partial().required(x).required({radius:!0}).omit(b),re=Q.partial().required(x).omit(b),ne=$.partial().required(x).omit(b),ae=K.partial().required(x).required({text:!0}).omit(b).omit({coordinates:!0,name:!0}),ie=X.partial().required(x).required({text:!0}).omit(b).omit({coordinates:!0,name:!0}),yt=Y.partial().required(x).required({imageUrl:!0}).omit(b),be=e.z.discriminatedUnion("type",[ee,j,te,oe,re,ne,yt,ae,ie]);var pr=W.omit({coordinates:!0}),cr=_.omit({coordinates:!0});var gr=Q.omit({coordinates:!0}),yr=$.omit({coordinates:!0}),dr=K.omit({coordinates:!0}),ur=X.omit({coordinates:!0}),hr=Y.omit({coordinates:!0}),fr=gt.omit({coordinates:!0}),M={type:!0,id:!0},dt=he.partial().required(M),ut=W.partial().required(M),ht=_.partial().required(M),ft=fe.partial().required(M),St=Q.partial().required(M),xt=$.partial().required(M),bt=K.partial().required(M).omit({coordinates:!0,name:!0}),Mt=X.partial().required(M).omit({coordinates:!0,name:!0}),Lt=Y.partial().required(M),Me=e.z.discriminatedUnion("type",[dt,ut,ht,ft,St,xt,bt,Mt,Lt]),Le=e.z.object({ids:e.z.array(e.z.string()).optional()}),Ce=e.z.object({ids:e.z.array(e.z.string()).optional()});var Ct=t("getElement",d.z.string()),Gt=t("getElementGeometry",d.z.string()),It=t("getElements",Le.optional()),Et=t("getElementGroup",d.z.string()),Tt=t("getElementGroups",Ce.optional()),zt=t("setElementGroupVisibility",z),Pt=S("onElementChange",d.z.object({id:d.z.string()})),Ft=m("onElementCreate"),kt=m("onElementCreateEnd"),vt=S("onElementDelete",d.z.object({id:d.z.string()})),wt=S("onElementGroupChange",d.z.object({id:d.z.string()})),Vt=t("createElement",be),Ot=t("updateElement",Me),Ut=t("deleteElement",d.z.string()),Ge={methods:[Ct,Gt,It,Et,Tt,zt,Vt,Ot,Ut],listeners:[Pt,Ft,kt,vt,wt]};var Nt=m("onPointerClick"),Rt=m("onPointerMove"),Ie={methods:null,listeners:[Nt,Rt]};var i=require("zod");var n=require("zod"),jt=n.z.enum(["in","ni"]),At=n.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),Ir=n.z.enum(["and","or"]),Ee=n.z.union([n.z.number(),n.z.string(),n.z.boolean(),n.z.null()]),Te=n.z.string().or(n.z.null()),qt=n.z.tuple([Te,jt,n.z.array(Ee).or(n.z.null())]),Ht=n.z.tuple([Te,At,Ee]),se=n.z.union([qt,Ht]),le=n.z.tuple([n.z.lazy(()=>n.z.union([le,se,n.z.null(),n.z.boolean()])),n.z.enum(["and","or"]),n.z.lazy(()=>n.z.union([le,se,n.z.null(),n.z.boolean()]))]),P=n.z.union([le,se,n.z.null(),n.z.boolean()]);var o=require("zod");var ze=o.z.enum(["avg","max","min","sum","median"]),Bt=o.z.object({method:ze,attribute:o.z.string()}),Dt=o.z.object({methods:o.z.array(o.z.union([ze,o.z.literal("count")])),attribute:o.z.string().optional()}),A=o.z.union([T,ye,o.z.array(G)]),Pe=o.z.object({boundary:A.optional(),filters:P.optional(),aggregation:Bt.optional()}),Fe=o.z.object({layerId:o.z.string(),attribute:o.z.string(),limit:o.z.number().optional(),boundary:A.optional(),filters:P.optional(),values:Pe.optional()}),Pr=o.z.object({key:o.z.union([o.z.number(),o.z.string(),o.z.boolean()]),value:o.z.number().nullable()}),Zt=o.z.object({type:o.z.literal("equal-intervals"),count:o.z.number()}),Jt=o.z.object({type:o.z.literal("time-interval"),interval:o.z.enum(["hour","day","week","month","year"])}),ke=o.z.object({layerId:o.z.string(),attribute:o.z.string(),steps:o.z.union([Zt,Jt,o.z.array(o.z.number())]),boundary:A.optional(),filters:P.optional(),values:Pe.optional()}),Fr=o.z.object({min:o.z.number(),max:o.z.number(),value:o.z.number()}),ve=o.z.object({layerId:o.z.string(),boundary:A.optional(),filters:P.optional(),aggregation:Dt});var s=require("zod");var wr=s.z.enum(["processing","completed","failed","incomplete"]),we=s.z.object({ids:s.z.array(s.z.string()).optional()}),Ve=s.z.object({ids:s.z.array(s.z.string()).optional()}),k=s.z.object({id:s.z.string(),layerId:s.z.string()}),Oe=s.z.object({ids:k.array().optional(),layerIds:s.z.string().array().optional()}),Ue=s.z.object({layerIds:s.z.array(s.z.string()).optional(),areaQuery:s.z.union([s.z.object({coordinates:N}),s.z.object({boundary:T})]).optional()});var Wt=t("getLayer",i.z.string()),_t=t("getLayers",we.optional()),Qt=t("setLayerVisibility",z),$t=S("onLayerChange",i.z.object({id:i.z.string()})),Kt=t("setLayerStyle",i.z.object({id:i.z.string(),style:i.z.object({}).passthrough()})),Xt=t("setLayerLegendVisibility",z),Yt=t("getLayerGroup",i.z.string()),eo=t("getLayerGroups",Ve.optional()),to=t("setLayerGroupVisibility",z),oo=t("setLayerGroupLegendVisibility",z),ro=S("onLayerGroupChange",i.z.object({id:i.z.string()})),no=t("getLegendItem",k),ao=t("getLegendItems",Oe.optional()),io=S("onLegendItemChange",k),so=t("setLegendItemVisibility",i.z.object({show:k.array().optional(),hide:k.array().optional()})),lo=t("getLayerFilters",i.z.string()),mo=t("setLayerFilters",i.z.object({layerId:i.z.string(),filters:P,note:i.z.string().optional()})),po=S("onLayerFiltersChange",i.z.object({layerId:i.z.string()})),co=t("getRenderedFeatures",Ue.optional()),go=t("getFeature",i.z.object({id:i.z.string().or(i.z.number()),layerId:i.z.string()})),yo=t("getGeoJsonFeature",i.z.object({id:i.z.string().or(i.z.number()),layerId:i.z.string()})),uo=t("getCategoryData",Fe),ho=t("getHistogramData",ke),fo=t("getAggregates",ve),So=t("getLayerSchema",i.z.string()),Ne={methods:[Wt,_t,Qt,Kt,Xt,Yt,eo,to,oo,no,ao,so,lo,mo,co,go,yo,uo,ho,fo,So],listeners:[$t,ro,io,po]};var Re=require("zod");var xo=t("getMapDetails",Re.z.undefined()),je={methods:[xo],listeners:[]};var w=require("zod");var L=require("zod"),Ae=L.z.object({id:L.z.string().or(L.z.number()),layerId:L.z.string(),showPopup:L.z.boolean().optional(),fitViewport:L.z.boolean().or(L.z.object({maxZoom:L.z.number()})).optional()});var bo=t("getSelection",w.z.undefined()),Mo=m("onSelectionChange"),Lo=t("selectFeature",Ae),Co=t("clearSelection",w.z.object({features:w.z.boolean().optional(),elements:w.z.boolean().optional()}).optional()),qe={methods:[bo,Lo,Co],listeners:[Mo]};var Je=require("zod");var p=require("zod");var He=["pin","line","route","polygon","circle","marker","highlighter","text","note"],Be=p.z.enum([...He,"link"]),De=p.z.enum(He),Go=ee.pick({color:!0,symbol:!0,frame:!0}).extend({afterCreation:p.z.enum(["enter name","add another","select"])}).required(),Io=j.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),Eo=j.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),To=te.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),zo=oe.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),Po=re.pick({color:!0,opacity:!0,size:!0}).required(),Fo=ne.pick({color:!0,opacity:!0}).extend({size:p.z.number().min(0).max(200)}).required(),ko=ae.pick({color:!0,align:!0,style:!0}).required(),vo=ie.pick({color:!0,align:!0,style:!0}).required(),Ze=p.z.discriminatedUnion("tool",[Go.partial().extend({tool:p.z.literal("pin")}),Io.partial().extend({tool:p.z.literal("line")}),Eo.partial().extend({tool:p.z.literal("route")}),To.partial().extend({tool:p.z.literal("polygon")}),zo.partial().extend({tool:p.z.literal("circle")}),Po.partial().extend({tool:p.z.literal("marker")}),Fo.partial().extend({tool:p.z.literal("highlighter")}),ko.partial().extend({tool:p.z.literal("text")}),vo.partial().extend({tool:p.z.literal("note")})]);var wo=t("setTool",Be.nullable()),Vo=t("getTool",Je.z.undefined()),Oo=m("onToolChange"),Uo=t("setToolSettings",Ze),No=t("getToolSettings",De),Ro=m("onToolSettingsChange"),We={methods:[wo,Vo,Uo,No],listeners:[Oo,Ro]};var q=require("zod");var c=require("zod"),_e=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()}),Qe=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 jo=t("updateUiControls",_e),Ao=t("setOnMapInteractionsUi",Qe),qo=t("showLayerDataTable",q.z.object({layerId:q.z.string(),sorting:ue.optional()}).optional()),Ho=t("hideLayerDataTable",q.z.undefined()),$e={methods:[jo,Ao,qo,Ho],listeners:null};var me=require("zod");var V=require("zod");var H=V.z.object({center:N,zoom:de}),Ke=V.z.object({center:H.shape.center.optional(),zoom:H.shape.zoom.optional()}),Xe=V.z.object({minZoom:H.shape.zoom.nullish(),maxZoom:H.shape.zoom.nullish(),bounds:T.nullish()}).nullable(),Ye=V.z.object({bounds:T});var Bo=t("getViewport",me.z.undefined()),Do=t("setViewport",Ke),Zo=t("getViewportConstraints",me.z.undefined()),Jo=t("setViewportConstraints",Xe),Wo=t("fitViewportToBounds",Ye),_o=m("onViewportMove"),Qo=m("onViewportMoveEnd"),$o=m("onMapIdle"),et={methods:[Do,Bo,Zo,Jo,Wo],listeners:[_o,Qo,$o]};var pe=[$e,et,Ne,Ge,qe,Ie,We,je];function Ko(r,l,E){let F=new Map;async function C(h){if(!rr.safeParse(h.data).success){E?.onUnknownMessage?.(h.data);return}let ce=ot.safeParse(h.data);if(!ce.success){E?.onInvalidMessage?.(h.data);return}let{data:y}=ce;if(y.type==="felt.ready")h.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:D=>{h.ports[0]?.postMessage(D)}}:{handler:D=>{h.ports[0]?.postMessage(D)}},B=l.listeners[y.event.eventName](v);F.set(y.event.id,B)}else if(y.type==="felt.removeListener")F.get(y.id)?.(),F.delete(y.id);else try{let v=l.methods[y.type],B=await v(y.params);h.ports[0]?.postMessage(B)}catch(v){h.ports[0]?.postMessage({__error__:Xo(v)})}}return r.addEventListener("message",C),()=>{r.removeEventListener("message",C)}}function Xo(r){return r instanceof Error?r.message:typeof r=="object"&&r!==null&&"message"in r?String(r.message):typeof r=="string"?r:"Unknown error"}var tt={methods:pe.map(r=>r.methods??[]).flat(),listeners:pe.map(r=>r.listeners??[]).flat()},Yo=g.z.discriminatedUnion("eventName",[g.z.strictObject({eventName:g.z.literal("")}),...tt.listeners]),er=g.z.strictObject({type:g.z.literal("felt.addListener"),event:Yo}),tr=g.z.strictObject({type:g.z.literal("felt.removeListener"),id:g.z.string()}),or=g.z.strictObject({type:g.z.literal("felt.ready")}),ot=g.z.discriminatedUnion("type",[or,er,tr,...tt.methods]),rr=g.z.object({type:g.z.enum(ot.options.map(r=>r.shape.type.value))});0&&(module.exports={createMessageHandler});
|
|
1
|
+
"use strict";var J=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var it=Object.getOwnPropertyNames;var st=Object.prototype.hasOwnProperty;var lt=(r,l)=>{for(var E in l)J(r,E,{get:l[E],enumerable:!0})},mt=(r,l,E,F)=>{if(l&&typeof l=="object"||typeof l=="function")for(let C of it(l))!st.call(r,C)&&C!==E&&J(r,C,{get:()=>l[C],enumerable:!(F=at(l,C))||F.enumerable});return r};var pt=r=>mt(J({},"__esModule",{value:!0}),r);var yr={};lt(yr,{createMessageHandler:()=>ar});module.exports=pt(yr);var y=require("zod");var d=require("zod");var f=require("zod");function t(r,l){return f.z.strictObject({type:f.z.literal(r),params:l})}function S(r,l){return f.z.strictObject({eventName:f.z.literal(r),id:f.z.string(),options:l})}function m(r){return f.z.strictObject({eventName:f.z.literal(r),id:f.z.string()})}var s=require("zod"),O=s.z.number(),U=s.z.number(),j=s.z.object({latitude:U,longitude:O}),G=s.z.tuple([O,U]),ge=s.z.object({type:s.z.literal("Point"),coordinates:G}),de=s.z.object({type:s.z.literal("Polygon"),coordinates:s.z.array(s.z.array(G))}),ct=s.z.object({type:s.z.literal("LineString"),coordinates:s.z.array(G)}),I=s.z.object({type:s.z.literal("MultiLineString"),coordinates:s.z.array(ct.shape.coordinates)}),ue=s.z.number().min(1).max(23),T=s.z.tuple([O,U,O,U]),z=s.z.object({show:s.z.array(s.z.string()).optional(),hide:s.z.array(s.z.string()).optional()}),yt=s.z.enum(["asc","desc"]),he=s.z.object({attribute:s.z.string(),direction:yt});var e=require("zod");var u=e.z.object({id:e.z.string(),groupId:e.z.string().nullable(),color:e.z.string(),name:e.z.union([e.z.string(),e.z.null()]),description:e.z.union([e.z.string(),e.z.null()]),attributes:e.z.record(e.z.string(),e.z.unknown()),interaction:e.z.enum(["default","locked"]).optional()}),N=e.z.object({imageUrl:e.z.string().nullable()}),W=e.z.object({strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"])}),gt=e.z.enum(["meter","kilometer","foot","mile"]),fe=u.extend(N.shape).extend({type:e.z.literal("Place"),coordinates:ge.shape.coordinates,symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.z.boolean()}),_=u.extend(N.shape).extend(W.shape).extend({type:e.z.literal("Path"),coordinates:I.shape.coordinates,distanceMarker:e.z.boolean(),endCaps:e.z.boolean(),routingMode:e.z.enum(["driving","cycling","walking","flying"]).nullable()}),Q=u.extend(N.shape).extend(W.shape).extend({type:e.z.literal("Polygon"),coordinates:I.shape.coordinates,fillOpacity:e.z.number().min(0).max(1),areaMarker:e.z.boolean()}),Se=u.extend(N.shape).extend(W.shape).extend({type:e.z.literal("Circle"),coordinates:G,radius:e.z.number(),radiusDisplayAngle:e.z.number(),radiusDisplayUnit:gt.nullable(),fillOpacity:e.z.number().min(0).max(1),radiusMarker:e.z.boolean()}),$=u.extend({type:e.z.literal("Marker"),coordinates:I.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)}),K=u.extend({type:e.z.literal("Highlighter"),coordinates:I.shape.coordinates,opacity:e.z.number().min(0).max(1)}),xe=e.z.object({position:G,rotation:e.z.number(),scale:e.z.number(),zoom:e.z.number().min(0).max(23),coordinates:I.shape.coordinates}),be=e.z.object({text:e.z.string(),align:e.z.enum(["left","center","right"]),style:e.z.enum(["italic","light","regular","caps"]),name:e.z.string()}),X=u.extend(xe.shape).extend(be.shape).extend({type:e.z.literal("Text")}),Y=u.extend(xe.shape).extend(be.shape).extend({type:e.z.literal("Note"),widthScale:e.z.number().min(0)}),ee=u.extend({type:e.z.literal("Image"),coordinates:I.shape.coordinates,imageUrl:e.z.string(),opacity:e.z.number().min(0).max(1)}).omit({color:!0}),dt=u.extend({type:e.z.literal("Link"),coordinates:I.shape.coordinates,url:e.z.string()}),x={type:!0,coordinates:!0},b={id:!0},te=fe.partial().required(x).omit(b),R=_.partial().required(x).omit(b),oe=Q.partial().required(x).omit(b),re=Se.partial().required(x).required({radius:!0}).omit(b),ne=$.partial().required(x).omit(b),ae=K.partial().required(x).omit(b),ie=X.partial().required(x).required({text:!0}).omit(b).omit({coordinates:!0,name:!0}),se=Y.partial().required(x).required({text:!0}).omit(b).omit({coordinates:!0,name:!0}),ut=ee.partial().required(x).required({imageUrl:!0}).omit(b),Me=e.z.discriminatedUnion("type",[te,R,oe,re,ne,ae,ut,ie,se]);var Sr=_.omit({coordinates:!0}),xr=Q.omit({coordinates:!0});var br=$.omit({coordinates:!0}),Mr=K.omit({coordinates:!0}),Lr=X.omit({coordinates:!0}),Cr=Y.omit({coordinates:!0}),Gr=ee.omit({coordinates:!0}),Ir=dt.omit({coordinates:!0}),M={type:!0,id:!0},ht=fe.partial().required(M),ft=_.partial().required(M),St=Q.partial().required(M),xt=Se.partial().required(M),bt=$.partial().required(M),Mt=K.partial().required(M),Lt=X.partial().required(M).omit({coordinates:!0,name:!0}),Ct=Y.partial().required(M).omit({coordinates:!0,name:!0}),Gt=ee.partial().required(M),Le=e.z.discriminatedUnion("type",[ht,ft,St,xt,bt,Mt,Lt,Ct,Gt]),Ce=e.z.object({ids:e.z.array(e.z.string()).optional()}),Ge=e.z.object({ids:e.z.array(e.z.string()).optional()});var It=t("getElement",d.z.string()),Et=t("getElementGeometry",d.z.string()),Tt=t("getElements",Ce.optional()),zt=t("getElementGroup",d.z.string()),Pt=t("getElementGroups",Ge.optional()),Ft=t("setElementGroupVisibility",z),kt=S("onElementChange",d.z.object({id:d.z.string()})),vt=m("onElementCreate"),wt=m("onElementCreateEnd"),Vt=S("onElementDelete",d.z.object({id:d.z.string()})),Ot=S("onElementGroupChange",d.z.object({id:d.z.string()})),Ut=t("createElement",Me),jt=t("updateElement",Le),Nt=t("deleteElement",d.z.string()),Ie={methods:[It,Et,Tt,zt,Pt,Ft,Ut,jt,Nt],listeners:[kt,vt,wt,Vt,Ot]};var Rt=m("onPointerClick"),At=m("onPointerMove"),Ee={methods:null,listeners:[Rt,At]};var i=require("zod");var a=require("zod"),qt=a.z.enum(["in","ni"]),Bt=a.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),wr=a.z.enum(["and","or"]),Te=a.z.union([a.z.number(),a.z.string(),a.z.boolean(),a.z.null()]),ze=a.z.string().or(a.z.null()),Ht=a.z.tuple([ze,qt,a.z.array(Te).or(a.z.null())]),Dt=a.z.tuple([ze,Bt,Te]),le=a.z.union([Ht,Dt]),me=a.z.tuple([a.z.lazy(()=>a.z.union([me,le,a.z.null(),a.z.boolean()])),a.z.enum(["and","or"]),a.z.lazy(()=>a.z.union([me,le,a.z.null(),a.z.boolean()]))]),P=a.z.union([me,le,a.z.null(),a.z.boolean()]);var o=require("zod");var Pe=o.z.enum(["avg","max","min","sum","median"]),Zt=o.z.object({method:Pe,attribute:o.z.string()}),Jt=o.z.object({methods:o.z.array(o.z.union([Pe,o.z.literal("count")])),attribute:o.z.string().optional()}),A=o.z.union([T,de,o.z.array(G)]),Fe=o.z.object({boundary:A.optional(),filters:P.optional(),aggregation:Zt.optional()}),ke=o.z.object({layerId:o.z.string(),attribute:o.z.string(),limit:o.z.number().optional(),boundary:A.optional(),filters:P.optional(),values:Fe.optional()}),jr=o.z.object({key:o.z.union([o.z.number(),o.z.string(),o.z.boolean()]),value:o.z.number().nullable()}),Wt=o.z.object({type:o.z.literal("equal-intervals"),count:o.z.number()}),_t=o.z.object({type:o.z.literal("time-interval"),interval:o.z.enum(["hour","day","week","month","year"])}),ve=o.z.object({layerId:o.z.string(),attribute:o.z.string(),steps:o.z.union([Wt,_t,o.z.array(o.z.number())]),boundary:A.optional(),filters:P.optional(),values:Fe.optional()}),Nr=o.z.object({min:o.z.number(),max:o.z.number(),value:o.z.number()}),we=o.z.object({layerId:o.z.string(),boundary:A.optional(),filters:P.optional(),aggregation:Jt});var n=require("zod");var qr=n.z.enum(["processing","completed","failed","incomplete"]),Ve=n.z.object({ids:n.z.array(n.z.string()).optional()}),Oe=n.z.object({ids:n.z.array(n.z.string()).optional()}),k=n.z.object({id:n.z.string(),layerId:n.z.string()}),Ue=n.z.object({ids:k.array().optional(),layerIds:n.z.string().array().optional()}),je=n.z.object({layerIds:n.z.array(n.z.string()).optional(),areaQuery:n.z.union([n.z.object({coordinates:j}),n.z.object({boundary:T})]).optional()}),Qt=n.z.object({Point:n.z.object({}).passthrough().optional(),Line:n.z.object({}).passthrough().optional(),Polygon:n.z.object({}).passthrough().optional()}),pe=n.z.object({type:n.z.literal("application/geo+json"),name:n.z.string(),geometryStyles:Qt.optional()}),$t=pe.extend({file:n.z.instanceof(File)}),Kt=pe.extend({url:n.z.string().url()}),Xt=pe.extend({arrayBuffer:n.z.instanceof(ArrayBuffer)}),Ne=n.z.union([Xt,$t,Kt]);var Yt=t("getLayer",i.z.string()),eo=t("getLayers",Ve.optional()),to=t("setLayerVisibility",z),oo=S("onLayerChange",i.z.object({id:i.z.string()})),ro=t("setLayerStyle",i.z.object({id:i.z.string(),style:i.z.object({}).passthrough()})),no=t("setLayerLegendVisibility",z),ao=t("createLayer",i.z.object({source:Ne})),io=t("deleteLayer",i.z.string()),so=t("getLayerGroup",i.z.string()),lo=t("getLayerGroups",Oe.optional()),mo=t("setLayerGroupVisibility",z),po=t("setLayerGroupLegendVisibility",z),co=S("onLayerGroupChange",i.z.object({id:i.z.string()})),yo=t("getLegendItem",k),go=t("getLegendItems",Ue.optional()),uo=S("onLegendItemChange",k),ho=t("setLegendItemVisibility",i.z.object({show:k.array().optional(),hide:k.array().optional()})),fo=t("getLayerFilters",i.z.string()),So=t("setLayerFilters",i.z.object({layerId:i.z.string(),filters:P,note:i.z.string().optional()})),xo=S("onLayerFiltersChange",i.z.object({layerId:i.z.string()})),bo=t("getRenderedFeatures",je.optional()),Mo=t("getFeature",i.z.object({id:i.z.string().or(i.z.number()),layerId:i.z.string()})),Lo=t("getGeoJsonFeature",i.z.object({id:i.z.string().or(i.z.number()),layerId:i.z.string()})),Co=t("getCategoryData",ke),Go=t("getHistogramData",ve),Io=t("getAggregates",we),Eo=t("getLayerSchema",i.z.string()),Re={methods:[Yt,eo,to,ro,no,ao,io,so,lo,mo,po,yo,go,ho,fo,So,bo,Mo,Lo,Co,Go,Io,Eo],listeners:[oo,co,uo,xo]};var Ae=require("zod");var To=t("getMapDetails",Ae.z.undefined()),qe={methods:[To],listeners:[]};var w=require("zod");var L=require("zod"),Be=L.z.object({id:L.z.string().or(L.z.number()),layerId:L.z.string(),showPopup:L.z.boolean().optional(),fitViewport:L.z.boolean().or(L.z.object({maxZoom:L.z.number()})).optional()});var zo=t("getSelection",w.z.undefined()),Po=m("onSelectionChange"),Fo=t("selectFeature",Be),ko=t("clearSelection",w.z.object({features:w.z.boolean().optional(),elements:w.z.boolean().optional()}).optional()),He={methods:[zo,Fo,ko],listeners:[Po]};var _e=require("zod");var p=require("zod");var De=["pin","line","route","polygon","circle","marker","highlighter","text","note"],Ze=p.z.enum([...De,"link"]),Je=p.z.enum(De),vo=te.pick({color:!0,symbol:!0,frame:!0}).extend({afterCreation:p.z.enum(["enter name","add another","select"])}).required(),wo=R.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),Vo=R.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),Oo=oe.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),Uo=re.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),jo=ne.pick({color:!0,opacity:!0,size:!0}).required(),No=ae.pick({color:!0,opacity:!0}).extend({size:p.z.number().min(0).max(200)}).required(),Ro=ie.pick({color:!0,align:!0,style:!0}).required(),Ao=se.pick({color:!0,align:!0,style:!0}).required(),We=p.z.discriminatedUnion("tool",[vo.partial().extend({tool:p.z.literal("pin")}),wo.partial().extend({tool:p.z.literal("line")}),Vo.partial().extend({tool:p.z.literal("route")}),Oo.partial().extend({tool:p.z.literal("polygon")}),Uo.partial().extend({tool:p.z.literal("circle")}),jo.partial().extend({tool:p.z.literal("marker")}),No.partial().extend({tool:p.z.literal("highlighter")}),Ro.partial().extend({tool:p.z.literal("text")}),Ao.partial().extend({tool:p.z.literal("note")})]);var qo=t("setTool",Ze.nullable()),Bo=t("getTool",_e.z.undefined()),Ho=m("onToolChange"),Do=t("setToolSettings",We),Zo=t("getToolSettings",Je),Jo=m("onToolSettingsChange"),Qe={methods:[qo,Bo,Do,Zo],listeners:[Ho,Jo]};var q=require("zod");var c=require("zod"),$e=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()}),Ke=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 Wo=t("updateUiControls",$e),_o=t("setOnMapInteractionsUi",Ke),Qo=t("showLayerDataTable",q.z.object({layerId:q.z.string(),sorting:he.optional()}).optional()),$o=t("hideLayerDataTable",q.z.undefined()),Xe={methods:[Wo,_o,Qo,$o],listeners:null};var ce=require("zod");var V=require("zod");var B=V.z.object({center:j,zoom:ue}),Ye=V.z.object({center:B.shape.center.optional(),zoom:B.shape.zoom.optional()}),et=V.z.object({minZoom:B.shape.zoom.nullish(),maxZoom:B.shape.zoom.nullish(),bounds:T.nullish()}).nullable(),tt=V.z.object({bounds:T});var Ko=t("getViewport",ce.z.undefined()),Xo=t("setViewport",Ye),Yo=t("getViewportConstraints",ce.z.undefined()),er=t("setViewportConstraints",et),tr=t("fitViewportToBounds",tt),or=m("onViewportMove"),rr=m("onViewportMoveEnd"),nr=m("onMapIdle"),ot={methods:[Xo,Ko,Yo,er,tr],listeners:[or,rr,nr]};var ye=[Xe,ot,Re,Ie,He,Ee,Qe,qe];function ar(r,l,E){let F=new Map;async function C(h){if(!cr.safeParse(h.data).success){E?.onUnknownMessage?.(h.data);return}let H=nt.safeParse(h.data);if(!H.success){E?.onInvalidMessage?.(h.data,H.error);return}let{data:g}=H;if(g.type==="felt.ready")h.ports[0]?.postMessage(!0);else if(g.type==="felt.addListener"){if(g.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let v="options"in g.event?{options:"options"in g.event?g.event.options:void 0,handler:Z=>{h.ports[0]?.postMessage(Z)}}:{handler:Z=>{h.ports[0]?.postMessage(Z)}},D=l.listeners[g.event.eventName](v);F.set(g.event.id,D)}else if(g.type==="felt.removeListener")F.get(g.id)?.(),F.delete(g.id);else try{let v=l.methods[g.type],D=await v(g.params);h.ports[0]?.postMessage(D)}catch(v){h.ports[0]?.postMessage({__error__:ir(v)})}}return r.addEventListener("message",C),()=>{r.removeEventListener("message",C)}}function ir(r){return r instanceof Error?r.message:typeof r=="object"&&r!==null&&"message"in r?String(r.message):typeof r=="string"?r:"Unknown error"}var rt={methods:ye.map(r=>r.methods??[]).flat(),listeners:ye.map(r=>r.listeners??[]).flat()},sr=y.z.discriminatedUnion("eventName",[y.z.strictObject({eventName:y.z.literal("")}),...rt.listeners]),lr=y.z.strictObject({type:y.z.literal("felt.addListener"),event:sr}),mr=y.z.strictObject({type:y.z.literal("felt.removeListener"),id:y.z.string()}),pr=y.z.strictObject({type:y.z.literal("felt.ready")}),nt=y.z.discriminatedUnion("type",[pr,lr,mr,...rt.methods]),cr=y.z.object({type:y.z.enum(nt.options.map(r=>r.shape.type.value))});0&&(module.exports={createMessageHandler});
|
package/dist/handler.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import {
|
|
1
|
+
import { z, ZodError } from 'zod';
|
|
2
|
+
import { Q as zInfer, E as Element, G as GeoJsonGeometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, m as LayerGroup, q as LegendItem, t as LayerFilters, v as LayerFeature, w as GeoJsonFeature, y as GetLayerCategoriesGroup, A as GetLayerHistogramBin, B as AggregationMethod, D as LayerSchema, i as LayerChangeCallbackParams, o as LayerGroupChangeCallbackParams, s as LegendItemChangeCallbackParams, aB as FilterTernary, H as MapDetails, I as EntityNode, T as ToolType, O as ToolSettingsMap, P as ToolSettingsChangeEvent, V as ViewportState, W as ViewportConstraints, b5 as UnionToIntersection, b6 as PromiseOrNot } from './types-PSY3LPGC.cjs';
|
|
3
3
|
|
|
4
4
|
type Method<TRequest extends {
|
|
5
5
|
type: string;
|
|
@@ -1669,6 +1669,252 @@ declare const SetLayerLegendVisibilityMessage: z.ZodObject<{
|
|
|
1669
1669
|
};
|
|
1670
1670
|
type: "setLayerLegendVisibility";
|
|
1671
1671
|
}>;
|
|
1672
|
+
declare const createLayerMessage: z.ZodObject<{
|
|
1673
|
+
type: z.ZodLiteral<"createLayer">;
|
|
1674
|
+
params: z.ZodObject<{
|
|
1675
|
+
source: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
|
|
1676
|
+
type: z.ZodLiteral<"application/geo+json">;
|
|
1677
|
+
name: z.ZodString;
|
|
1678
|
+
geometryStyles: z.ZodOptional<z.ZodObject<{
|
|
1679
|
+
Point: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
1680
|
+
Line: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
1681
|
+
Polygon: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
1682
|
+
}, "strip", z.ZodTypeAny, {
|
|
1683
|
+
Point?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1684
|
+
Polygon?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1685
|
+
Line?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1686
|
+
}, {
|
|
1687
|
+
Point?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1688
|
+
Polygon?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1689
|
+
Line?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1690
|
+
}>>;
|
|
1691
|
+
}, {
|
|
1692
|
+
arrayBuffer: z.ZodType<ArrayBuffer, z.ZodTypeDef, ArrayBuffer>;
|
|
1693
|
+
}>, "strip", z.ZodTypeAny, {
|
|
1694
|
+
type: "application/geo+json";
|
|
1695
|
+
name: string;
|
|
1696
|
+
arrayBuffer: ArrayBuffer;
|
|
1697
|
+
geometryStyles?: {
|
|
1698
|
+
Point?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1699
|
+
Polygon?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1700
|
+
Line?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1701
|
+
} | undefined;
|
|
1702
|
+
}, {
|
|
1703
|
+
type: "application/geo+json";
|
|
1704
|
+
name: string;
|
|
1705
|
+
arrayBuffer: ArrayBuffer;
|
|
1706
|
+
geometryStyles?: {
|
|
1707
|
+
Point?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1708
|
+
Polygon?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1709
|
+
Line?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1710
|
+
} | undefined;
|
|
1711
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
1712
|
+
type: z.ZodLiteral<"application/geo+json">;
|
|
1713
|
+
name: z.ZodString;
|
|
1714
|
+
geometryStyles: z.ZodOptional<z.ZodObject<{
|
|
1715
|
+
Point: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
1716
|
+
Line: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
1717
|
+
Polygon: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
1718
|
+
}, "strip", z.ZodTypeAny, {
|
|
1719
|
+
Point?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1720
|
+
Polygon?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1721
|
+
Line?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1722
|
+
}, {
|
|
1723
|
+
Point?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1724
|
+
Polygon?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1725
|
+
Line?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1726
|
+
}>>;
|
|
1727
|
+
}, {
|
|
1728
|
+
file: z.ZodType<File, z.ZodTypeDef, File>;
|
|
1729
|
+
}>, "strip", z.ZodTypeAny, {
|
|
1730
|
+
type: "application/geo+json";
|
|
1731
|
+
name: string;
|
|
1732
|
+
file: File;
|
|
1733
|
+
geometryStyles?: {
|
|
1734
|
+
Point?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1735
|
+
Polygon?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1736
|
+
Line?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1737
|
+
} | undefined;
|
|
1738
|
+
}, {
|
|
1739
|
+
type: "application/geo+json";
|
|
1740
|
+
name: string;
|
|
1741
|
+
file: File;
|
|
1742
|
+
geometryStyles?: {
|
|
1743
|
+
Point?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1744
|
+
Polygon?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1745
|
+
Line?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1746
|
+
} | undefined;
|
|
1747
|
+
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
1748
|
+
type: z.ZodLiteral<"application/geo+json">;
|
|
1749
|
+
name: z.ZodString;
|
|
1750
|
+
geometryStyles: z.ZodOptional<z.ZodObject<{
|
|
1751
|
+
Point: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
1752
|
+
Line: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
1753
|
+
Polygon: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
|
|
1754
|
+
}, "strip", z.ZodTypeAny, {
|
|
1755
|
+
Point?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1756
|
+
Polygon?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1757
|
+
Line?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1758
|
+
}, {
|
|
1759
|
+
Point?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1760
|
+
Polygon?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1761
|
+
Line?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1762
|
+
}>>;
|
|
1763
|
+
}, {
|
|
1764
|
+
url: z.ZodString;
|
|
1765
|
+
}>, "strip", z.ZodTypeAny, {
|
|
1766
|
+
type: "application/geo+json";
|
|
1767
|
+
name: string;
|
|
1768
|
+
url: string;
|
|
1769
|
+
geometryStyles?: {
|
|
1770
|
+
Point?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1771
|
+
Polygon?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1772
|
+
Line?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1773
|
+
} | undefined;
|
|
1774
|
+
}, {
|
|
1775
|
+
type: "application/geo+json";
|
|
1776
|
+
name: string;
|
|
1777
|
+
url: string;
|
|
1778
|
+
geometryStyles?: {
|
|
1779
|
+
Point?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1780
|
+
Polygon?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1781
|
+
Line?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1782
|
+
} | undefined;
|
|
1783
|
+
}>]>;
|
|
1784
|
+
}, "strip", z.ZodTypeAny, {
|
|
1785
|
+
source: {
|
|
1786
|
+
type: "application/geo+json";
|
|
1787
|
+
name: string;
|
|
1788
|
+
arrayBuffer: ArrayBuffer;
|
|
1789
|
+
geometryStyles?: {
|
|
1790
|
+
Point?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1791
|
+
Polygon?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1792
|
+
Line?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1793
|
+
} | undefined;
|
|
1794
|
+
} | {
|
|
1795
|
+
type: "application/geo+json";
|
|
1796
|
+
name: string;
|
|
1797
|
+
file: File;
|
|
1798
|
+
geometryStyles?: {
|
|
1799
|
+
Point?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1800
|
+
Polygon?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1801
|
+
Line?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1802
|
+
} | undefined;
|
|
1803
|
+
} | {
|
|
1804
|
+
type: "application/geo+json";
|
|
1805
|
+
name: string;
|
|
1806
|
+
url: string;
|
|
1807
|
+
geometryStyles?: {
|
|
1808
|
+
Point?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1809
|
+
Polygon?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1810
|
+
Line?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1811
|
+
} | undefined;
|
|
1812
|
+
};
|
|
1813
|
+
}, {
|
|
1814
|
+
source: {
|
|
1815
|
+
type: "application/geo+json";
|
|
1816
|
+
name: string;
|
|
1817
|
+
arrayBuffer: ArrayBuffer;
|
|
1818
|
+
geometryStyles?: {
|
|
1819
|
+
Point?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1820
|
+
Polygon?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1821
|
+
Line?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1822
|
+
} | undefined;
|
|
1823
|
+
} | {
|
|
1824
|
+
type: "application/geo+json";
|
|
1825
|
+
name: string;
|
|
1826
|
+
file: File;
|
|
1827
|
+
geometryStyles?: {
|
|
1828
|
+
Point?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1829
|
+
Polygon?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1830
|
+
Line?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1831
|
+
} | undefined;
|
|
1832
|
+
} | {
|
|
1833
|
+
type: "application/geo+json";
|
|
1834
|
+
name: string;
|
|
1835
|
+
url: string;
|
|
1836
|
+
geometryStyles?: {
|
|
1837
|
+
Point?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1838
|
+
Polygon?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1839
|
+
Line?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1840
|
+
} | undefined;
|
|
1841
|
+
};
|
|
1842
|
+
}>;
|
|
1843
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
1844
|
+
params: {
|
|
1845
|
+
source: {
|
|
1846
|
+
type: "application/geo+json";
|
|
1847
|
+
name: string;
|
|
1848
|
+
arrayBuffer: ArrayBuffer;
|
|
1849
|
+
geometryStyles?: {
|
|
1850
|
+
Point?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1851
|
+
Polygon?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1852
|
+
Line?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1853
|
+
} | undefined;
|
|
1854
|
+
} | {
|
|
1855
|
+
type: "application/geo+json";
|
|
1856
|
+
name: string;
|
|
1857
|
+
file: File;
|
|
1858
|
+
geometryStyles?: {
|
|
1859
|
+
Point?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1860
|
+
Polygon?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1861
|
+
Line?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1862
|
+
} | undefined;
|
|
1863
|
+
} | {
|
|
1864
|
+
type: "application/geo+json";
|
|
1865
|
+
name: string;
|
|
1866
|
+
url: string;
|
|
1867
|
+
geometryStyles?: {
|
|
1868
|
+
Point?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1869
|
+
Polygon?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1870
|
+
Line?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1871
|
+
} | undefined;
|
|
1872
|
+
};
|
|
1873
|
+
};
|
|
1874
|
+
type: "createLayer";
|
|
1875
|
+
}, {
|
|
1876
|
+
params: {
|
|
1877
|
+
source: {
|
|
1878
|
+
type: "application/geo+json";
|
|
1879
|
+
name: string;
|
|
1880
|
+
arrayBuffer: ArrayBuffer;
|
|
1881
|
+
geometryStyles?: {
|
|
1882
|
+
Point?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1883
|
+
Polygon?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1884
|
+
Line?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1885
|
+
} | undefined;
|
|
1886
|
+
} | {
|
|
1887
|
+
type: "application/geo+json";
|
|
1888
|
+
name: string;
|
|
1889
|
+
file: File;
|
|
1890
|
+
geometryStyles?: {
|
|
1891
|
+
Point?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1892
|
+
Polygon?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1893
|
+
Line?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1894
|
+
} | undefined;
|
|
1895
|
+
} | {
|
|
1896
|
+
type: "application/geo+json";
|
|
1897
|
+
name: string;
|
|
1898
|
+
url: string;
|
|
1899
|
+
geometryStyles?: {
|
|
1900
|
+
Point?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1901
|
+
Polygon?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1902
|
+
Line?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
1903
|
+
} | undefined;
|
|
1904
|
+
};
|
|
1905
|
+
};
|
|
1906
|
+
type: "createLayer";
|
|
1907
|
+
}>;
|
|
1908
|
+
declare const DeleteLayerMessage: z.ZodObject<{
|
|
1909
|
+
type: z.ZodLiteral<"deleteLayer">;
|
|
1910
|
+
params: z.ZodString;
|
|
1911
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
1912
|
+
params: string;
|
|
1913
|
+
type: "deleteLayer";
|
|
1914
|
+
}, {
|
|
1915
|
+
params: string;
|
|
1916
|
+
type: "deleteLayer";
|
|
1917
|
+
}>;
|
|
1672
1918
|
declare const GetGroupMessage: z.ZodObject<{
|
|
1673
1919
|
type: z.ZodLiteral<"getLayerGroup">;
|
|
1674
1920
|
params: z.ZodString;
|
|
@@ -2563,6 +2809,8 @@ type LayersSchema = {
|
|
|
2563
2809
|
setLayerVisibility: Method<zInfer<typeof SetLayerVisibilityMessage>, void>;
|
|
2564
2810
|
setLayerStyle: Method<zInfer<typeof SetLayerStyleMessage>, void>;
|
|
2565
2811
|
setLayerLegendVisibility: Method<zInfer<typeof SetLayerLegendVisibilityMessage>, void>;
|
|
2812
|
+
createLayer: Method<zInfer<typeof createLayerMessage>, LayerGroup | null>;
|
|
2813
|
+
deleteLayer: Method<zInfer<typeof DeleteLayerMessage>, void>;
|
|
2566
2814
|
getLayerGroup: Method<zInfer<typeof GetGroupMessage>, LayerGroup | null>;
|
|
2567
2815
|
getLayerGroups: Method<zInfer<typeof GetGroupsMessage>, Array<LayerGroup | null>>;
|
|
2568
2816
|
setLayerGroupVisibility: Method<zInfer<typeof SetLayerGroupVisibilityMessage>, void>;
|
|
@@ -3423,7 +3671,7 @@ declare function createMessageHandler(feltWindow: Window, handlers: FeltHandlers
|
|
|
3423
3671
|
*
|
|
3424
3672
|
* @param message
|
|
3425
3673
|
*/
|
|
3426
|
-
onInvalidMessage?: (message: unknown) => void;
|
|
3674
|
+
onInvalidMessage?: (message: unknown, error: ZodError) => void;
|
|
3427
3675
|
}): VoidFunction;
|
|
3428
3676
|
|
|
3429
3677
|
export { createMessageHandler };
|