@mapcreator/api 0.0.0-saga.3 → 0.0.0-saga.4
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/cjs/api/choropleth.d.ts +6 -1
- package/cjs/api/choropleth.d.ts.map +1 -1
- package/cjs/api/choropleth.js +2 -2
- package/cjs/api/choropleth.js.map +1 -1
- package/esm/api/choropleth.d.ts +6 -1
- package/esm/api/choropleth.d.ts.map +1 -1
- package/esm/api/choropleth.js +2 -2
- package/esm/api/choropleth.js.map +1 -1
- package/package.json +1 -1
- package/src/api/choropleth.ts +17 -16
package/cjs/api/choropleth.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Polygon } from 'geojson';
|
|
2
|
+
import { RequireAtLeastOne } from 'type-fest';
|
|
2
3
|
export type ApiSearchPoint = {
|
|
3
4
|
lat: number;
|
|
4
5
|
lng: number;
|
|
@@ -27,7 +28,11 @@ export type SingleArea = SingleOrGroupedAreaBase & {
|
|
|
27
28
|
properties: Record<string, string>;
|
|
28
29
|
};
|
|
29
30
|
export type SingleOrGroupedArea = SingleArea | GroupedArea;
|
|
30
|
-
export declare function searchSingleOrGroupedAreas(language: string,
|
|
31
|
+
export declare function searchSingleOrGroupedAreas(language: string, search: RequireAtLeastOne<{
|
|
32
|
+
searchBounds?: ApiSearchBounds;
|
|
33
|
+
query?: string;
|
|
34
|
+
searchPoint?: ApiSearchPoint;
|
|
35
|
+
}>, mode?: 'polygon' | 'group' | 'both'): Promise<SingleOrGroupedArea[]>;
|
|
31
36
|
export type GroupedAreaChild = {
|
|
32
37
|
id: number;
|
|
33
38
|
title: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choropleth.d.ts","sourceRoot":"","sources":["../../src/api/choropleth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"choropleth.d.ts","sourceRo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AC1C,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAwBhC;AAeD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC,CAAC;AAEF,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAYxG"}
|
package/cjs/api/choropleth.js
CHANGED
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.searchSingleOrGroupedAreas = searchSingleOrGroupedAreas;
|
|
4
4
|
exports.groupedAreaChildren = groupedAreaChildren;
|
|
5
5
|
const utils_js_1 = require("../utils.js");
|
|
6
|
-
async function searchSingleOrGroupedAreas(language,
|
|
6
|
+
async function searchSingleOrGroupedAreas(language, search, mode = 'both') {
|
|
7
7
|
/**
|
|
8
8
|
* TODO When SAGA search on click is implemented, remove mode and make searchBounds required
|
|
9
9
|
*/
|
|
10
|
-
return (0, utils_js_1.request)(`/v1/choropleth/polygons/search?${(0, utils_js_1.getSearchParams)(Object.assign(Object.assign(Object.assign(Object.assign({ language }, searchBounds), (query && { query })), (searchPoint && { point: searchPoint })), { mode }))}`).then(result => {
|
|
10
|
+
return (0, utils_js_1.request)(`/v1/choropleth/polygons/search?${(0, utils_js_1.getSearchParams)(Object.assign(Object.assign(Object.assign(Object.assign({ language }, search.searchBounds), (search.query && { query: search.query })), (search.searchPoint && { point: search.searchPoint })), { mode }))}`).then(result => {
|
|
11
11
|
result.forEach(elem => {
|
|
12
12
|
elem.boundingBox = JSON.parse(elem.boundingBox);
|
|
13
13
|
if (!elem.isGroup) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choropleth.js","sourceRoot":"","sources":["../../src/api/choropleth.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"choropleth.js","sourceRoot":"","sources":["../../src/api/choropleth.ts"],"names":[],"mappings":";;AAyDA,gEAgCC;AAwBD,kDAYC;AA7HD,0CAAuF;AAyDhF,KAAK,UAAU,0BAA0B,CAC9C,QAAgB,EAChB,MAIE,EACF,OAAqC,MAAM;IAE3C;;OAEG;IACH,OAAO,IAAA,kBAAO,EACZ,kCAAkC,IAAA,0BAAe,4DAC/C,QAAQ,IACL,MAAM,CAAC,YAAY,GACnB,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,GACzC,CAAC,MAAM,CAAC,WAAW,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,KACxD,IAAI,IACJ,EAAE,CACL,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;QACd,MAAM,CAAC,OAAO,CACZ,IAAI,CAAC,EAAE;YACL,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAgC,CAAY,CAAC;YAChF,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;gBAClB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAA+B,CAA2B,CAAC;YAC/F,CAAC;QACH,CAAC,CACF,CAAC;QAEF,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC;AAwBM,KAAK,UAAU,mBAAmB,CAAC,OAAe,EAAE,QAAgB;IACzE,OAAO,IAAA,kBAAO,EACZ,yBAAyB,OAAO,uBAAuB,IAAA,0BAAe,EAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CACvF,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;QACd,MAAM,CAAC,OAAO,CACZ,IAAI,CAAC,EAAE;YACL,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAA+B,CAA2B,CAAC;QAC/F,CAAC,CACF,CAAC;QAEF,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/esm/api/choropleth.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Polygon } from 'geojson';
|
|
2
|
+
import { RequireAtLeastOne } from 'type-fest';
|
|
2
3
|
export type ApiSearchPoint = {
|
|
3
4
|
lat: number;
|
|
4
5
|
lng: number;
|
|
@@ -27,7 +28,11 @@ export type SingleArea = SingleOrGroupedAreaBase & {
|
|
|
27
28
|
properties: Record<string, string>;
|
|
28
29
|
};
|
|
29
30
|
export type SingleOrGroupedArea = SingleArea | GroupedArea;
|
|
30
|
-
export declare function searchSingleOrGroupedAreas(language: string,
|
|
31
|
+
export declare function searchSingleOrGroupedAreas(language: string, search: RequireAtLeastOne<{
|
|
32
|
+
searchBounds?: ApiSearchBounds;
|
|
33
|
+
query?: string;
|
|
34
|
+
searchPoint?: ApiSearchPoint;
|
|
35
|
+
}>, mode?: 'polygon' | 'group' | 'both'): Promise<SingleOrGroupedArea[]>;
|
|
31
36
|
export type GroupedAreaChild = {
|
|
32
37
|
id: number;
|
|
33
38
|
title: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choropleth.d.ts","sourceRoot":"","sources":["../../src/api/choropleth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"choropleth.d.ts","sourceRoot":"","sources":["../../src/api/choropleth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;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AS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC,CAAC;AAEF,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAYxG"}
|
package/esm/api/choropleth.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getSearchParams, request } from '../utils.js';
|
|
2
|
-
export async function searchSingleOrGroupedAreas(language,
|
|
2
|
+
export async function searchSingleOrGroupedAreas(language, search, mode = 'both') {
|
|
3
3
|
/**
|
|
4
4
|
* TODO When SAGA search on click is implemented, remove mode and make searchBounds required
|
|
5
5
|
*/
|
|
6
|
-
return request(`/v1/choropleth/polygons/search?${getSearchParams(Object.assign(Object.assign(Object.assign(Object.assign({ language }, searchBounds), (query && { query })), (searchPoint && { point: searchPoint })), { mode }))}`).then(result => {
|
|
6
|
+
return request(`/v1/choropleth/polygons/search?${getSearchParams(Object.assign(Object.assign(Object.assign(Object.assign({ language }, search.searchBounds), (search.query && { query: search.query })), (search.searchPoint && { point: search.searchPoint })), { mode }))}`).then(result => {
|
|
7
7
|
result.forEach(elem => {
|
|
8
8
|
elem.boundingBox = JSON.parse(elem.boundingBox);
|
|
9
9
|
if (!elem.isGroup) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choropleth.js","sourceRoot":"","sources":["../../src/api/choropleth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,eAAe,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"choropleth.js","sourceRoot":"","sources":["../../src/api/choropleth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,eAAe,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAyDvF,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,QAAgB,EAChB,MAIE,EACF,OAAqC,MAAM;IAE3C;;OAEG;IACH,OAAO,OAAO,CACZ,kCAAkC,eAAe,2DAC/C,QAAQ,IACL,MAAM,CAAC,YAAY,GACnB,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,GACzC,CAAC,MAAM,CAAC,WAAW,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,KACxD,IAAI,IACJ,EAAE,CACL,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;QACd,MAAM,CAAC,OAAO,CACZ,IAAI,CAAC,EAAE;YACL,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAgC,CAAY,CAAC;YAChF,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;gBAClB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAA+B,CAA2B,CAAC;YAC/F,CAAC;QACH,CAAC,CACF,CAAC;QAEF,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC;AAwBD,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,OAAe,EAAE,QAAgB;IACzE,OAAO,OAAO,CACZ,yBAAyB,OAAO,uBAAuB,eAAe,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CACvF,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;QACd,MAAM,CAAC,OAAO,CACZ,IAAI,CAAC,EAAE;YACL,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAA+B,CAA2B,CAAC;QAC/F,CAAC,CACF,CAAC;QAEF,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
package/src/api/choropleth.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ApiError, type ApiSuccess, getSearchParams, request } from '../utils.js';
|
|
2
2
|
import type { Polygon } from 'geojson';
|
|
3
|
+
import { RequireAtLeastOne } from 'type-fest';
|
|
3
4
|
|
|
4
5
|
export type ApiSearchPoint = {
|
|
5
6
|
lat: number;
|
|
@@ -13,10 +14,6 @@ export type ApiSearchBounds = {
|
|
|
13
14
|
max_lng: number;
|
|
14
15
|
};
|
|
15
16
|
|
|
16
|
-
type ApiSingleOrGroupedAreaArray =
|
|
17
|
-
| ({ data: ApiSingleOrGroupedArea[] } & Omit<ApiSuccess, 'data'>)
|
|
18
|
-
| ApiError;
|
|
19
|
-
|
|
20
17
|
type ApiSingleOrGroupedArea = {
|
|
21
18
|
id: number;
|
|
22
19
|
title: string;
|
|
@@ -30,6 +27,10 @@ type ApiSingleOrGroupedArea = {
|
|
|
30
27
|
properties: Record<string, string> | null;
|
|
31
28
|
};
|
|
32
29
|
|
|
30
|
+
type ApiSingleOrGroupedAreaArray = {
|
|
31
|
+
data: ApiSingleOrGroupedArea[];
|
|
32
|
+
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
33
|
+
|
|
33
34
|
type SingleOrGroupedAreaBase = {
|
|
34
35
|
id: number;
|
|
35
36
|
title: string;
|
|
@@ -56,9 +57,11 @@ export type SingleOrGroupedArea = SingleArea | GroupedArea;
|
|
|
56
57
|
|
|
57
58
|
export async function searchSingleOrGroupedAreas(
|
|
58
59
|
language: string,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
search: RequireAtLeastOne<{
|
|
61
|
+
searchBounds?: ApiSearchBounds;
|
|
62
|
+
query?: string;
|
|
63
|
+
searchPoint?: ApiSearchPoint;
|
|
64
|
+
}>,
|
|
62
65
|
mode: 'polygon' | 'group' | 'both' = 'both',
|
|
63
66
|
): Promise<SingleOrGroupedArea[]> {
|
|
64
67
|
/**
|
|
@@ -67,9 +70,9 @@ export async function searchSingleOrGroupedAreas(
|
|
|
67
70
|
return request<ApiSingleOrGroupedAreaArray, SingleOrGroupedArea>(
|
|
68
71
|
`/v1/choropleth/polygons/search?${getSearchParams({
|
|
69
72
|
language,
|
|
70
|
-
...searchBounds,
|
|
71
|
-
...(query && { query }),
|
|
72
|
-
...(searchPoint && { point: searchPoint }),
|
|
73
|
+
...search.searchBounds,
|
|
74
|
+
...(search.query && { query: search.query }),
|
|
75
|
+
...(search.searchPoint && { point: search.searchPoint }),
|
|
73
76
|
mode,
|
|
74
77
|
})}`,
|
|
75
78
|
).then(result => {
|
|
@@ -86,12 +89,6 @@ export async function searchSingleOrGroupedAreas(
|
|
|
86
89
|
});
|
|
87
90
|
}
|
|
88
91
|
|
|
89
|
-
type ApiGroupedAreaChildArray =
|
|
90
|
-
| ({
|
|
91
|
-
data: ApiGroupedAreaChild[];
|
|
92
|
-
} & Omit<ApiSuccess, 'data'>)
|
|
93
|
-
| ApiError;
|
|
94
|
-
|
|
95
92
|
type ApiGroupedAreaChild = {
|
|
96
93
|
id: number;
|
|
97
94
|
title: string;
|
|
@@ -101,6 +98,10 @@ type ApiGroupedAreaChild = {
|
|
|
101
98
|
properties: Record<string, string>;
|
|
102
99
|
};
|
|
103
100
|
|
|
101
|
+
type ApiGroupedAreaChildArray = {
|
|
102
|
+
data: ApiGroupedAreaChild[];
|
|
103
|
+
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
104
|
+
|
|
104
105
|
export type GroupedAreaChild = {
|
|
105
106
|
id: number;
|
|
106
107
|
title: string;
|