@feltmaps/js-sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +7 -0
- package/README.md +26 -0
- package/dist/client.cjs +1 -0
- package/dist/client.d.cts +946 -0
- package/dist/client.d.ts +946 -0
- package/dist/client.js +1 -0
- package/dist/handler.cjs +1 -0
- package/dist/handler.d.cts +856 -0
- package/dist/handler.d.ts +856 -0
- package/dist/handler.js +1 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/types-0v6svQ9V.d.cts +885 -0
- package/dist/types-0v6svQ9V.d.ts +885 -0
- package/handler.d.ts +856 -0
- package/handler.js +1 -0
- package/package.json +80 -0
- package/types-0v6svQ9V.d.ts +885 -0
package/handler.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var C=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var ie=Object.prototype.hasOwnProperty;var le=(o,n)=>{for(var u in n)C(o,u,{get:n[u],enumerable:!0})},pe=(o,n,u,M)=>{if(n&&typeof n=="object"||typeof n=="function")for(let c of ae(n))!ie.call(o,c)&&c!==u&&C(o,c,{get:()=>n[c],enumerable:!(M=se(n,c))||M.enumerable});return o};var me=o=>pe(C({},"__esModule",{value:!0}),o);var tt={};le(tt,{createMessageHandler:()=>Qe});module.exports=me(tt);var a=require("zod");var g=require("zod");var m=require("zod");function e(o,n){return m.z.strictObject({type:m.z.literal(o),params:n})}function h(o,n){return m.z.strictObject({eventName:m.z.literal(o),id:m.z.string(),options:n})}function d(o){return m.z.strictObject({eventName:m.z.literal(o),id:m.z.string()})}var l=require("zod"),z=l.z.number(),E=l.z.number(),w=l.z.object({latitude:E,longitude:z}),O=l.z.number().min(1).max(23),T=l.z.tuple([z,E,z,E]),L=l.z.object({show:l.z.array(l.z.string()).optional(),hide:l.z.array(l.z.string()).optional()});var f=require("zod"),j=f.z.object({ids:f.z.array(f.z.string()).optional()}),k=f.z.object({ids:f.z.array(f.z.string()).optional()});var ce=e("getElement",g.z.string()),ye=e("getElementGeometry",g.z.string()),de=e("getElements",j.optional()),ge=e("getElementGroup",g.z.string()),ue=e("getElementGroups",k.optional()),he=e("setElementGroupVisibility",L),fe=h("onElementChange",g.z.object({id:g.z.string()})),Me=h("onElementGroupChange",g.z.object({id:g.z.string()})),R={methods:[ce,ye,de,ge,ue,he],listeners:[fe,Me]};var Se=d("onPointerClick"),Le=d("onPointerMove"),U={methods:null,listeners:[Se,Le]};var p=require("zod");var t=require("zod"),be=t.z.enum(["in","ni"]),Ge=t.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),dt=t.z.enum(["and","or"]),B=t.z.union([t.z.number(),t.z.string(),t.z.boolean(),t.z.null()]),Z=t.z.string().or(t.z.null()),Ie=t.z.tuple([Z,be,t.z.array(B).or(t.z.null())]),xe=t.z.tuple([Z,Ge,B]),F=t.z.union([Ie,xe]),v=t.z.tuple([t.z.lazy(()=>t.z.union([v,F,t.z.null(),t.z.boolean()])),t.z.enum(["and","or"]),t.z.lazy(()=>t.z.union([v,F,t.z.null(),t.z.boolean()]))]),N=t.z.union([v,F,t.z.null(),t.z.boolean()]);var r=require("zod"),ut=r.z.enum(["processing","completed","failed","incomplete"]),A=r.z.object({ids:r.z.array(r.z.string()).optional()}),q=r.z.object({ids:r.z.array(r.z.string()).optional()}),S=r.z.object({id:r.z.string(),layerId:r.z.string()}),H=r.z.object({ids:S.array().optional(),layerIds:r.z.string().array().optional()}),W=r.z.object({layerIds:r.z.array(r.z.string()).optional()});var Ce=e("getLayer",p.z.string()),ze=e("getLayers",A.optional()),Ee=e("setLayerVisibility",L),Fe=h("onLayerChange",p.z.object({id:p.z.string()})),ve=e("getLayerGroup",p.z.string()),Ve=e("getLayerGroups",q.optional()),Pe=e("setLayerGroupVisibility",L),we=h("onLayerGroupChange",p.z.object({id:p.z.string()})),Oe=e("getLegendItem",S),Te=e("getLegendItems",H.optional()),je=h("onLegendItemChange",S),ke=e("setLegendItemVisibility",p.z.object({show:S.array().optional(),hide:S.array().optional()})),Re=e("getLayerFilters",p.z.string()),Ue=e("setLayerFilters",p.z.object({layerId:p.z.string(),filters:N})),Be=e("getRenderedFeatures",W.optional()),D={methods:[Ce,ze,Ee,ve,Ve,Pe,Oe,Te,ke,Re,Ue,Be],listeners:[Fe,we,je]};var J=require("zod");var Ze=e("getSelection",J.z.undefined()),Ne=d("onSelectionChange"),K={methods:[Ze],listeners:[Ne]};var s=require("zod"),Q=s.z.object({showLegend:s.z.boolean().optional(),cooperativeGestures:s.z.boolean().optional(),fullScreenButton:s.z.boolean().optional(),geolocation:s.z.boolean().optional(),zoomControls:s.z.boolean().optional(),scaleBar:s.z.boolean().optional()}),X=s.z.object({featureSelectPanel:s.z.boolean().optional(),featureHoverPanel:s.z.boolean().optional(),elementSelectPanel:s.z.boolean().optional(),linkClickOpen:s.z.boolean().optional(),imageLightboxOpen:s.z.boolean().optional()});var Ae=e("updateUiControls",Q),qe=e("setOnMapInteractionsUi",X),Y={methods:[Ae,qe],listeners:null};var te=require("zod");var b=require("zod");var _=b.z.object({center:w,zoom:O}),$=b.z.object({center:_.shape.center.optional(),zoom:_.shape.zoom.optional()}),ee=b.z.object({bounds:T});var He=e("getViewport",te.z.undefined()),We=e("setViewport",$),De=e("fitViewportToBounds",ee),Je=d("onViewportMove"),Ke=d("onViewportMoveEnd"),oe={methods:[We,He,De],listeners:[Je,Ke]};var V=[Y,oe,D,R,K,U];function Qe(o,n,u){let M=new Map;async function c(y){if(!et.safeParse(y.data).success){u?.onUnknownMessage?.(y.data);return}let P=re.safeParse(y.data);if(!P.success){u?.onInvalidMessage?.(y.data);return}let{data:i}=P;if(i.type==="felt.ready")y.ports[0]?.postMessage(!0);else if(i.type==="felt.addListener"){if(i.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let G="options"in i.event?{options:"options"in i.event?i.event.options:void 0,handler:x=>{y.ports[0]?.postMessage(x)}}:{handler:x=>{y.ports[0]?.postMessage(x)}},I=n.listeners[i.event.eventName](G);M.set(i.event.id,I)}else if(i.type==="felt.removeListener")M.get(i.id)?.(),M.delete(i.id);else{let G=n.methods[i.type],I=await G(i.params);y.ports[0]?.postMessage(I)}}return o.addEventListener("message",c),()=>{o.removeEventListener("message",c)}}var ne={methods:V.map(o=>o.methods??[]).flat(),listeners:V.map(o=>o.listeners??[]).flat()},Xe=a.z.discriminatedUnion("eventName",[a.z.strictObject({eventName:a.z.literal("")}),...ne.listeners]),Ye=a.z.strictObject({type:a.z.literal("felt.addListener"),event:Xe}),_e=a.z.strictObject({type:a.z.literal("felt.removeListener"),id:a.z.string()}),$e=a.z.strictObject({type:a.z.literal("felt.ready")}),re=a.z.discriminatedUnion("type",[$e,Ye,_e,...ne.methods]),et=a.z.object({type:a.z.enum(re.options.map(o=>o.shape.type.value))});0&&(module.exports={createMessageHandler});
|
package/package.json
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@feltmaps/js-sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "An SDK for Felt maps",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"felt",
|
|
7
|
+
"sdk"
|
|
8
|
+
],
|
|
9
|
+
"main": "./dist/client.cjs",
|
|
10
|
+
"types": "./dist/client.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/client.js",
|
|
14
|
+
"require": "./dist/client.cjs"
|
|
15
|
+
},
|
|
16
|
+
"./handler": {
|
|
17
|
+
"import": "./dist/handler.js",
|
|
18
|
+
"require": "./dist/handler.cjs"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"author": "Felt <engineering@felt.com> (https://felt.com)",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"handler.js",
|
|
26
|
+
"handler.d.ts",
|
|
27
|
+
"types-*.ts"
|
|
28
|
+
],
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/felt/js-sdk.git"
|
|
32
|
+
},
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/felt/js-sdk/issues"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://developers.felt.com",
|
|
37
|
+
"type": "module",
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@arethetypeswrong/cli": "^0.16.4",
|
|
40
|
+
"@changesets/cli": "^2.27.9",
|
|
41
|
+
"@microsoft/api-extractor": "^7.47.9",
|
|
42
|
+
"@types/node": "^22.7.4",
|
|
43
|
+
"happy-dom": "^15.7.4",
|
|
44
|
+
"knip": "^5.31.0",
|
|
45
|
+
"prettier": "^3.3.3",
|
|
46
|
+
"prettier-plugin-organize-imports": "^4.1.0",
|
|
47
|
+
"tsup": "^8.3.0",
|
|
48
|
+
"typedoc": "^0.26.7",
|
|
49
|
+
"typedoc-plugin-markdown": "^4.2.9",
|
|
50
|
+
"typedoc-plugin-remark": "^1.0.3",
|
|
51
|
+
"typedoc-plugin-zod": "^1.2.1",
|
|
52
|
+
"typescript": "^5.6.2",
|
|
53
|
+
"vite-tsconfig-paths": "^5.0.1",
|
|
54
|
+
"vitest": "^2.1.2",
|
|
55
|
+
"zod": "^3.23.8"
|
|
56
|
+
},
|
|
57
|
+
"optionalDependencies": {
|
|
58
|
+
"zod": "^3.23.8"
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"build": "npm run build:compile && npm run build:docs",
|
|
62
|
+
"build:compile": "tsup",
|
|
63
|
+
"build:docs": "typedoc",
|
|
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
|
+
"check:api": "npm run build:compile && attw --pack . && api-extractor run",
|
|
67
|
+
"check:client-bundle": "npm run build:compile && node ./scripts/check-client-bundle-contents.js",
|
|
68
|
+
"check:docs": "npm run build:docs && bash ./scripts/check-api-docs.sh",
|
|
69
|
+
"check:format": "prettier --check .",
|
|
70
|
+
"check:unused": "knip",
|
|
71
|
+
"check:test": "vitest run",
|
|
72
|
+
"check:types": "tsc",
|
|
73
|
+
"ci": "npm run build && npm run check",
|
|
74
|
+
"update-api": "npm run build:compile && api-extractor run --local",
|
|
75
|
+
"local-release": "git checkout main && git pull && npm run ci && changeset version && changeset publish && git push --follow-tags",
|
|
76
|
+
"enter-prerelease": "changeset pre enter next",
|
|
77
|
+
"exit-prerelease": "changeset pre exit",
|
|
78
|
+
"prepublishOnly": "npm run ci"
|
|
79
|
+
}
|
|
80
|
+
}
|