@feltmaps/js-sdk 1.5.0-next.2 → 1.5.0-next.21
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 +607 -24
- package/dist/client.d.ts +607 -24
- package/dist/client.js +1 -1
- package/dist/handler.cjs +1 -1
- package/dist/handler.d.cts +2726 -221
- package/dist/handler.d.ts +2726 -221
- package/dist/handler.js +1 -1
- package/dist/types-f_Zc32jS.d.cts +6474 -0
- package/dist/types-f_Zc32jS.d.ts +6474 -0
- package/handler.d.ts +2726 -221
- package/handler.js +1 -1
- package/package.json +8 -7
- package/types-f_Zc32jS.d.ts +6474 -0
- package/dist/types-BLsf5GHN.d.cts +0 -1229
- package/dist/types-BLsf5GHN.d.ts +0 -1229
- package/types-BLsf5GHN.d.ts +0 -1229
package/handler.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var v=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var fe=Object.getOwnPropertyNames;var he=Object.prototype.hasOwnProperty;var Se=(o,s)=>{for(var h in s)v(o,h,{get:s[h],enumerable:!0})},be=(o,s,h,L)=>{if(s&&typeof s=="object"||typeof s=="function")for(let u of fe(s))!he.call(o,u)&&u!==h&&v(o,u,{get:()=>s[u],enumerable:!(L=ue(s,u))||L.enumerable});return o};var Me=o=>be(v({},"__esModule",{value:!0}),o);var Ot={};Se(Ot,{createMessageHandler:()=>Ft});module.exports=Me(Ot);var l=require("zod");var f=require("zod");var g=require("zod");function t(o,s){return g.z.strictObject({type:g.z.literal(o),params:s})}function S(o,s){return g.z.strictObject({eventName:g.z.literal(o),id:g.z.string(),options:s})}function m(o){return g.z.strictObject({eventName:g.z.literal(o),id:g.z.string()})}var c=require("zod"),V=c.z.number(),P=c.z.number(),z=c.z.object({latitude:P,longitude:V}),Z=c.z.number().min(1).max(23),I=c.z.tuple([V,P,V,P]),b=c.z.object({show:c.z.array(c.z.string()).optional(),hide:c.z.array(c.z.string()).optional()});var M=require("zod"),U=M.z.object({ids:M.z.array(M.z.string()).optional()}),B=M.z.object({ids:M.z.array(M.z.string()).optional()});var Le=t("getElement",f.z.string()),xe=t("getElementGeometry",f.z.string()),Ge=t("getElements",U.optional()),Ie=t("getElementGroup",f.z.string()),Te=t("getElementGroups",B.optional()),Ce=t("setElementGroupVisibility",b),ze=S("onElementChange",f.z.object({id:f.z.string()})),Fe=S("onElementGroupChange",f.z.object({id:f.z.string()})),A={methods:[Le,xe,Ge,Ie,Te,Ce],listeners:[ze,Fe]};var Ee=m("onPointerClick"),we=m("onPointerMove"),q={methods:null,listeners:[Ee,we]};var i=require("zod");var n=require("zod"),ve=n.z.enum(["in","ni"]),Ve=n.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),_t=n.z.enum(["and","or"]),H=n.z.union([n.z.number(),n.z.string(),n.z.boolean(),n.z.null()]),W=n.z.string().or(n.z.null()),Pe=n.z.tuple([W,ve,n.z.array(H).or(n.z.null())]),ke=n.z.tuple([W,Ve,H]),k=n.z.union([Pe,ke]),O=n.z.tuple([n.z.lazy(()=>n.z.union([O,k,n.z.null(),n.z.boolean()])),n.z.enum(["and","or"]),n.z.lazy(()=>n.z.union([O,k,n.z.null(),n.z.boolean()]))]),K=n.z.union([O,k,n.z.null(),n.z.boolean()]);var r=require("zod");var $t=r.z.enum(["processing","completed","failed","incomplete"]),_=r.z.object({ids:r.z.array(r.z.string()).optional()}),Q=r.z.object({ids:r.z.array(r.z.string()).optional()}),x=r.z.object({id:r.z.string(),layerId:r.z.string()}),D=r.z.object({ids:x.array().optional(),layerIds:r.z.string().array().optional()}),$=r.z.object({layerIds:r.z.array(r.z.string()).optional(),areaQuery:r.z.union([r.z.object({coordinates:z}),r.z.object({boundary:I})]).optional()});var Oe=t("getLayer",i.z.string()),je=t("getLayers",_.optional()),Ne=t("setLayerVisibility",b),Re=S("onLayerChange",i.z.object({id:i.z.string()})),Ze=t("setLayerStyle",i.z.object({id:i.z.string(),style:i.z.object({}).passthrough()})),Ue=t("setLayerLegendVisibility",b),Be=t("getLayerGroup",i.z.string()),Ae=t("getLayerGroups",Q.optional()),qe=t("setLayerGroupVisibility",b),He=t("setLayerGroupLegendVisibility",b),We=S("onLayerGroupChange",i.z.object({id:i.z.string()})),Ke=t("getLegendItem",x),_e=t("getLegendItems",D.optional()),Qe=S("onLegendItemChange",x),De=t("setLegendItemVisibility",i.z.object({show:x.array().optional(),hide:x.array().optional()})),$e=t("getLayerFilters",i.z.string()),Je=t("setLayerFilters",i.z.object({layerId:i.z.string(),filters:K,note:i.z.string().optional()})),Xe=t("getRenderedFeatures",$.optional()),J={methods:[Oe,je,Ne,Ze,Ue,Be,Ae,qe,He,Ke,_e,De,$e,Je,Xe],listeners:[Re,We,Qe]};var T=require("zod");var d=require("zod"),X=d.z.object({id:d.z.string().or(d.z.number()),layerId:d.z.string(),showPopup:d.z.boolean().optional(),fitViewport:d.z.boolean().or(d.z.object({maxZoom:d.z.number()})).optional()});var Ye=t("getSelection",T.z.undefined()),et=m("onSelectionChange"),tt=t("selectFeature",X),ot=t("clearSelection",T.z.object({features:T.z.boolean().optional(),elements:T.z.boolean().optional()}).optional()),Y={methods:[Ye,tt,ot],listeners:[et]};var re=require("zod");var e=require("zod"),ee=["pin","line","route","polygon","circle","marker","highlighter","text","note"],te=e.z.enum([...ee,"link"]),oe=e.z.enum(ee),nt=e.z.object({color:e.z.string(),symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable()}),rt=e.z.object({color:e.z.string(),strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"]),distanceMarker:e.z.boolean()}),st=e.z.object({color:e.z.string(),routingMode:e.z.enum(["driving","cycling","walking","flying"]),strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"]),distanceMarker:e.z.boolean(),endCaps:e.z.boolean()}),it=e.z.object({color:e.z.string(),fillOpacity:e.z.number().min(0).max(1),strokeOpacity:e.z.number().min(0).max(1),strokeWidth:e.z.number().min(0),strokeStyle:e.z.enum(["solid","dashed","dotted"]),areaMarker:e.z.boolean()}),at=e.z.object({color:e.z.string(),fillOpacity:e.z.number().min(0).max(1),strokeOpacity:e.z.number().min(0).max(1),strokeWidth:e.z.number().min(0),strokeStyle:e.z.enum(["solid","dashed","dotted"]),radiusMarker:e.z.boolean()}),lt=e.z.object({color:e.z.string(),opacity:e.z.number().min(0).max(1),size:e.z.number().min(0).max(100)}),pt=e.z.object({color:e.z.string(),opacity:e.z.number().min(0).max(1),size:e.z.number().min(0).max(200)}),mt=e.z.object({color:e.z.string(),align:e.z.enum(["left","center","right"]),style:e.z.enum(["italic","light","regular","caps"])}),ct=e.z.object({color:e.z.string(),align:e.z.enum(["left","center","right"]),style:e.z.enum(["italic","light","regular","caps"])}),ne=e.z.discriminatedUnion("tool",[nt.partial().extend({tool:e.z.literal("pin")}),rt.partial().extend({tool:e.z.literal("line")}),st.partial().extend({tool:e.z.literal("route")}),it.partial().extend({tool:e.z.literal("polygon")}),at.partial().extend({tool:e.z.literal("circle")}),lt.partial().extend({tool:e.z.literal("marker")}),pt.partial().extend({tool:e.z.literal("highlighter")}),mt.partial().extend({tool:e.z.literal("text")}),ct.partial().extend({tool:e.z.literal("note")})]);var yt=t("setTool",te.nullable()),gt=t("getTool",re.z.undefined()),dt=m("onToolChange"),ut=t("setToolSettings",ne),ft=t("getToolSettings",oe),ht=m("onToolSettingsChange"),se={methods:[yt,gt,ut,ft],listeners:[dt,ht]};var a=require("zod"),ie=a.z.object({showLegend:a.z.boolean().optional(),cooperativeGestures:a.z.boolean().optional(),fullScreenButton:a.z.boolean().optional(),geolocation:a.z.boolean().optional(),zoomControls:a.z.boolean().optional(),scaleBar:a.z.boolean().optional()}),ae=a.z.object({featureSelectPanel:a.z.boolean().optional(),featureHoverPanel:a.z.boolean().optional(),elementSelectPanel:a.z.boolean().optional(),linkClickOpen:a.z.boolean().optional(),imageLightboxOpen:a.z.boolean().optional()});var St=t("updateUiControls",ie),bt=t("setOnMapInteractionsUi",ae),le={methods:[St,bt],listeners:null};var j=require("zod");var C=require("zod");var F=C.z.object({center:z,zoom:Z}),pe=C.z.object({center:F.shape.center.optional(),zoom:F.shape.zoom.optional()}),me=C.z.object({minZoom:F.shape.zoom.nullish(),maxZoom:F.shape.zoom.nullish(),bounds:I.nullish()}).nullable(),ce=C.z.object({bounds:I});var Mt=t("getViewport",j.z.undefined()),Lt=t("setViewport",pe),xt=t("getViewportConstraints",j.z.undefined()),Gt=t("setViewportConstraints",me),It=t("fitViewportToBounds",ce),Tt=m("onViewportMove"),Ct=m("onViewportMoveEnd"),zt=m("onMapIdle"),ye={methods:[Lt,Mt,xt,Gt,It],listeners:[Tt,Ct,zt]};var N=[le,ye,J,A,Y,q,se];function Ft(o,s,h){let L=new Map;async function u(y){if(!kt.safeParse(y.data).success){h?.onUnknownMessage?.(y.data);return}let R=de.safeParse(y.data);if(!R.success){h?.onInvalidMessage?.(y.data);return}let{data:p}=R;if(p.type==="felt.ready")y.ports[0]?.postMessage(!0);else if(p.type==="felt.addListener"){if(p.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let G="options"in p.event?{options:"options"in p.event?p.event.options:void 0,handler:w=>{y.ports[0]?.postMessage(w)}}:{handler:w=>{y.ports[0]?.postMessage(w)}},E=s.listeners[p.event.eventName](G);L.set(p.event.id,E)}else if(p.type==="felt.removeListener")L.get(p.id)?.(),L.delete(p.id);else try{let G=s.methods[p.type],E=await G(p.params);y.ports[0]?.postMessage(E)}catch(G){y.ports[0]?.postMessage({__error__:Et(G)})}}return o.addEventListener("message",u),()=>{o.removeEventListener("message",u)}}function Et(o){return o instanceof Error?o.message:typeof o=="object"&&o!==null&&"message"in o?String(o.message):typeof o=="string"?o:"Unknown error"}var ge={methods:N.map(o=>o.methods??[]).flat(),listeners:N.map(o=>o.listeners??[]).flat()},wt=l.z.discriminatedUnion("eventName",[l.z.strictObject({eventName:l.z.literal("")}),...ge.listeners]),vt=l.z.strictObject({type:l.z.literal("felt.addListener"),event:wt}),Vt=l.z.strictObject({type:l.z.literal("felt.removeListener"),id:l.z.string()}),Pt=l.z.strictObject({type:l.z.literal("felt.ready")}),de=l.z.discriminatedUnion("type",[Pt,vt,Vt,...ge.methods]),kt=l.z.object({type:l.z.enum(de.options.map(o=>o.shape.type.value))});0&&(module.exports={createMessageHandler});
|
|
1
|
+
"use strict";var te=Object.defineProperty;var nt=Object.getOwnPropertyDescriptor;var at=Object.getOwnPropertyNames;var it=Object.prototype.hasOwnProperty;var st=(o,l)=>{for(var G in l)te(o,G,{get:l[G],enumerable:!0})},lt=(o,l,G,z)=>{if(l&&typeof l=="object"||typeof l=="function")for(let M of at(l))!it.call(o,M)&&M!==G&&te(o,M,{get:()=>l[M],enumerable:!(z=nt(l,M))||z.enumerable});return o};var pt=o=>lt(te({},"__esModule",{value:!0}),o);var cr={};st(cr,{createMessageHandler:()=>nr});module.exports=pt(cr);var y=require("zod");var d=require("zod");var f=require("zod");function t(o,l){return f.z.strictObject({type:f.z.literal(o),params:l})}function S(o,l){return f.z.strictObject({eventName:f.z.literal(o),id:f.z.string(),options:l})}function p(o){return f.z.strictObject({eventName:f.z.literal(o),id:f.z.string()})}var i=require("zod"),H=i.z.number(),J=i.z.number(),B=i.z.object({latitude:J,longitude:H}),C=i.z.tuple([H,J]),V=i.z.object({type:i.z.literal("Polygon"),coordinates:i.z.array(i.z.array(C).min(4).refine(o=>o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1],"The last point of each ring must be identical to the first"))}),Z=i.z.object({type:i.z.literal("MultiPolygon"),coordinates:i.z.array(V.shape.coordinates)}),mt=i.z.object({type:i.z.literal("LineString"),coordinates:i.z.array(C).min(2)}),v=i.z.object({type:i.z.literal("MultiLineString"),coordinates:i.z.array(mt.shape.coordinates)}),he=i.z.number().min(1).max(23),I=i.z.tuple([H,J,H,J]),T=i.z.object({show:i.z.array(i.z.string()).optional(),hide:i.z.array(i.z.string()).optional()}),ct=i.z.enum(["asc","desc"]),fe=i.z.object({attribute:i.z.string(),direction:ct});var e=require("zod");var h=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()}),ne=e.z.object({strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"])}),yt=e.z.enum(["meter","kilometer","foot","mile"]),q=h.extend(_.shape).extend({type:e.z.literal("Place"),coordinates:C,symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.z.boolean()}),w=h.extend(_.shape).extend(ne.shape).extend({type:e.z.literal("Path"),coordinates:v.shape.coordinates,distanceMarker:e.z.boolean(),routingMode:e.z.enum(["driving","cycling","walking","flying"]).nullable(),endCaps:e.z.boolean()}),O=h.extend(_.shape).extend(ne.shape).extend({type:e.z.literal("Polygon"),coordinates:V.shape.coordinates,fillOpacity:e.z.number().min(0).max(1),areaMarker:e.z.boolean()}),W=h.extend(_.shape).extend(ne.shape).extend({type:e.z.literal("Circle"),center:C,radius:e.z.number(),radiusMarker:e.z.boolean(),radiusDisplayAngle:e.z.number(),radiusDisplayUnit:yt.nullable(),fillOpacity:e.z.number().min(0).max(1)}),U=h.extend({type:e.z.literal("Marker"),coordinates:v.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=h.extend({type:e.z.literal("Highlighter"),coordinates:Z.shape.coordinates,renderHoles:e.z.boolean(),opacity:e.z.number().min(0).max(1)}),Se=e.z.object({position:C,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()}),oe=h.extend(Se.shape).extend({type:e.z.literal("Text")}),re=h.extend(Se.shape).extend({type:e.z.literal("Note"),widthScale:e.z.number().min(0)}),j=h.extend({type:e.z.literal("Image"),coordinates:v.shape.coordinates,imageUrl:e.z.string(),opacity:e.z.number().min(0).max(1)}).omit({color:!0}),gt=h.extend({type:e.z.literal("Link"),coordinates:v.shape.coordinates,url:e.z.string()}),P={type:!0,coordinates:!0},x={id:!0},ae=q.partial().extend(q.pick(P).shape).omit(x),Q=w.partial().extend(w.pick(P).shape).omit(x),ie=O.partial().extend(O.pick(P).shape).omit(x),se=W.partial().extend(W.pick({type:!0,center:!0,radius:!0}).shape).omit(x),le=U.partial().extend(U.pick(P).shape).omit(x),pe=R.partial().extend(R.pick(P).shape).omit(x),me=oe.partial().omit({...x,name:!0,type:!0}).extend({type:e.z.literal("Text"),text:e.z.string()}),ce=re.partial().omit({...x,name:!0,type:!0}).extend({type:e.z.literal("Note"),text:e.z.string()}),dt=j.partial().extend(j.pick({...P,imageUrl:!0}).shape).omit(x),xe=e.z.discriminatedUnion("type",[ae,Q,ie,se,le,pe,dt,me,ce]);var fr=w.omit({coordinates:!0}),Sr=O.omit({coordinates:!0});var xr=U.omit({coordinates:!0}),Lr=R.omit({coordinates:!0});var br=j.omit({coordinates:!0}),Mr=gt.omit({coordinates:!0}),L={type:!0,id:!0},ut=q.partial().extend(q.pick(L).shape),ht=w.partial().extend(w.pick(L).shape),ft=O.partial().extend(O.pick(L).shape),St=W.partial().extend(W.pick(L).shape),xt=U.partial().extend(U.pick(L).shape),Lt=R.partial().extend(R.pick(L).shape),bt=oe.partial().extend(oe.pick(L).shape).omit({name:!0}),Mt=re.partial().extend(re.pick(L).shape).omit({name:!0}),Ct=j.partial().extend(j.pick(L).shape),Le=e.z.discriminatedUnion("type",[ut,ht,ft,St,xt,Lt,bt,Mt,Ct]),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 Gt=t("getElement",d.z.string()),It=t("getElementGeometry",d.z.string()),Tt=t("getElements",be.optional()),Et=t("getElementGroup",d.z.string()),zt=t("getElementGroups",Me.optional()),Pt=t("setElementGroupVisibility",T),Ft=S("onElementChange",d.z.object({id:d.z.string()})),kt=p("onElementCreate"),Vt=p("onElementCreateEnd"),vt=S("onElementDelete",d.z.object({id:d.z.string()})),wt=S("onElementGroupChange",d.z.object({id:d.z.string()})),Ot=t("createElement",xe),Ut=t("updateElement",Le),Rt=t("deleteElement",d.z.string()),Ce={methods:[Gt,It,Tt,Et,zt,Pt,Ot,Ut,Rt],listeners:[Ft,kt,Vt,vt,wt]};var jt=p("onPointerClick"),Nt=p("onPointerMove"),Ge={methods:null,listeners:[jt,Nt]};var s=require("zod");var a=require("zod"),At=a.z.enum(["in","ni"]),Dt=a.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),Fr=a.z.enum(["and","or"]),Ie=a.z.union([a.z.number(),a.z.string(),a.z.boolean(),a.z.null()]),Te=a.z.string().or(a.z.null()),Ht=a.z.tuple([Te,At,a.z.array(Ie).or(a.z.null())]),Jt=a.z.tuple([Te,Dt,Ie]),ye=a.z.union([Ht,Jt]),ge=a.z.tuple([a.z.lazy(()=>a.z.union([ge,ye,a.z.null(),a.z.boolean()])),a.z.enum(["and","or"]),a.z.lazy(()=>a.z.union([ge,ye,a.z.null(),a.z.boolean()]))]),E=a.z.union([ge,ye,a.z.null(),a.z.boolean()]);var r=require("zod");var Ee=r.z.enum(["avg","max","min","sum","median"]),Bt=r.z.object({method:Ee,attribute:r.z.string()}),Zt=r.z.object({methods:r.z.array(r.z.union([Ee,r.z.literal("count")])),attribute:r.z.string().optional()}),$=r.z.union([I,V,Z,r.z.array(C)]),ze=r.z.object({boundary:$.optional(),filters:E.optional(),aggregation:Bt.optional()}),Pe=r.z.object({layerId:r.z.string(),attribute:r.z.string(),limit:r.z.number().optional(),boundary:$.optional(),filters:E.optional(),values:ze.optional()}),wr=r.z.object({key:r.z.union([r.z.number(),r.z.string(),r.z.boolean()]),value:r.z.number().nullable()}),qt=r.z.object({type:r.z.literal("equal-intervals"),count:r.z.number()}),Wt=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([qt,Wt,r.z.array(r.z.number())]),boundary:$.optional(),filters:E.optional(),values:ze.optional()}),Or=r.z.object({min:r.z.number(),max:r.z.number(),value:r.z.number()}),ke=r.z.object({layerId:r.z.string(),boundary:$.optional(),filters:E.optional(),aggregation:Zt});var n=require("zod");var jr=n.z.enum(["processing","completed","failed","incomplete"]),_t=n.z.object({type:n.z.literal("geoJsonUrl"),url:n.z.string().url()}),Qt=n.z.object({type:n.z.literal("geoJsonData"),data:n.z.object({}).passthrough()}),$t=n.z.object({type:n.z.literal("geoJsonFile"),file:n.z.instanceof(File)}),Ve=n.z.object({ids:n.z.array(n.z.string()).optional()}),ve=n.z.object({ids:n.z.array(n.z.string()).optional()}),F=n.z.object({id:n.z.string(),layerId:n.z.string()}),we=n.z.object({ids:F.array().optional(),layerIds:n.z.string().array().optional()}),Oe=n.z.object({layerIds:n.z.array(n.z.string()).optional(),areaQuery:n.z.union([n.z.object({coordinates:B}),n.z.object({boundary:I})]).optional()}),Kt=n.z.object({Point:n.z.object({}).passthrough().optional(),Line:n.z.object({}).passthrough().optional(),Polygon:n.z.object({}).passthrough().optional()}),Ue=n.z.object({source:n.z.union([_t,Qt,$t]),name:n.z.string(),geometryStyles:Kt.optional()});var Xt=t("getLayer",s.z.string()),Yt=t("getLayers",Ve.optional()),eo=t("setLayerVisibility",T),to=S("onLayerChange",s.z.object({id:s.z.string()})),oo=t("setLayerStyle",s.z.object({id:s.z.string(),style:s.z.object({}).passthrough()})),ro=t("setLayerLegendVisibility",T),no=t("createLayersFromGeoJson",Ue),ao=t("deleteLayer",s.z.string()),io=t("getLayerGroup",s.z.string()),so=t("getLayerGroups",ve.optional()),lo=t("setLayerGroupVisibility",T),po=t("setLayerGroupLegendVisibility",T),mo=S("onLayerGroupChange",s.z.object({id:s.z.string()})),co=t("getLegendItem",F),yo=t("getLegendItems",we.optional()),go=S("onLegendItemChange",F),uo=t("setLegendItemVisibility",s.z.object({show:F.array().optional(),hide:F.array().optional()})),ho=t("getLayerFilters",s.z.string()),fo=t("setLayerFilters",s.z.object({layerId:s.z.string(),filters:E,note:s.z.string().optional()})),So=S("onLayerFiltersChange",s.z.object({layerId:s.z.string()})),xo=t("getRenderedFeatures",Oe.optional()),Lo=t("getFeature",s.z.object({id:s.z.string().or(s.z.number()),layerId:s.z.string()})),bo=t("getGeoJsonFeature",s.z.object({id:s.z.string().or(s.z.number()),layerId:s.z.string()})),Mo=t("getCategoryData",Pe),Co=t("getHistogramData",Fe),Go=t("getAggregates",ke),Io=t("getLayerSchema",s.z.string()),Re={methods:[Xt,Yt,eo,oo,ro,no,ao,io,so,lo,po,co,yo,uo,ho,fo,xo,Lo,bo,Mo,Co,Go,Io],listeners:[to,mo,go,So]};var je=require("zod");var To=t("getMapDetails",je.z.undefined()),Ne={methods:[To],listeners:[]};var N=require("zod");var b=require("zod"),Ae=b.z.object({id:b.z.string().or(b.z.number()),layerId:b.z.string(),showPopup:b.z.boolean().optional(),fitViewport:b.z.boolean().or(b.z.object({maxZoom:b.z.number()})).optional()});var Eo=t("getSelection",N.z.undefined()),zo=p("onSelectionChange"),Po=t("selectFeature",Ae),Fo=t("clearSelection",N.z.object({features:N.z.boolean().optional(),elements:N.z.boolean().optional()}).optional()),De={methods:[Eo,Po,Fo],listeners:[zo]};var qe=require("zod");var m=require("zod");var He=["pin","line","route","polygon","circle","marker","highlighter","text","note"],Je=m.z.enum([...He,"link"]),Be=m.z.enum(He),ko=ae.pick({color:!0,symbol:!0,frame:!0}).extend({afterCreation:m.z.enum(["enter name","add another","select"])}).required(),Vo=Q.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),vo=Q.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),wo=ie.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),Oo=se.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),Uo=le.pick({color:!0,opacity:!0,size:!0}).required(),Ro=pe.pick({color:!0,opacity:!0,renderHoles:!0}).extend({size:m.z.number().min(0).max(200)}).required(),jo=me.pick({color:!0,align:!0,style:!0}).required(),No=ce.pick({color:!0,align:!0,style:!0}).required(),Ze=m.z.discriminatedUnion("tool",[ko.partial().extend({tool:m.z.literal("pin")}),Vo.partial().extend({tool:m.z.literal("line")}),vo.partial().extend({tool:m.z.literal("route")}),wo.partial().extend({tool:m.z.literal("polygon")}),Oo.partial().extend({tool:m.z.literal("circle")}),Uo.partial().extend({tool:m.z.literal("marker")}),Ro.partial().extend({tool:m.z.literal("highlighter")}),jo.partial().extend({tool:m.z.literal("text")}),No.partial().extend({tool:m.z.literal("note")})]);var Ao=t("setTool",Je.nullable()),Do=t("getTool",qe.z.undefined()),Ho=p("onToolChange"),Jo=t("setToolSettings",Ze),Bo=t("getToolSettings",Be),Zo=p("onToolSettingsChange"),We={methods:[Ao,Do,Jo,Bo],listeners:[Ho,Zo]};var K=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 qo=t("updateUiControls",_e),Wo=t("setOnMapInteractionsUi",Qe),_o=t("showLayerDataTable",K.z.object({layerId:K.z.string(),sorting:fe.optional()}).optional()),Qo=t("hideLayerDataTable",K.z.undefined()),$e={methods:[qo,Wo,_o,Qo],listeners:null};var de=require("zod");var A=require("zod");var X=A.z.object({center:B,zoom:he}),Ke=A.z.object({center:X.shape.center.optional(),zoom:X.shape.zoom.optional()}),Xe=A.z.object({minZoom:X.shape.zoom.nullish(),maxZoom:X.shape.zoom.nullish(),bounds:I.nullish()}).nullable(),Ye=A.z.object({bounds:I});var $o=t("getViewport",de.z.undefined()),Ko=t("setViewport",Ke),Xo=t("getViewportConstraints",de.z.undefined()),Yo=t("setViewportConstraints",Xe),er=t("fitViewportToBounds",Ye),tr=p("onViewportMove"),or=p("onViewportMoveEnd"),rr=p("onMapIdle"),et={methods:[Ko,$o,Xo,Yo,er],listeners:[tr,or,rr]};var ue=[$e,et,Re,Ce,De,Ge,We,Ne];function nr(o,l,G){let z=new Map;async function M(u){if(!pr.safeParse(u.data).success){G?.onUnknownMessage?.(u.data);return}let D=rt.safeParse(u.data);if(!D.success){G?.onInvalidMessage?.(u.data,D.error),u.ports[0]?.postMessage(tt(D.error.message));return}let{data:g}=D;if(g.type==="felt.ready")u.ports[0]?.postMessage(!0);else if(g.type==="felt.addListener"){if(g.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let k="options"in g.event?{options:"options"in g.event?g.event.options:void 0,handler:ee=>{u.ports[0]?.postMessage(ee)}}:{handler:ee=>{u.ports[0]?.postMessage(ee)}},Y=l.listeners[g.event.eventName](k);z.set(g.event.id,Y)}else if(g.type==="felt.removeListener")z.get(g.id)?.(),z.delete(g.id);else try{let k=l.methods[g.type],Y=await k(g.params);u.ports[0]?.postMessage(Y)}catch(k){u.ports[0]?.postMessage(tt(k))}}return o.addEventListener("message",M),()=>{o.removeEventListener("message",M)}}var ot={methods:ue.map(o=>o.methods??[]).flat(),listeners:ue.map(o=>o.listeners??[]).flat()},ar=y.z.discriminatedUnion("eventName",[y.z.strictObject({eventName:y.z.literal("")}),...ot.listeners]),ir=y.z.strictObject({type:y.z.literal("felt.addListener"),event:ar}),sr=y.z.strictObject({type:y.z.literal("felt.removeListener"),id:y.z.string()}),lr=y.z.strictObject({type:y.z.literal("felt.ready")}),rt=y.z.discriminatedUnion("type",[lr,ir,sr,...ot.methods]),pr=y.z.object({type:y.z.enum(rt.options.map(o=>o.shape.type.value))});function tt(o){return{__error__:mr(o)}}function mr(o){return o instanceof Error?o.message:typeof o=="object"&&o!==null&&"message"in o?String(o.message):typeof o=="string"?o:"Unknown error"}0&&(module.exports={createMessageHandler});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feltmaps/js-sdk",
|
|
3
|
-
"version": "1.5.0-next.
|
|
3
|
+
"version": "1.5.0-next.21",
|
|
4
4
|
"description": "An SDK for Felt maps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"felt",
|
|
@@ -58,23 +58,24 @@
|
|
|
58
58
|
"zod": "^3.23.8"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
|
-
"build": "npm run build:compile && npm run build:docs",
|
|
62
61
|
"build:compile": "tsup",
|
|
63
62
|
"build:docs": "typedoc",
|
|
63
|
+
"build": "npm run build:compile && npm run build:docs",
|
|
64
64
|
"changeset": "changeset",
|
|
65
|
-
"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",
|
|
66
65
|
"check:api": "npm run build:compile && attw --pack . && api-extractor run",
|
|
67
66
|
"check:client-bundle": "npm run build:compile && node ./scripts/check-client-bundle-contents.js",
|
|
68
67
|
"check:docs": "npm run build:docs && bash ./scripts/check-api-docs.sh",
|
|
69
68
|
"check:format": "prettier --check .",
|
|
70
|
-
"check:unused": "knip",
|
|
71
69
|
"check:test": "vitest run",
|
|
72
70
|
"check:types": "tsc",
|
|
71
|
+
"check:unused": "knip",
|
|
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
73
|
"ci": "npm run build && npm run check",
|
|
74
|
-
"update-api": "npm run build:compile && api-extractor run --local",
|
|
75
|
-
"local-release": "git checkout prerelease && git pull && npm run ci && changeset version && changeset publish && git push --follow-tags",
|
|
76
74
|
"enter-prerelease": "git checkout prerelease && git pull && changeset pre enter next",
|
|
77
75
|
"exit-prerelease": "git checkout prerelease && git pull && changeset pre exit",
|
|
78
|
-
"
|
|
76
|
+
"list-changes": "./scripts/list-possible-changes.sh",
|
|
77
|
+
"local-release:dry": "./scripts/local-release.sh --dry-run",
|
|
78
|
+
"local-release": "./scripts/local-release.sh",
|
|
79
|
+
"update-api": "npm run build:compile && api-extractor run --local"
|
|
79
80
|
}
|
|
80
81
|
}
|