@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/handler.d.ts ADDED
@@ -0,0 +1,856 @@
1
+ import * as zod from 'zod';
2
+ import { z } from 'zod';
3
+ import { z as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, h as LayerGroup, l as LegendItem, o as LayerFilters, q as Feature, g as LayerChangeCallbackParams, j as LayerGroupChangeCallbackParams, n as LegendItemChangeCallbackParams, y as FilterTernary, r as EntityNode, V as ViewportState, W as UnionToIntersection, X as PromiseOrNot } from './types-0v6svQ9V.js';
4
+
5
+ type Method<TRequest extends {
6
+ type: string;
7
+ params?: any;
8
+ }, TResponse> = {
9
+ request: TRequest;
10
+ response: TResponse;
11
+ };
12
+ type Listener<TOptions, TParams> = {
13
+ options: TOptions;
14
+ eventParams: TParams;
15
+ };
16
+
17
+ declare const GetElementMessage: z.ZodObject<{
18
+ type: z.ZodLiteral<"getElement">;
19
+ params: z.ZodString;
20
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
21
+ params: string;
22
+ type: "getElement";
23
+ }, {
24
+ params: string;
25
+ type: "getElement";
26
+ }>;
27
+ declare const GetElementGeometryMessage: z.ZodObject<{
28
+ type: z.ZodLiteral<"getElementGeometry">;
29
+ params: z.ZodString;
30
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
31
+ params: string;
32
+ type: "getElementGeometry";
33
+ }, {
34
+ params: string;
35
+ type: "getElementGeometry";
36
+ }>;
37
+ declare const GetElementsMessage: z.ZodObject<{
38
+ type: z.ZodLiteral<"getElements">;
39
+ params: z.ZodOptional<z.ZodObject<{
40
+ ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
41
+ }, "strip", z.ZodTypeAny, {
42
+ ids?: string[] | undefined;
43
+ }, {
44
+ ids?: string[] | undefined;
45
+ }>>;
46
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
47
+ type: "getElements";
48
+ params?: {
49
+ ids?: string[] | undefined;
50
+ } | undefined;
51
+ }, {
52
+ type: "getElements";
53
+ params?: {
54
+ ids?: string[] | undefined;
55
+ } | undefined;
56
+ }>;
57
+ declare const GetGroupMessage$1: z.ZodObject<{
58
+ type: z.ZodLiteral<"getElementGroup">;
59
+ params: z.ZodString;
60
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
61
+ params: string;
62
+ type: "getElementGroup";
63
+ }, {
64
+ params: string;
65
+ type: "getElementGroup";
66
+ }>;
67
+ declare const GetGroupsMessage$1: z.ZodObject<{
68
+ type: z.ZodLiteral<"getElementGroups">;
69
+ params: z.ZodOptional<z.ZodObject<{
70
+ ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
71
+ }, "strip", z.ZodTypeAny, {
72
+ ids?: string[] | undefined;
73
+ }, {
74
+ ids?: string[] | undefined;
75
+ }>>;
76
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
77
+ type: "getElementGroups";
78
+ params?: {
79
+ ids?: string[] | undefined;
80
+ } | undefined;
81
+ }, {
82
+ type: "getElementGroups";
83
+ params?: {
84
+ ids?: string[] | undefined;
85
+ } | undefined;
86
+ }>;
87
+ declare const SetElementGroupVisibilityMessage: z.ZodObject<{
88
+ type: z.ZodLiteral<"setElementGroupVisibility">;
89
+ params: z.ZodObject<{
90
+ show: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
91
+ hide: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
92
+ }, "strip", z.ZodTypeAny, {
93
+ show?: string[] | undefined;
94
+ hide?: string[] | undefined;
95
+ }, {
96
+ show?: string[] | undefined;
97
+ hide?: string[] | undefined;
98
+ }>;
99
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
100
+ params: {
101
+ show?: string[] | undefined;
102
+ hide?: string[] | undefined;
103
+ };
104
+ type: "setElementGroupVisibility";
105
+ }, {
106
+ params: {
107
+ show?: string[] | undefined;
108
+ hide?: string[] | undefined;
109
+ };
110
+ type: "setElementGroupVisibility";
111
+ }>;
112
+ declare const OnElementChangeMessage: z.ZodObject<{
113
+ eventName: z.ZodLiteral<"onElementChange">;
114
+ id: z.ZodString;
115
+ options: z.ZodObject<{
116
+ id: z.ZodString;
117
+ }, "strip", z.ZodTypeAny, {
118
+ id: string;
119
+ }, {
120
+ id: string;
121
+ }>;
122
+ }, "strict", z.ZodTypeAny, {
123
+ options: {
124
+ id: string;
125
+ };
126
+ eventName: "onElementChange";
127
+ id: string;
128
+ }, {
129
+ options: {
130
+ id: string;
131
+ };
132
+ eventName: "onElementChange";
133
+ id: string;
134
+ }>;
135
+ declare const OnElementGroupChangeMessage: z.ZodObject<{
136
+ eventName: z.ZodLiteral<"onElementGroupChange">;
137
+ id: z.ZodString;
138
+ options: z.ZodObject<{
139
+ id: z.ZodString;
140
+ }, "strip", z.ZodTypeAny, {
141
+ id: string;
142
+ }, {
143
+ id: string;
144
+ }>;
145
+ }, "strict", z.ZodTypeAny, {
146
+ options: {
147
+ id: string;
148
+ };
149
+ eventName: "onElementGroupChange";
150
+ id: string;
151
+ }, {
152
+ options: {
153
+ id: string;
154
+ };
155
+ eventName: "onElementGroupChange";
156
+ id: string;
157
+ }>;
158
+ type ElementsSchema = {
159
+ methods: {
160
+ getElement: Method<zInfer<typeof GetElementMessage>, Element | null>;
161
+ getElementGeometry: Method<zInfer<typeof GetElementGeometryMessage>, Geometry | null>;
162
+ getElements: Method<zInfer<typeof GetElementsMessage>, Array<Element | null>>;
163
+ getElementGroup: Method<zInfer<typeof GetGroupMessage$1>, ElementGroup | null>;
164
+ getElementGroups: Method<zInfer<typeof GetGroupsMessage$1>, Array<ElementGroup | null>>;
165
+ setElementGroupVisibility: Method<zInfer<typeof SetElementGroupVisibilityMessage>, void>;
166
+ };
167
+ listeners: {
168
+ onElementChange: Listener<zInfer<typeof OnElementChangeMessage.shape.options>, ElementChangeCallbackParams>;
169
+ onElementGroupChange: Listener<zInfer<typeof OnElementGroupChangeMessage.shape.options>, ElementGroupChangeCallbackParams>;
170
+ };
171
+ };
172
+
173
+ type InteractionsSchema = {
174
+ methods: {};
175
+ listeners: {
176
+ onPointerClick: Listener<void, MapInteractionEvent>;
177
+ onPointerMove: Listener<void, MapInteractionEvent>;
178
+ };
179
+ };
180
+
181
+ declare const GetLayerMessage: z.ZodObject<{
182
+ type: z.ZodLiteral<"getLayer">;
183
+ params: z.ZodString;
184
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
185
+ params: string;
186
+ type: "getLayer";
187
+ }, {
188
+ params: string;
189
+ type: "getLayer";
190
+ }>;
191
+ declare const GetLayersMessage: z.ZodObject<{
192
+ type: z.ZodLiteral<"getLayers">;
193
+ params: z.ZodOptional<z.ZodObject<{
194
+ ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
195
+ }, "strip", z.ZodTypeAny, {
196
+ ids?: string[] | undefined;
197
+ }, {
198
+ ids?: string[] | undefined;
199
+ }>>;
200
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
201
+ type: "getLayers";
202
+ params?: {
203
+ ids?: string[] | undefined;
204
+ } | undefined;
205
+ }, {
206
+ type: "getLayers";
207
+ params?: {
208
+ ids?: string[] | undefined;
209
+ } | undefined;
210
+ }>;
211
+ declare const SetLayerVisibilityMessage: z.ZodObject<{
212
+ type: z.ZodLiteral<"setLayerVisibility">;
213
+ params: z.ZodObject<{
214
+ show: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
215
+ hide: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
216
+ }, "strip", z.ZodTypeAny, {
217
+ show?: string[] | undefined;
218
+ hide?: string[] | undefined;
219
+ }, {
220
+ show?: string[] | undefined;
221
+ hide?: string[] | undefined;
222
+ }>;
223
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
224
+ params: {
225
+ show?: string[] | undefined;
226
+ hide?: string[] | undefined;
227
+ };
228
+ type: "setLayerVisibility";
229
+ }, {
230
+ params: {
231
+ show?: string[] | undefined;
232
+ hide?: string[] | undefined;
233
+ };
234
+ type: "setLayerVisibility";
235
+ }>;
236
+ declare const OnLayerChangeMessage: z.ZodObject<{
237
+ eventName: z.ZodLiteral<"onLayerChange">;
238
+ id: z.ZodString;
239
+ options: z.ZodObject<{
240
+ id: z.ZodString;
241
+ }, "strip", z.ZodTypeAny, {
242
+ id: string;
243
+ }, {
244
+ id: string;
245
+ }>;
246
+ }, "strict", z.ZodTypeAny, {
247
+ options: {
248
+ id: string;
249
+ };
250
+ eventName: "onLayerChange";
251
+ id: string;
252
+ }, {
253
+ options: {
254
+ id: string;
255
+ };
256
+ eventName: "onLayerChange";
257
+ id: string;
258
+ }>;
259
+ declare const GetGroupMessage: z.ZodObject<{
260
+ type: z.ZodLiteral<"getLayerGroup">;
261
+ params: z.ZodString;
262
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
263
+ params: string;
264
+ type: "getLayerGroup";
265
+ }, {
266
+ params: string;
267
+ type: "getLayerGroup";
268
+ }>;
269
+ declare const GetGroupsMessage: z.ZodObject<{
270
+ type: z.ZodLiteral<"getLayerGroups">;
271
+ params: z.ZodOptional<z.ZodObject<{
272
+ ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
273
+ }, "strip", z.ZodTypeAny, {
274
+ ids?: string[] | undefined;
275
+ }, {
276
+ ids?: string[] | undefined;
277
+ }>>;
278
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
279
+ type: "getLayerGroups";
280
+ params?: {
281
+ ids?: string[] | undefined;
282
+ } | undefined;
283
+ }, {
284
+ type: "getLayerGroups";
285
+ params?: {
286
+ ids?: string[] | undefined;
287
+ } | undefined;
288
+ }>;
289
+ declare const SetLayerGroupVisibilityMessage: z.ZodObject<{
290
+ type: z.ZodLiteral<"setLayerGroupVisibility">;
291
+ params: z.ZodObject<{
292
+ show: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
293
+ hide: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
294
+ }, "strip", z.ZodTypeAny, {
295
+ show?: string[] | undefined;
296
+ hide?: string[] | undefined;
297
+ }, {
298
+ show?: string[] | undefined;
299
+ hide?: string[] | undefined;
300
+ }>;
301
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
302
+ params: {
303
+ show?: string[] | undefined;
304
+ hide?: string[] | undefined;
305
+ };
306
+ type: "setLayerGroupVisibility";
307
+ }, {
308
+ params: {
309
+ show?: string[] | undefined;
310
+ hide?: string[] | undefined;
311
+ };
312
+ type: "setLayerGroupVisibility";
313
+ }>;
314
+ declare const OnLayerGroupChangeMessage: z.ZodObject<{
315
+ eventName: z.ZodLiteral<"onLayerGroupChange">;
316
+ id: z.ZodString;
317
+ options: z.ZodObject<{
318
+ id: z.ZodString;
319
+ }, "strip", z.ZodTypeAny, {
320
+ id: string;
321
+ }, {
322
+ id: string;
323
+ }>;
324
+ }, "strict", z.ZodTypeAny, {
325
+ options: {
326
+ id: string;
327
+ };
328
+ eventName: "onLayerGroupChange";
329
+ id: string;
330
+ }, {
331
+ options: {
332
+ id: string;
333
+ };
334
+ eventName: "onLayerGroupChange";
335
+ id: string;
336
+ }>;
337
+ declare const GetLegendItemMessage: z.ZodObject<{
338
+ type: z.ZodLiteral<"getLegendItem">;
339
+ params: z.ZodObject<{
340
+ id: z.ZodString;
341
+ layerId: z.ZodString;
342
+ }, "strip", z.ZodTypeAny, {
343
+ id: string;
344
+ layerId: string;
345
+ }, {
346
+ id: string;
347
+ layerId: string;
348
+ }>;
349
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
350
+ params: {
351
+ id: string;
352
+ layerId: string;
353
+ };
354
+ type: "getLegendItem";
355
+ }, {
356
+ params: {
357
+ id: string;
358
+ layerId: string;
359
+ };
360
+ type: "getLegendItem";
361
+ }>;
362
+ declare const GetLegendItemsMessage: z.ZodObject<{
363
+ type: z.ZodLiteral<"getLegendItems">;
364
+ params: z.ZodOptional<z.ZodObject<{
365
+ ids: z.ZodOptional<z.ZodArray<z.ZodObject<{
366
+ id: z.ZodString;
367
+ layerId: z.ZodString;
368
+ }, "strip", z.ZodTypeAny, {
369
+ id: string;
370
+ layerId: string;
371
+ }, {
372
+ id: string;
373
+ layerId: string;
374
+ }>, "many">>;
375
+ layerIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
376
+ }, "strip", z.ZodTypeAny, {
377
+ ids?: {
378
+ id: string;
379
+ layerId: string;
380
+ }[] | undefined;
381
+ layerIds?: string[] | undefined;
382
+ }, {
383
+ ids?: {
384
+ id: string;
385
+ layerId: string;
386
+ }[] | undefined;
387
+ layerIds?: string[] | undefined;
388
+ }>>;
389
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
390
+ type: "getLegendItems";
391
+ params?: {
392
+ ids?: {
393
+ id: string;
394
+ layerId: string;
395
+ }[] | undefined;
396
+ layerIds?: string[] | undefined;
397
+ } | undefined;
398
+ }, {
399
+ type: "getLegendItems";
400
+ params?: {
401
+ ids?: {
402
+ id: string;
403
+ layerId: string;
404
+ }[] | undefined;
405
+ layerIds?: string[] | undefined;
406
+ } | undefined;
407
+ }>;
408
+ declare const OnLegendItemChangeMessage: z.ZodObject<{
409
+ eventName: z.ZodLiteral<"onLegendItemChange">;
410
+ id: z.ZodString;
411
+ options: z.ZodObject<{
412
+ id: z.ZodString;
413
+ layerId: z.ZodString;
414
+ }, "strip", z.ZodTypeAny, {
415
+ id: string;
416
+ layerId: string;
417
+ }, {
418
+ id: string;
419
+ layerId: string;
420
+ }>;
421
+ }, "strict", z.ZodTypeAny, {
422
+ options: {
423
+ id: string;
424
+ layerId: string;
425
+ };
426
+ eventName: "onLegendItemChange";
427
+ id: string;
428
+ }, {
429
+ options: {
430
+ id: string;
431
+ layerId: string;
432
+ };
433
+ eventName: "onLegendItemChange";
434
+ id: string;
435
+ }>;
436
+ declare const SetLegendItemVisibilityMessage: z.ZodObject<{
437
+ type: z.ZodLiteral<"setLegendItemVisibility">;
438
+ params: z.ZodObject<{
439
+ show: z.ZodOptional<z.ZodArray<z.ZodObject<{
440
+ id: z.ZodString;
441
+ layerId: z.ZodString;
442
+ }, "strip", z.ZodTypeAny, {
443
+ id: string;
444
+ layerId: string;
445
+ }, {
446
+ id: string;
447
+ layerId: string;
448
+ }>, "many">>;
449
+ hide: z.ZodOptional<z.ZodArray<z.ZodObject<{
450
+ id: z.ZodString;
451
+ layerId: z.ZodString;
452
+ }, "strip", z.ZodTypeAny, {
453
+ id: string;
454
+ layerId: string;
455
+ }, {
456
+ id: string;
457
+ layerId: string;
458
+ }>, "many">>;
459
+ }, "strip", z.ZodTypeAny, {
460
+ show?: {
461
+ id: string;
462
+ layerId: string;
463
+ }[] | undefined;
464
+ hide?: {
465
+ id: string;
466
+ layerId: string;
467
+ }[] | undefined;
468
+ }, {
469
+ show?: {
470
+ id: string;
471
+ layerId: string;
472
+ }[] | undefined;
473
+ hide?: {
474
+ id: string;
475
+ layerId: string;
476
+ }[] | undefined;
477
+ }>;
478
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
479
+ params: {
480
+ show?: {
481
+ id: string;
482
+ layerId: string;
483
+ }[] | undefined;
484
+ hide?: {
485
+ id: string;
486
+ layerId: string;
487
+ }[] | undefined;
488
+ };
489
+ type: "setLegendItemVisibility";
490
+ }, {
491
+ params: {
492
+ show?: {
493
+ id: string;
494
+ layerId: string;
495
+ }[] | undefined;
496
+ hide?: {
497
+ id: string;
498
+ layerId: string;
499
+ }[] | undefined;
500
+ };
501
+ type: "setLegendItemVisibility";
502
+ }>;
503
+ declare const GetFiltersMessage: z.ZodObject<{
504
+ type: z.ZodLiteral<"getLayerFilters">;
505
+ params: z.ZodString;
506
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
507
+ params: string;
508
+ type: "getLayerFilters";
509
+ }, {
510
+ params: string;
511
+ type: "getLayerFilters";
512
+ }>;
513
+ declare const SetFiltersMessage: z.ZodObject<{
514
+ type: z.ZodLiteral<"setLayerFilters">;
515
+ params: z.ZodObject<{
516
+ layerId: z.ZodString;
517
+ filters: z.ZodUnion<[z.ZodType<FilterTernary, z.ZodTypeDef, FilterTernary>, z.ZodUnion<[z.ZodTuple<[z.ZodUnion<[z.ZodString, z.ZodNull]>, z.ZodEnum<["in", "ni"]>, z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>, "many">, z.ZodNull]>], null>, z.ZodTuple<[z.ZodUnion<[z.ZodString, z.ZodNull]>, z.ZodEnum<["lt", "gt", "le", "ge", "eq", "ne", "cn", "nc", "is", "isnt"]>, z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>], null>]>, z.ZodNull, z.ZodBoolean]>;
518
+ }, "strip", z.ZodTypeAny, {
519
+ layerId: string;
520
+ filters: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null;
521
+ }, {
522
+ layerId: string;
523
+ filters: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null;
524
+ }>;
525
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
526
+ params: {
527
+ layerId: string;
528
+ filters: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null;
529
+ };
530
+ type: "setLayerFilters";
531
+ }, {
532
+ params: {
533
+ layerId: string;
534
+ filters: boolean | [string | null, "in" | "ni", (string | number | boolean | null)[] | null] | [string | null, "lt" | "gt" | "le" | "ge" | "eq" | "ne" | "cn" | "nc" | "is" | "isnt", string | number | boolean | null] | FilterTernary | null;
535
+ };
536
+ type: "setLayerFilters";
537
+ }>;
538
+ declare const GetRenderedFeaturesMessage: z.ZodObject<{
539
+ type: z.ZodLiteral<"getRenderedFeatures">;
540
+ params: z.ZodOptional<z.ZodObject<{
541
+ layerIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
542
+ }, "strip", z.ZodTypeAny, {
543
+ layerIds?: string[] | undefined;
544
+ }, {
545
+ layerIds?: string[] | undefined;
546
+ }>>;
547
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
548
+ type: "getRenderedFeatures";
549
+ params?: {
550
+ layerIds?: string[] | undefined;
551
+ } | undefined;
552
+ }, {
553
+ type: "getRenderedFeatures";
554
+ params?: {
555
+ layerIds?: string[] | undefined;
556
+ } | undefined;
557
+ }>;
558
+ type LayersSchema = {
559
+ methods: {
560
+ getLayer: Method<zInfer<typeof GetLayerMessage>, Layer | null>;
561
+ getLayers: Method<zInfer<typeof GetLayersMessage>, Array<Layer | null>>;
562
+ setLayerVisibility: Method<zInfer<typeof SetLayerVisibilityMessage>, void>;
563
+ getLayerGroup: Method<zInfer<typeof GetGroupMessage>, LayerGroup | null>;
564
+ getLayerGroups: Method<zInfer<typeof GetGroupsMessage>, Array<LayerGroup | null>>;
565
+ setLayerGroupVisibility: Method<zInfer<typeof SetLayerGroupVisibilityMessage>, void>;
566
+ getLegendItem: Method<zInfer<typeof GetLegendItemMessage>, LegendItem | null>;
567
+ getLegendItems: Method<zInfer<typeof GetLegendItemsMessage>, Array<LegendItem | null>>;
568
+ setLegendItemVisibility: Method<zInfer<typeof SetLegendItemVisibilityMessage>, void>;
569
+ getLayerFilters: Method<zInfer<typeof GetFiltersMessage>, LayerFilters | null>;
570
+ setLayerFilters: Method<zInfer<typeof SetFiltersMessage>, void>;
571
+ getRenderedFeatures: Method<zInfer<typeof GetRenderedFeaturesMessage>, Array<Feature>>;
572
+ };
573
+ listeners: {
574
+ onLayerChange: Listener<zInfer<typeof OnLayerChangeMessage.shape.options>, LayerChangeCallbackParams>;
575
+ onLayerGroupChange: Listener<zInfer<typeof OnLayerGroupChangeMessage.shape.options>, LayerGroupChangeCallbackParams>;
576
+ onLegendItemChange: Listener<zInfer<typeof OnLegendItemChangeMessage.shape.options>, LegendItemChangeCallbackParams>;
577
+ };
578
+ };
579
+
580
+ declare const GetSelectionMessage: z.ZodObject<{
581
+ type: z.ZodLiteral<"getSelection">;
582
+ params: z.ZodUndefined;
583
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
584
+ type: "getSelection";
585
+ params?: undefined;
586
+ }, {
587
+ type: "getSelection";
588
+ params?: undefined;
589
+ }>;
590
+ type SelectionSchema = {
591
+ methods: {
592
+ getSelection: Method<zInfer<typeof GetSelectionMessage>, Array<EntityNode>>;
593
+ };
594
+ listeners: {
595
+ onSelectionChange: Listener<void, {
596
+ selection: Array<EntityNode>;
597
+ }>;
598
+ };
599
+ };
600
+
601
+ declare const UiControlsMessage: zod.ZodObject<{
602
+ type: zod.ZodLiteral<"updateUiControls">;
603
+ params: zod.ZodObject<{
604
+ showLegend: zod.ZodOptional<zod.ZodBoolean>;
605
+ cooperativeGestures: zod.ZodOptional<zod.ZodBoolean>;
606
+ fullScreenButton: zod.ZodOptional<zod.ZodBoolean>;
607
+ geolocation: zod.ZodOptional<zod.ZodBoolean>;
608
+ zoomControls: zod.ZodOptional<zod.ZodBoolean>;
609
+ scaleBar: zod.ZodOptional<zod.ZodBoolean>;
610
+ }, "strip", zod.ZodTypeAny, {
611
+ showLegend?: boolean | undefined;
612
+ cooperativeGestures?: boolean | undefined;
613
+ fullScreenButton?: boolean | undefined;
614
+ geolocation?: boolean | undefined;
615
+ zoomControls?: boolean | undefined;
616
+ scaleBar?: boolean | undefined;
617
+ }, {
618
+ showLegend?: boolean | undefined;
619
+ cooperativeGestures?: boolean | undefined;
620
+ fullScreenButton?: boolean | undefined;
621
+ geolocation?: boolean | undefined;
622
+ zoomControls?: boolean | undefined;
623
+ scaleBar?: boolean | undefined;
624
+ }>;
625
+ }, zod.UnknownKeysParam, zod.ZodTypeAny, {
626
+ params: {
627
+ showLegend?: boolean | undefined;
628
+ cooperativeGestures?: boolean | undefined;
629
+ fullScreenButton?: boolean | undefined;
630
+ geolocation?: boolean | undefined;
631
+ zoomControls?: boolean | undefined;
632
+ scaleBar?: boolean | undefined;
633
+ };
634
+ type: "updateUiControls";
635
+ }, {
636
+ params: {
637
+ showLegend?: boolean | undefined;
638
+ cooperativeGestures?: boolean | undefined;
639
+ fullScreenButton?: boolean | undefined;
640
+ geolocation?: boolean | undefined;
641
+ zoomControls?: boolean | undefined;
642
+ scaleBar?: boolean | undefined;
643
+ };
644
+ type: "updateUiControls";
645
+ }>;
646
+ declare const OnMapInteractionsMessage: zod.ZodObject<{
647
+ type: zod.ZodLiteral<"setOnMapInteractionsUi">;
648
+ params: zod.ZodObject<{
649
+ featureSelectPanel: zod.ZodOptional<zod.ZodBoolean>;
650
+ featureHoverPanel: zod.ZodOptional<zod.ZodBoolean>;
651
+ elementSelectPanel: zod.ZodOptional<zod.ZodBoolean>;
652
+ linkClickOpen: zod.ZodOptional<zod.ZodBoolean>;
653
+ imageLightboxOpen: zod.ZodOptional<zod.ZodBoolean>;
654
+ }, "strip", zod.ZodTypeAny, {
655
+ featureSelectPanel?: boolean | undefined;
656
+ featureHoverPanel?: boolean | undefined;
657
+ elementSelectPanel?: boolean | undefined;
658
+ linkClickOpen?: boolean | undefined;
659
+ imageLightboxOpen?: boolean | undefined;
660
+ }, {
661
+ featureSelectPanel?: boolean | undefined;
662
+ featureHoverPanel?: boolean | undefined;
663
+ elementSelectPanel?: boolean | undefined;
664
+ linkClickOpen?: boolean | undefined;
665
+ imageLightboxOpen?: boolean | undefined;
666
+ }>;
667
+ }, zod.UnknownKeysParam, zod.ZodTypeAny, {
668
+ params: {
669
+ featureSelectPanel?: boolean | undefined;
670
+ featureHoverPanel?: boolean | undefined;
671
+ elementSelectPanel?: boolean | undefined;
672
+ linkClickOpen?: boolean | undefined;
673
+ imageLightboxOpen?: boolean | undefined;
674
+ };
675
+ type: "setOnMapInteractionsUi";
676
+ }, {
677
+ params: {
678
+ featureSelectPanel?: boolean | undefined;
679
+ featureHoverPanel?: boolean | undefined;
680
+ elementSelectPanel?: boolean | undefined;
681
+ linkClickOpen?: boolean | undefined;
682
+ imageLightboxOpen?: boolean | undefined;
683
+ };
684
+ type: "setOnMapInteractionsUi";
685
+ }>;
686
+ type UiSchema = {
687
+ methods: {
688
+ updateUiControls: Method<zInfer<typeof UiControlsMessage>, void>;
689
+ setOnMapInteractionsUi: Method<zInfer<typeof OnMapInteractionsMessage>, void>;
690
+ };
691
+ listeners: {};
692
+ };
693
+
694
+ declare const GetViewportMessage: z.ZodObject<{
695
+ type: z.ZodLiteral<"getViewport">;
696
+ params: z.ZodUndefined;
697
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
698
+ type: "getViewport";
699
+ params?: undefined;
700
+ }, {
701
+ type: "getViewport";
702
+ params?: undefined;
703
+ }>;
704
+ declare const GotoViewportMessage: z.ZodObject<{
705
+ type: z.ZodLiteral<"setViewport">;
706
+ params: z.ZodObject<{
707
+ center: z.ZodOptional<z.ZodObject<{
708
+ latitude: z.ZodNumber;
709
+ longitude: z.ZodNumber;
710
+ }, "strip", z.ZodTypeAny, {
711
+ latitude: number;
712
+ longitude: number;
713
+ }, {
714
+ latitude: number;
715
+ longitude: number;
716
+ }>>;
717
+ zoom: z.ZodOptional<z.ZodNumber>;
718
+ }, "strip", z.ZodTypeAny, {
719
+ center?: {
720
+ latitude: number;
721
+ longitude: number;
722
+ } | undefined;
723
+ zoom?: number | undefined;
724
+ }, {
725
+ center?: {
726
+ latitude: number;
727
+ longitude: number;
728
+ } | undefined;
729
+ zoom?: number | undefined;
730
+ }>;
731
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
732
+ params: {
733
+ center?: {
734
+ latitude: number;
735
+ longitude: number;
736
+ } | undefined;
737
+ zoom?: number | undefined;
738
+ };
739
+ type: "setViewport";
740
+ }, {
741
+ params: {
742
+ center?: {
743
+ latitude: number;
744
+ longitude: number;
745
+ } | undefined;
746
+ zoom?: number | undefined;
747
+ };
748
+ type: "setViewport";
749
+ }>;
750
+ declare const ViewportFitBoundsMessage: z.ZodObject<{
751
+ type: z.ZodLiteral<"fitViewportToBounds">;
752
+ params: z.ZodObject<{
753
+ bounds: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
754
+ }, "strip", z.ZodTypeAny, {
755
+ bounds: [number, number, number, number];
756
+ }, {
757
+ bounds: [number, number, number, number];
758
+ }>;
759
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
760
+ params: {
761
+ bounds: [number, number, number, number];
762
+ };
763
+ type: "fitViewportToBounds";
764
+ }, {
765
+ params: {
766
+ bounds: [number, number, number, number];
767
+ };
768
+ type: "fitViewportToBounds";
769
+ }>;
770
+ type ViewportSchema = {
771
+ methods: {
772
+ getViewport: Method<zInfer<typeof GetViewportMessage>, ViewportState>;
773
+ setViewport: Method<zInfer<typeof GotoViewportMessage>, void>;
774
+ fitViewportToBounds: Method<zInfer<typeof ViewportFitBoundsMessage>, void>;
775
+ };
776
+ listeners: {
777
+ onViewportMove: Listener<void, ViewportState>;
778
+ onViewportMoveEnd: Listener<void, ViewportState>;
779
+ };
780
+ };
781
+
782
+ type AllModules = UiSchema | ViewportSchema | LayersSchema | ElementsSchema | SelectionSchema | InteractionsSchema;
783
+
784
+ type FeltHandlers = {
785
+ methods: FeltMethodHandlers;
786
+ listeners: FeltListenerHandlers;
787
+ };
788
+ type MethodSpec = UnionToIntersection<AllModules["methods"]>;
789
+ type ListenerSpec = UnionToIntersection<AllModules["listeners"]>;
790
+ type ExtractMethodParams<T extends Record<string, {
791
+ request: {
792
+ params?: any;
793
+ };
794
+ response: any;
795
+ }>> = {
796
+ [K in keyof T]: {
797
+ request: T[K]["request"]["params"];
798
+ response: T[K]["response"];
799
+ };
800
+ };
801
+ type ExtractListenerParams<T extends Record<string, {
802
+ options: any;
803
+ eventParams: any;
804
+ }>> = {
805
+ [K in keyof T]: {
806
+ options: T[K]["options"];
807
+ eventParams: T[K]["eventParams"];
808
+ };
809
+ };
810
+ type MethodHandlers<T> = {
811
+ [K in keyof T]: (request: T[K] extends {
812
+ request: any;
813
+ } ? T[K]["request"] : never) => PromiseOrNot<T[K] extends {
814
+ response: any;
815
+ } ? T[K]["response"] : never>;
816
+ };
817
+ type FeltMethodHandlers = MethodHandlers<ExtractMethodParams<MethodSpec>>;
818
+ type ListenerHandlers<T> = {
819
+ [K in keyof T]: (args: {
820
+ handler: (event: T[K] extends {
821
+ eventParams: any;
822
+ } ? T[K]["eventParams"] : never) => void;
823
+ options: T[K] extends {
824
+ options: any;
825
+ } ? T[K]["options"] : never;
826
+ }) => VoidFunction;
827
+ };
828
+ type FeltListenerHandlers = ListenerHandlers<ExtractListenerParams<ListenerSpec>>;
829
+
830
+ /**
831
+ * This function creates a message handler for the Felt SDK. Its job is to start listening
832
+ * for messages from the Felt SDKl, validate and parses the messages before calling the
833
+ * appropriate handler.
834
+ *
835
+ * @param feltWindow - The window to listen on, which is typically just `window`
836
+ * @param handlers - The handlers to call for each type of message.
837
+ * @param options - Optional callbacks for handling unknown and invalid messages.
838
+ * @returns A function to stop the message handler.
839
+ */
840
+ declare function createMessageHandler(feltWindow: Window, handlers: FeltHandlers, options?: {
841
+ /**
842
+ * Called when a message is received of an unknown type.
843
+ *
844
+ * @param message - The message that was received.
845
+ */
846
+ onUnknownMessage?: (message: unknown) => void;
847
+ /**
848
+ * Called when a message is received that matches a known
849
+ * type, but fails to parse with the full schema.
850
+ *
851
+ * @param message
852
+ */
853
+ onInvalidMessage?: (message: unknown) => void;
854
+ }): VoidFunction;
855
+
856
+ export { createMessageHandler };