@wemap/core 14.6.0-beta.4 → 14.6.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/README.md +46 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +421 -338
- package/dist/src/CoreConfig.d.ts +44 -0
- package/dist/src/CoreConfig.d.ts.map +1 -1
- package/dist/src/helpers/SnippetParser.d.ts +2 -0
- package/dist/src/helpers/SnippetParser.d.ts.map +1 -1
- package/dist/src/services/BuildingService.d.ts +4 -2
- package/dist/src/services/BuildingService.d.ts.map +1 -1
- package/dist/src/services/GeocodingService.d.ts +49 -0
- package/dist/src/services/GeocodingService.d.ts.map +1 -0
- package/dist/src/services/HttpClient.d.ts.map +1 -1
- package/dist/src/services/PinpointManager.d.ts +3 -0
- package/dist/src/services/PinpointManager.d.ts.map +1 -1
- package/dist/src/services/PinpointService.d.ts.map +1 -1
- package/dist/src/types/geocoding.d.ts +44 -0
- package/dist/src/types/geocoding.d.ts.map +1 -0
- package/dist/src/types/pinpoint.d.ts +1 -0
- package/dist/src/types/pinpoint.d.ts.map +1 -1
- package/dist/src/types/tags.d.ts +41 -0
- package/dist/src/types/tags.d.ts.map +1 -0
- package/dist/src/utils/map.d.ts +1 -1
- package/dist/src/utils/map.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/vitest.config.d.ts +0 -3
- package/dist/vitest.config.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@ The core package provides the foundational functionality for the Wemap SDK, incl
|
|
|
8
8
|
- **Configuration Management**: Access global configuration across all SDK packages
|
|
9
9
|
- **HTTP Client**: Robust HTTP client with automatic JSON parsing, error handling, and timeout support
|
|
10
10
|
- **Livemap Service**: Fetch and parse livemap data from the Wemap API
|
|
11
|
+
- **Geocoding**: Forward and reverse geocoding via the Wemap geocoding API
|
|
11
12
|
|
|
12
13
|
## Getting Started
|
|
13
14
|
|
|
@@ -17,8 +18,7 @@ import { core } from '@wemap/core';
|
|
|
17
18
|
// Initialize the SDK
|
|
18
19
|
await core.init({
|
|
19
20
|
emmid: 'your-emmid',
|
|
20
|
-
token: 'your-token'
|
|
21
|
-
env: 'production' // or 'development'
|
|
21
|
+
token: 'your-token'
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
// Access configuration
|
|
@@ -30,6 +30,7 @@ const config = CoreConfig.getConfig();
|
|
|
30
30
|
- **CoreConfig**: Main configuration class for SDK initialization
|
|
31
31
|
- **HttpClient**: HTTP client for making API requests
|
|
32
32
|
- **LivemapService**: Service for fetching livemap data
|
|
33
|
+
- **GeocodingService**: Forward and reverse geocoding
|
|
33
34
|
|
|
34
35
|
## Content search / pinpoint search
|
|
35
36
|
|
|
@@ -67,3 +68,46 @@ Query normalisation (livemap parity):
|
|
|
67
68
|
The exported `Pinpoint` type is a minimal read model: `id`, `name`,
|
|
68
69
|
`description?`, coordinates, `level?`, `altitude?`, `tags?`, `category?`,
|
|
69
70
|
`image_url?`, `address?`.
|
|
71
|
+
|
|
72
|
+
## Geocoding
|
|
73
|
+
|
|
74
|
+
Forward and reverse geocoding against `https://geocoding.getwemap.workers.dev`.
|
|
75
|
+
Does not require `core.init()`:
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
import { GeocodingService, core } from '@wemap/core';
|
|
79
|
+
|
|
80
|
+
const geocoding = core.createGeocodingService({ language: 'fr', region: 'fr' });
|
|
81
|
+
// or: new GeocodingService({ language: 'fr' })
|
|
82
|
+
|
|
83
|
+
const place = await geocoding.search('Paris');
|
|
84
|
+
const places = await geocoding.searchMultiple('Paris');
|
|
85
|
+
const address = await geocoding.reverseGeocode(48.85, 2.35);
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`GeocodingResult` exposes `id`, `placeType`, `relevance`, `text`, `placeName`,
|
|
89
|
+
`language?`, `latitude`, `longitude`, and optional `bbox` as
|
|
90
|
+
`[west, south, east, north]`. Per-call `language` / `region` / `bbox` override
|
|
91
|
+
constructor defaults.
|
|
92
|
+
|
|
93
|
+
## Tags & categories
|
|
94
|
+
|
|
95
|
+
Livemaps ship with a tag configuration:
|
|
96
|
+
the tags used to classify pinpoints, and the categories they can be grouped by.
|
|
97
|
+
Read them after `core.init()` to build tag filters, legends or category menus:
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
import { CoreConfig, core } from '@wemap/core';
|
|
101
|
+
|
|
102
|
+
await core.init({ emmid: '31668', token: 'YOUR_TOKEN' });
|
|
103
|
+
|
|
104
|
+
const { tags, categories } = CoreConfig.getTagsConfig();
|
|
105
|
+
|
|
106
|
+
// e.g. group tags by category slug
|
|
107
|
+
const transport = tags.filter((tag) => tag.category === 'transport');
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Each `LivemapTag` exposes `name`, `slug`, and optional `category` (a category
|
|
111
|
+
slug), `color` and `icon`. A pinpoint references its tags by `slug`
|
|
112
|
+
(`Pinpoint.tags`), so you can join the two. Each `LivemapTagCategory` exposes
|
|
113
|
+
`name` and `slug`. Both arrays are empty when the livemap has no tags.
|
package/dist/index.d.ts
CHANGED
|
@@ -5,10 +5,13 @@ export * from './src/CoreConfig';
|
|
|
5
5
|
export * from './src/services/LivemapService';
|
|
6
6
|
export * from './src/services/BuildingService';
|
|
7
7
|
export * from './src/services/PinpointManager';
|
|
8
|
+
export * from './src/services/GeocodingService';
|
|
8
9
|
export * from './src/services/HttpClient';
|
|
9
10
|
export type { LatLngLike } from './src/types/common';
|
|
10
11
|
export type { Building, IndoorLevel } from './src/types/indoor';
|
|
11
12
|
export type { Pinpoint, PinpointBoundsParams, PinpointSearchQuery, PinpointSearchResponse, PinpointResolver, } from './src/types/pinpoint';
|
|
13
|
+
export type { GeocodingResult, GeocodingSearchOptions, GeocodingServiceOptions, } from './src/types/geocoding';
|
|
14
|
+
export type { LivemapTag, LivemapTagCategory, LivemapTagsConfig, } from './src/types/tags';
|
|
12
15
|
export { latLngLikeToCoordinates, boundsToDelta } from './src/utils/map';
|
|
13
16
|
export { DEFAULT_THEME, resolveTheme, themeToCssVariables, } from './src/theme';
|
|
14
17
|
export type { WemapTheme } from './src/theme';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,2BAA2B,CAAC;AAE1C,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChE,YAAY,EACV,QAAQ,EACR,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,2BAA2B,CAAC;AAE1C,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChE,YAAY,EACV,QAAQ,EACR,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,eAAe,EACf,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,UAAU,EACV,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEzE,OAAO,EACL,aAAa,EACb,YAAY,EACZ,mBAAmB,GACpB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC"}
|