@mapcreator/api 5.0.0-alpha.87 → 5.0.0-alpha.88
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 +4 -81
- package/cjs/api/choropleth.d.ts.map +1 -1
- package/cjs/api/choropleth.js +17 -26
- package/cjs/api/choropleth.js.map +1 -1
- package/cjs/api/mapstyleSet.d.ts +2 -1
- package/cjs/api/mapstyleSet.d.ts.map +1 -1
- package/cjs/api/mapstyleSet.js +9 -0
- package/cjs/api/mapstyleSet.js.map +1 -1
- package/esm/api/choropleth.d.ts +4 -81
- package/esm/api/choropleth.d.ts.map +1 -1
- package/esm/api/choropleth.js +16 -23
- package/esm/api/choropleth.js.map +1 -1
- package/esm/api/mapstyleSet.d.ts +2 -1
- package/esm/api/mapstyleSet.d.ts.map +1 -1
- package/esm/api/mapstyleSet.js +8 -0
- package/esm/api/mapstyleSet.js.map +1 -1
- package/package.json +1 -1
- package/src/api/choropleth.ts +46 -142
- package/src/api/mapstyleSet.ts +23 -1
package/cjs/api/choropleth.d.ts
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import { type ApiError, type ApiSuccess,
|
|
2
|
-
import type { RequireAtLeastOne } from 'type-fest';
|
|
1
|
+
import { type ApiError, type ApiSuccess, Flatten, Revivers } from '../utils.js';
|
|
3
2
|
import type { Polygon } from 'geojson';
|
|
4
|
-
|
|
5
|
-
data: {
|
|
6
|
-
bounding_box: string;
|
|
7
|
-
};
|
|
8
|
-
} & Omit<ApiSuccess, 'data'> | ApiError, {
|
|
9
|
-
boundingBox: Polygon;
|
|
10
|
-
}>;
|
|
3
|
+
import { RequireAtLeastOne } from 'type-fest';
|
|
11
4
|
export type ApiSearchPoint = {
|
|
12
5
|
lat: number;
|
|
13
6
|
lng: number;
|
|
@@ -30,42 +23,12 @@ export type GroupedArea = SingleOrGroupedAreaBase & {
|
|
|
30
23
|
};
|
|
31
24
|
export type SingleArea = SingleOrGroupedAreaBase & {
|
|
32
25
|
isGroup: false;
|
|
33
|
-
properties: Record<string, string>;
|
|
34
26
|
vectorSource: string;
|
|
35
27
|
sourceLayer: string;
|
|
36
28
|
featureId: number;
|
|
29
|
+
properties: Record<string, string>;
|
|
37
30
|
};
|
|
38
|
-
export type SingleOrGroupedArea =
|
|
39
|
-
id: number;
|
|
40
|
-
title: string;
|
|
41
|
-
subtitle: string;
|
|
42
|
-
svgPreview: string;
|
|
43
|
-
boundingBox: Polygon;
|
|
44
|
-
isGroup: boolean;
|
|
45
|
-
properties: Record<string, string> | null;
|
|
46
|
-
vectorSource: string | null;
|
|
47
|
-
sourceLayer: string | null;
|
|
48
|
-
featureId: number | null;
|
|
49
|
-
};
|
|
50
|
-
export type ApiSingleOrGroupedArea = {
|
|
51
|
-
data: {
|
|
52
|
-
id: number;
|
|
53
|
-
title: string;
|
|
54
|
-
subtitle: string;
|
|
55
|
-
svg_preview: string;
|
|
56
|
-
bounding_box: string;
|
|
57
|
-
is_group: boolean;
|
|
58
|
-
properties: string | null;
|
|
59
|
-
vector_source: string | null;
|
|
60
|
-
source_layer: string | null;
|
|
61
|
-
feature_id: number | null;
|
|
62
|
-
};
|
|
63
|
-
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
64
|
-
export type ApiSingleOrGroupedAreaData = Flatten<Exclude<ApiSingleOrGroupedArea, ApiError>['data']>;
|
|
65
|
-
export declare const singleOrGroupedAreaRevivers: Revivers<ApiSingleOrGroupedArea, SingleOrGroupedArea>;
|
|
66
|
-
/**
|
|
67
|
-
* TODO When SAGA search on click is implemented, remove mode and make searchBounds required
|
|
68
|
-
*/
|
|
31
|
+
export type SingleOrGroupedArea = SingleArea | GroupedArea;
|
|
69
32
|
export declare function searchSingleOrGroupedAreas(language: string, search: RequireAtLeastOne<{
|
|
70
33
|
searchBounds?: ApiSearchBounds;
|
|
71
34
|
query?: string;
|
|
@@ -94,45 +57,5 @@ type ApiGroupedAreaChild = {
|
|
|
94
57
|
export type ApiGroupedAreaChildData = Flatten<Exclude<ApiGroupedAreaChild, ApiError>['data']>;
|
|
95
58
|
export declare const groupedAreaChildRevivers: Revivers<ApiGroupedAreaChild, GroupedAreaChild>;
|
|
96
59
|
export declare function groupedAreaChildren(groupId: number, language: string): Promise<GroupedAreaChild[]>;
|
|
97
|
-
export type MatchedGroup = {
|
|
98
|
-
id: number;
|
|
99
|
-
sml: number;
|
|
100
|
-
childrenCount: number;
|
|
101
|
-
matchField: string;
|
|
102
|
-
boundingBox: Polygon;
|
|
103
|
-
property: string;
|
|
104
|
-
name: string;
|
|
105
|
-
};
|
|
106
|
-
export type ApiMatchedGroup = {
|
|
107
|
-
data: {
|
|
108
|
-
id: number;
|
|
109
|
-
sml: number;
|
|
110
|
-
children_count: number;
|
|
111
|
-
match_field: string;
|
|
112
|
-
bounding_box: string;
|
|
113
|
-
property: string;
|
|
114
|
-
name: string;
|
|
115
|
-
};
|
|
116
|
-
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
117
|
-
export type ApiMatchedGroupData = Flatten<Exclude<ApiMatchedGroup, ApiError>['data']>;
|
|
118
|
-
export declare function getGroupsByDataSample(sample: Record<string, string[]>, language: string, rowCount: number): Promise<MatchedGroup[]>;
|
|
119
|
-
export type BoundPolygon = {
|
|
120
|
-
index: number;
|
|
121
|
-
inputName: string;
|
|
122
|
-
id: number;
|
|
123
|
-
sml: number;
|
|
124
|
-
name: string;
|
|
125
|
-
};
|
|
126
|
-
export type ApiBoundPolygon = {
|
|
127
|
-
data: {
|
|
128
|
-
index: number;
|
|
129
|
-
input_name: string;
|
|
130
|
-
id: number;
|
|
131
|
-
sml: number;
|
|
132
|
-
name: string;
|
|
133
|
-
};
|
|
134
|
-
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
135
|
-
export type ApiBoundPolygonData = Flatten<Exclude<ApiBoundPolygon, ApiError>['data']>;
|
|
136
|
-
export declare function getBoundPolygons(groupId: number, property: string, data: string[], language: string): Promise<BoundPolygon[]>;
|
|
137
60
|
export {};
|
|
138
61
|
//# sourceMappingURL=choropleth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choropleth.d.ts","sourceRoot":"","sources":["../../src/api/choropleth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"choropleth.d.ts","sourceRoot":"","sources":["../../src/api/choropleth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,OAAO,EAAE,QAAQ,EAA4B,MAAM,aAAa,CAAC;AAC1G,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;IACZ,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAmBF,KAAK,uBAAuB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAGF,MAAM,MAAM,WAAW,GAAG,uBAAuB,GAAG;IAClD,OAAO,EAAE,IAAI,CAAC;CACf,CAAC;AAGF,MAAM,MAAM,UAAU,GAAG,uBAAuB,GAAG;IACjD,OAAO,EAAE,KAAK,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,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sB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAWxG"}
|
package/cjs/api/choropleth.js
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.groupedAreaChildRevivers =
|
|
3
|
+
exports.groupedAreaChildRevivers = void 0;
|
|
4
4
|
exports.searchSingleOrGroupedAreas = searchSingleOrGroupedAreas;
|
|
5
5
|
exports.groupedAreaChildren = groupedAreaChildren;
|
|
6
|
-
exports.getGroupsByDataSample = getGroupsByDataSample;
|
|
7
|
-
exports.getBoundPolygons = getBoundPolygons;
|
|
8
6
|
const utils_js_1 = require("../utils.js");
|
|
9
|
-
exports.boundingBoxRevivers = {
|
|
10
|
-
boundingBox: (data) => JSON.parse(data.bounding_box),
|
|
11
|
-
};
|
|
12
|
-
exports.singleOrGroupedAreaRevivers = Object.assign(Object.assign({}, exports.boundingBoxRevivers), { properties: (data) => (data.properties != null ? JSON.parse(data.properties) : null) });
|
|
13
|
-
/**
|
|
14
|
-
* TODO When SAGA search on click is implemented, remove mode and make searchBounds required
|
|
15
|
-
*/
|
|
16
7
|
async function searchSingleOrGroupedAreas(language, search, mode = 'both') {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
/**
|
|
9
|
+
* TODO When SAGA search on click is implemented, remove mode and make searchBounds required
|
|
10
|
+
*/
|
|
11
|
+
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 => {
|
|
12
|
+
result.forEach(elem => {
|
|
13
|
+
elem.boundingBox = JSON.parse(elem.boundingBox);
|
|
14
|
+
if (!elem.isGroup) {
|
|
15
|
+
elem.properties = JSON.parse(elem.properties);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return result;
|
|
19
|
+
});
|
|
22
20
|
}
|
|
23
|
-
exports.groupedAreaChildRevivers =
|
|
21
|
+
exports.groupedAreaChildRevivers = {
|
|
22
|
+
boundingBox: (data) => JSON.parse(data.bounding_box),
|
|
23
|
+
properties: (data) => JSON.parse(data.properties),
|
|
24
|
+
};
|
|
24
25
|
async function groupedAreaChildren(groupId, language) {
|
|
25
26
|
const pathname = `/v1/choropleth/groups/${groupId}/children-optimized`;
|
|
26
27
|
const query = (0, utils_js_1.getSearchParams)({ language });
|
|
@@ -28,14 +29,4 @@ async function groupedAreaChildren(groupId, language) {
|
|
|
28
29
|
const options = { revivers: exports.groupedAreaChildRevivers };
|
|
29
30
|
return (0, utils_js_1.request)(path, null, null, options);
|
|
30
31
|
}
|
|
31
|
-
async function getGroupsByDataSample(sample, language, rowCount) {
|
|
32
|
-
const path = `/v1/choropleth/groups/sample`;
|
|
33
|
-
const options = { revivers: exports.boundingBoxRevivers };
|
|
34
|
-
return (0, utils_js_1.request)(path, { sample, language, row_count: rowCount }, null, options);
|
|
35
|
-
}
|
|
36
|
-
async function getBoundPolygons(groupId, property, data, language) {
|
|
37
|
-
const path = `/v1/choropleth/groups/bind`;
|
|
38
|
-
const body = { group_id: groupId, property, data, language };
|
|
39
|
-
return (0, utils_js_1.request)(path, body);
|
|
40
|
-
}
|
|
41
32
|
//# sourceMappingURL=choropleth.js.map
|
|
@@ -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;AA+BD,kDAWC;AAnID,0CAA0G;AAyDnG,KAAK,UAAU,0BAA0B,CAC9C,QAAgB,EAChB,MAIE,EACF,OAAq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CAAwB,EAAE,CAAC;IAMvD,OAAO,IAAA,kBAAO,EAA6C,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AACxF,CAAC"}
|
package/cjs/api/mapstyleSet.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ApiCommonData, type ApiError, type ApiSuccess, type Flatten, type Revivers } from '../utils.js';
|
|
2
2
|
export type MapstyleSet = {
|
|
3
3
|
id: number;
|
|
4
4
|
name: string;
|
|
@@ -28,4 +28,5 @@ export type ApiMapstyleSet = {
|
|
|
28
28
|
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
29
29
|
export type ApiMapstyleSetData = Flatten<Exclude<ApiMapstyleSet, ApiError>['data']>;
|
|
30
30
|
export declare const mapstyleSetRevivers: Revivers<ApiMapstyleSet, MapstyleSet>;
|
|
31
|
+
export declare function listMapstyleSets(jobTypeId?: number): Promise<MapstyleSet[]>;
|
|
31
32
|
//# sourceMappingURL=mapstyleSet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapstyleSet.d.ts","sourceRoot":"","sources":["../../src/api/mapstyleSet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"mapstyleSet.d.ts","sourceRoot":"","sources":["../../src/api/mapstyleSet.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,QAAQ,EAId,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IACrB,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,OAAO,CAAC;QACtB,mBAAmB,EAAE,OAAO,CAAC;QAC7B,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,qBAAqB,EAAE,MAAM,CAAC;QAC9B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;QACpC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;QACnB,aAAa,EAAE,OAAO,CAAC;QACvB,wBAAwB,EAAE,OAAO,CAAC;QAClC,UAAU,EAAE,OAAO,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACjC,GAAG,aAAa,CAAC;CACnB,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC;AAExC,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAEpF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,cAAc,EAAE,WAAW,CAcrE,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAWjF"}
|
package/cjs/api/mapstyleSet.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mapstyleSetRevivers = void 0;
|
|
4
|
+
exports.listMapstyleSets = listMapstyleSets;
|
|
5
|
+
const utils_js_1 = require("../utils.js");
|
|
4
6
|
exports.mapstyleSetRevivers = {
|
|
5
7
|
description: undefined,
|
|
6
8
|
job_type_id: undefined,
|
|
@@ -16,4 +18,11 @@ exports.mapstyleSetRevivers = {
|
|
|
16
18
|
order: undefined,
|
|
17
19
|
custom_settings: undefined,
|
|
18
20
|
};
|
|
21
|
+
async function listMapstyleSets(jobTypeId) {
|
|
22
|
+
const pathname = `/v1/mapstyles/sets`;
|
|
23
|
+
const query = jobTypeId !== undefined ? (0, utils_js_1.getSearchParams)({ search: { job_type_id: jobTypeId } }) : null;
|
|
24
|
+
const path = query ? `${pathname}?${query}` : pathname;
|
|
25
|
+
const options = { revivers: exports.mapstyleSetRevivers };
|
|
26
|
+
return (0, utils_js_1.request)(path, null, utils_js_1.defaultListHeader, options);
|
|
27
|
+
}
|
|
19
28
|
//# sourceMappingURL=mapstyleSet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapstyleSet.js","sourceRoot":"","sources":["../../src/api/mapstyleSet.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"mapstyleSet.js","sourceRoot":"","sources":["../../src/api/mapstyleSet.ts"],"names":[],"mappings":";;;AA0DA,4CAWC;AArED,0CASqB;AAiCR,QAAA,mBAAmB,GAA0C;IACxE,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,SAAS;IACtB,qBAAqB,EAAE,SAAS;IAChC,WAAW,EAAE,SAAS;IACtB,oBAAoB,EAAE,SAAS;IAC/B,GAAG,EAAE,SAAS;IACd,aAAa,EAAE,SAAS;IACxB,wBAAwB,EAAE,SAAS;IACnC,UAAU,EAAE,SAAS;IACrB,KAAK,EAAE,SAAS;IAChB,eAAe,EAAE,SAAS;CAC3B,CAAC;AAEK,KAAK,UAAU,gBAAgB,CAAC,SAAkB;IACvD,MAAM,QAAQ,GAAG,oBAAoB,CAAC;IACtC,MAAM,KAAK,GAAG,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,IAAA,0BAAe,EAAC,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACvG,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,QAAQ,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;IACvD,MAAM,OAAO,GAAG,EAAE,QAAQ,EAAE,2BAAmB,EAAE,CAAC;IAMlD,OAAO,IAAA,kBAAO,EAAmC,IAAI,EAAE,IAAI,EAAE,4BAAiB,EAAE,OAAO,CAAC,CAAC;AAC3F,CAAC"}
|
package/esm/api/choropleth.d.ts
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import { type ApiError, type ApiSuccess,
|
|
2
|
-
import type { RequireAtLeastOne } from 'type-fest';
|
|
1
|
+
import { type ApiError, type ApiSuccess, Flatten, Revivers } from '../utils.js';
|
|
3
2
|
import type { Polygon } from 'geojson';
|
|
4
|
-
|
|
5
|
-
data: {
|
|
6
|
-
bounding_box: string;
|
|
7
|
-
};
|
|
8
|
-
} & Omit<ApiSuccess, 'data'> | ApiError, {
|
|
9
|
-
boundingBox: Polygon;
|
|
10
|
-
}>;
|
|
3
|
+
import { RequireAtLeastOne } from 'type-fest';
|
|
11
4
|
export type ApiSearchPoint = {
|
|
12
5
|
lat: number;
|
|
13
6
|
lng: number;
|
|
@@ -30,42 +23,12 @@ export type GroupedArea = SingleOrGroupedAreaBase & {
|
|
|
30
23
|
};
|
|
31
24
|
export type SingleArea = SingleOrGroupedAreaBase & {
|
|
32
25
|
isGroup: false;
|
|
33
|
-
properties: Record<string, string>;
|
|
34
26
|
vectorSource: string;
|
|
35
27
|
sourceLayer: string;
|
|
36
28
|
featureId: number;
|
|
29
|
+
properties: Record<string, string>;
|
|
37
30
|
};
|
|
38
|
-
export type SingleOrGroupedArea =
|
|
39
|
-
id: number;
|
|
40
|
-
title: string;
|
|
41
|
-
subtitle: string;
|
|
42
|
-
svgPreview: string;
|
|
43
|
-
boundingBox: Polygon;
|
|
44
|
-
isGroup: boolean;
|
|
45
|
-
properties: Record<string, string> | null;
|
|
46
|
-
vectorSource: string | null;
|
|
47
|
-
sourceLayer: string | null;
|
|
48
|
-
featureId: number | null;
|
|
49
|
-
};
|
|
50
|
-
export type ApiSingleOrGroupedArea = {
|
|
51
|
-
data: {
|
|
52
|
-
id: number;
|
|
53
|
-
title: string;
|
|
54
|
-
subtitle: string;
|
|
55
|
-
svg_preview: string;
|
|
56
|
-
bounding_box: string;
|
|
57
|
-
is_group: boolean;
|
|
58
|
-
properties: string | null;
|
|
59
|
-
vector_source: string | null;
|
|
60
|
-
source_layer: string | null;
|
|
61
|
-
feature_id: number | null;
|
|
62
|
-
};
|
|
63
|
-
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
64
|
-
export type ApiSingleOrGroupedAreaData = Flatten<Exclude<ApiSingleOrGroupedArea, ApiError>['data']>;
|
|
65
|
-
export declare const singleOrGroupedAreaRevivers: Revivers<ApiSingleOrGroupedArea, SingleOrGroupedArea>;
|
|
66
|
-
/**
|
|
67
|
-
* TODO When SAGA search on click is implemented, remove mode and make searchBounds required
|
|
68
|
-
*/
|
|
31
|
+
export type SingleOrGroupedArea = SingleArea | GroupedArea;
|
|
69
32
|
export declare function searchSingleOrGroupedAreas(language: string, search: RequireAtLeastOne<{
|
|
70
33
|
searchBounds?: ApiSearchBounds;
|
|
71
34
|
query?: string;
|
|
@@ -94,45 +57,5 @@ type ApiGroupedAreaChild = {
|
|
|
94
57
|
export type ApiGroupedAreaChildData = Flatten<Exclude<ApiGroupedAreaChild, ApiError>['data']>;
|
|
95
58
|
export declare const groupedAreaChildRevivers: Revivers<ApiGroupedAreaChild, GroupedAreaChild>;
|
|
96
59
|
export declare function groupedAreaChildren(groupId: number, language: string): Promise<GroupedAreaChild[]>;
|
|
97
|
-
export type MatchedGroup = {
|
|
98
|
-
id: number;
|
|
99
|
-
sml: number;
|
|
100
|
-
childrenCount: number;
|
|
101
|
-
matchField: string;
|
|
102
|
-
boundingBox: Polygon;
|
|
103
|
-
property: string;
|
|
104
|
-
name: string;
|
|
105
|
-
};
|
|
106
|
-
export type ApiMatchedGroup = {
|
|
107
|
-
data: {
|
|
108
|
-
id: number;
|
|
109
|
-
sml: number;
|
|
110
|
-
children_count: number;
|
|
111
|
-
match_field: string;
|
|
112
|
-
bounding_box: string;
|
|
113
|
-
property: string;
|
|
114
|
-
name: string;
|
|
115
|
-
};
|
|
116
|
-
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
117
|
-
export type ApiMatchedGroupData = Flatten<Exclude<ApiMatchedGroup, ApiError>['data']>;
|
|
118
|
-
export declare function getGroupsByDataSample(sample: Record<string, string[]>, language: string, rowCount: number): Promise<MatchedGroup[]>;
|
|
119
|
-
export type BoundPolygon = {
|
|
120
|
-
index: number;
|
|
121
|
-
inputName: string;
|
|
122
|
-
id: number;
|
|
123
|
-
sml: number;
|
|
124
|
-
name: string;
|
|
125
|
-
};
|
|
126
|
-
export type ApiBoundPolygon = {
|
|
127
|
-
data: {
|
|
128
|
-
index: number;
|
|
129
|
-
input_name: string;
|
|
130
|
-
id: number;
|
|
131
|
-
sml: number;
|
|
132
|
-
name: string;
|
|
133
|
-
};
|
|
134
|
-
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
135
|
-
export type ApiBoundPolygonData = Flatten<Exclude<ApiBoundPolygon, ApiError>['data']>;
|
|
136
|
-
export declare function getBoundPolygons(groupId: number, property: string, data: string[], language: string): Promise<BoundPolygon[]>;
|
|
137
60
|
export {};
|
|
138
61
|
//# sourceMappingURL=choropleth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choropleth.d.ts","sourceRoot":"","sources":["../../src/api/choropleth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"choropleth.d.ts","sourceRoot":"","sources":["../../src/api/choropleth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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,IAAI,GAAE,SAAS,GAAG,OAAO,GAAG,MAAe,GAC1C,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,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,aAAa,EAAE,MAAM,CAAC;QACtB,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC;AAExC,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAAC,OAAO,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAE9F,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,mBAAmB,EAAE,gBAAgB,CAGpF,CAAC;AAEF,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAWxG"}
|
package/esm/api/choropleth.js
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { getSearchParams, request } from '../utils.js';
|
|
2
|
-
export const boundingBoxRevivers = {
|
|
3
|
-
boundingBox: (data) => JSON.parse(data.bounding_box),
|
|
4
|
-
};
|
|
5
|
-
export const singleOrGroupedAreaRevivers = Object.assign(Object.assign({}, boundingBoxRevivers), { properties: (data) => (data.properties != null ? JSON.parse(data.properties) : null) });
|
|
6
|
-
/**
|
|
7
|
-
* TODO When SAGA search on click is implemented, remove mode and make searchBounds required
|
|
8
|
-
*/
|
|
9
2
|
export async function searchSingleOrGroupedAreas(language, search, mode = 'both') {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
/**
|
|
4
|
+
* TODO When SAGA search on click is implemented, remove mode and make searchBounds required
|
|
5
|
+
*/
|
|
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
|
+
result.forEach(elem => {
|
|
8
|
+
elem.boundingBox = JSON.parse(elem.boundingBox);
|
|
9
|
+
if (!elem.isGroup) {
|
|
10
|
+
elem.properties = JSON.parse(elem.properties);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
return result;
|
|
14
|
+
});
|
|
15
15
|
}
|
|
16
|
-
export const groupedAreaChildRevivers =
|
|
16
|
+
export const groupedAreaChildRevivers = {
|
|
17
|
+
boundingBox: (data) => JSON.parse(data.bounding_box),
|
|
18
|
+
properties: (data) => JSON.parse(data.properties),
|
|
19
|
+
};
|
|
17
20
|
export async function groupedAreaChildren(groupId, language) {
|
|
18
21
|
const pathname = `/v1/choropleth/groups/${groupId}/children-optimized`;
|
|
19
22
|
const query = getSearchParams({ language });
|
|
@@ -21,14 +24,4 @@ export async function groupedAreaChildren(groupId, language) {
|
|
|
21
24
|
const options = { revivers: groupedAreaChildRevivers };
|
|
22
25
|
return request(path, null, null, options);
|
|
23
26
|
}
|
|
24
|
-
export async function getGroupsByDataSample(sample, language, rowCount) {
|
|
25
|
-
const path = `/v1/choropleth/groups/sample`;
|
|
26
|
-
const options = { revivers: boundingBoxRevivers };
|
|
27
|
-
return request(path, { sample, language, row_count: rowCount }, null, options);
|
|
28
|
-
}
|
|
29
|
-
export async function getBoundPolygons(groupId, property, data, language) {
|
|
30
|
-
const path = `/v1/choropleth/groups/bind`;
|
|
31
|
-
const body = { group_id: groupId, property, data, language };
|
|
32
|
-
return request(path, body);
|
|
33
|
-
}
|
|
34
27
|
//# sourceMappingURL=choropleth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choropleth.js","sourceRoot":"","sources":["../../src/api/choropleth.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"choropleth.js","sourceRoot":"","sources":["../../src/api/choropleth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqD,eAAe,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAyD1G,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;AA0BD,MAAM,CAAC,MAAM,wBAAwB,GAAoD;IACvF,WAAW,EAAE,CAAC,IAA6B,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAY;IACxF,UAAU,EAAE,CAAC,IAA6B,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAA2B;CACrG,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,OAAe,EAAE,QAAgB;IACzE,MAAM,QAAQ,GAAG,yBAAyB,OAAO,qBAAqB,CAAC;IACvE,MAAM,KAAK,GAAG,eAAe,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAG,GAAG,QAAQ,IAAI,KAAK,EAAE,CAAC;IACpC,MAAM,OAAO,GAAG,EAAE,QAAQ,EAAE,wBAAwB,EAAE,CAAC;IAMvD,OAAO,OAAO,CAA6C,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AACxF,CAAC"}
|
package/esm/api/mapstyleSet.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ApiCommonData, type ApiError, type ApiSuccess, type Flatten, type Revivers } from '../utils.js';
|
|
2
2
|
export type MapstyleSet = {
|
|
3
3
|
id: number;
|
|
4
4
|
name: string;
|
|
@@ -28,4 +28,5 @@ export type ApiMapstyleSet = {
|
|
|
28
28
|
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
29
29
|
export type ApiMapstyleSetData = Flatten<Exclude<ApiMapstyleSet, ApiError>['data']>;
|
|
30
30
|
export declare const mapstyleSetRevivers: Revivers<ApiMapstyleSet, MapstyleSet>;
|
|
31
|
+
export declare function listMapstyleSets(jobTypeId?: number): Promise<MapstyleSet[]>;
|
|
31
32
|
//# sourceMappingURL=mapstyleSet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapstyleSet.d.ts","sourceRoot":"","sources":["../../src/api/mapstyleSet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"mapstyleSet.d.ts","sourceRoot":"","sources":["../../src/api/mapstyleSet.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,QAAQ,EAId,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IACrB,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,OAAO,CAAC;QACtB,mBAAmB,EAAE,OAAO,CAAC;QAC7B,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,qBAAqB,EAAE,MAAM,CAAC;QAC9B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;QACpC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;QACnB,aAAa,EAAE,OAAO,CAAC;QACvB,wBAAwB,EAAE,OAAO,CAAC;QAClC,UAAU,EAAE,OAAO,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACjC,GAAG,aAAa,CAAC;CACnB,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC;AAExC,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAEpF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,cAAc,EAAE,WAAW,CAcrE,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAWjF"}
|
package/esm/api/mapstyleSet.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { defaultListHeader, getSearchParams, request, } from '../utils.js';
|
|
1
2
|
export const mapstyleSetRevivers = {
|
|
2
3
|
description: undefined,
|
|
3
4
|
job_type_id: undefined,
|
|
@@ -13,4 +14,11 @@ export const mapstyleSetRevivers = {
|
|
|
13
14
|
order: undefined,
|
|
14
15
|
custom_settings: undefined,
|
|
15
16
|
};
|
|
17
|
+
export async function listMapstyleSets(jobTypeId) {
|
|
18
|
+
const pathname = `/v1/mapstyles/sets`;
|
|
19
|
+
const query = jobTypeId !== undefined ? getSearchParams({ search: { job_type_id: jobTypeId } }) : null;
|
|
20
|
+
const path = query ? `${pathname}?${query}` : pathname;
|
|
21
|
+
const options = { revivers: mapstyleSetRevivers };
|
|
22
|
+
return request(path, null, defaultListHeader, options);
|
|
23
|
+
}
|
|
16
24
|
//# sourceMappingURL=mapstyleSet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapstyleSet.js","sourceRoot":"","sources":["../../src/api/mapstyleSet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mapstyleSet.js","sourceRoot":"","sources":["../../src/api/mapstyleSet.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,iBAAiB,EACjB,eAAe,EACf,OAAO,GACR,MAAM,aAAa,CAAC;AAiCrB,MAAM,CAAC,MAAM,mBAAmB,GAA0C;IACxE,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,SAAS;IACtB,qBAAqB,EAAE,SAAS;IAChC,WAAW,EAAE,SAAS;IACtB,oBAAoB,EAAE,SAAS;IAC/B,GAAG,EAAE,SAAS;IACd,aAAa,EAAE,SAAS;IACxB,wBAAwB,EAAE,SAAS;IACnC,UAAU,EAAE,SAAS;IACrB,KAAK,EAAE,SAAS;IAChB,eAAe,EAAE,SAAS;CAC3B,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,SAAkB;IACvD,MAAM,QAAQ,GAAG,oBAAoB,CAAC;IACtC,MAAM,KAAK,GAAG,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACvG,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,QAAQ,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;IACvD,MAAM,OAAO,GAAG,EAAE,QAAQ,EAAE,mBAAmB,EAAE,CAAC;IAMlD,OAAO,OAAO,CAAmC,IAAI,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC;AAC3F,CAAC"}
|
package/package.json
CHANGED
package/src/api/choropleth.ts
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
import { type ApiError, type ApiSuccess,
|
|
2
|
-
|
|
3
|
-
import type { RequireAtLeastOne } from 'type-fest';
|
|
1
|
+
import { type ApiError, type ApiSuccess, Flatten, Revivers, getSearchParams, request } from '../utils.js';
|
|
4
2
|
import type { Polygon } from 'geojson';
|
|
5
|
-
|
|
6
|
-
export const boundingBoxRevivers: Revivers<
|
|
7
|
-
{ data: { bounding_box: string } } & Omit<ApiSuccess, 'data'> | ApiError,
|
|
8
|
-
{ boundingBox: Polygon }
|
|
9
|
-
> = {
|
|
10
|
-
boundingBox: (data: { bounding_box: string }) => JSON.parse(data.bounding_box) as Polygon,
|
|
11
|
-
};
|
|
3
|
+
import { RequireAtLeastOne } from 'type-fest';
|
|
12
4
|
|
|
13
5
|
export type ApiSearchPoint = {
|
|
14
6
|
lat: number;
|
|
@@ -22,6 +14,23 @@ export type ApiSearchBounds = {
|
|
|
22
14
|
max_lng: number;
|
|
23
15
|
};
|
|
24
16
|
|
|
17
|
+
type ApiSingleOrGroupedArea = {
|
|
18
|
+
id: number;
|
|
19
|
+
title: string;
|
|
20
|
+
subtitle: string;
|
|
21
|
+
svg_preview: string;
|
|
22
|
+
bounding_box: string;
|
|
23
|
+
is_group: boolean;
|
|
24
|
+
vector_source: string | null;
|
|
25
|
+
source_layer: string | null;
|
|
26
|
+
feature_id: number | null;
|
|
27
|
+
properties: Record<string, string> | null;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
type ApiSingleOrGroupedAreaArray = {
|
|
31
|
+
data: ApiSingleOrGroupedArea[];
|
|
32
|
+
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
33
|
+
|
|
25
34
|
type SingleOrGroupedAreaBase = {
|
|
26
35
|
id: number;
|
|
27
36
|
title: string;
|
|
@@ -38,51 +47,14 @@ export type GroupedArea = SingleOrGroupedAreaBase & {
|
|
|
38
47
|
// TODO don't export this once search on click is out
|
|
39
48
|
export type SingleArea = SingleOrGroupedAreaBase & {
|
|
40
49
|
isGroup: false;
|
|
41
|
-
properties: Record<string, string>;
|
|
42
50
|
vectorSource: string;
|
|
43
51
|
sourceLayer: string;
|
|
44
52
|
featureId: number;
|
|
53
|
+
properties: Record<string, string>;
|
|
45
54
|
};
|
|
46
55
|
|
|
47
|
-
export type SingleOrGroupedArea =
|
|
48
|
-
id: number;
|
|
49
|
-
title: string;
|
|
50
|
-
subtitle: string;
|
|
51
|
-
svgPreview: string;
|
|
52
|
-
boundingBox: Polygon;
|
|
53
|
-
isGroup: boolean;
|
|
54
|
-
properties: Record<string, string> | null;
|
|
55
|
-
vectorSource: string | null;
|
|
56
|
-
sourceLayer: string | null;
|
|
57
|
-
featureId: number | null;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export type ApiSingleOrGroupedArea = {
|
|
61
|
-
data: {
|
|
62
|
-
id: number;
|
|
63
|
-
title: string;
|
|
64
|
-
subtitle: string;
|
|
65
|
-
svg_preview: string;
|
|
66
|
-
bounding_box: string;
|
|
67
|
-
is_group: boolean;
|
|
68
|
-
properties: string | null;
|
|
69
|
-
vector_source: string | null;
|
|
70
|
-
source_layer: string | null;
|
|
71
|
-
feature_id: number | null;
|
|
72
|
-
};
|
|
73
|
-
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
74
|
-
|
|
75
|
-
export type ApiSingleOrGroupedAreaData = Flatten<Exclude<ApiSingleOrGroupedArea, ApiError>['data']>;
|
|
76
|
-
|
|
77
|
-
export const singleOrGroupedAreaRevivers: Revivers<ApiSingleOrGroupedArea, SingleOrGroupedArea> = {
|
|
78
|
-
...boundingBoxRevivers,
|
|
79
|
-
properties: (data: ApiSingleOrGroupedAreaData) =>
|
|
80
|
-
(data.properties != null ? JSON.parse(data.properties) as Record<string, string> : null),
|
|
81
|
-
};
|
|
56
|
+
export type SingleOrGroupedArea = SingleArea | GroupedArea;
|
|
82
57
|
|
|
83
|
-
/**
|
|
84
|
-
* TODO When SAGA search on click is implemented, remove mode and make searchBounds required
|
|
85
|
-
*/
|
|
86
58
|
export async function searchSingleOrGroupedAreas(
|
|
87
59
|
language: string,
|
|
88
60
|
search: RequireAtLeastOne<{
|
|
@@ -92,22 +64,29 @@ export async function searchSingleOrGroupedAreas(
|
|
|
92
64
|
}>,
|
|
93
65
|
mode: 'polygon' | 'group' | 'both' = 'both',
|
|
94
66
|
): Promise<SingleOrGroupedArea[]> {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
67
|
+
/**
|
|
68
|
+
* TODO When SAGA search on click is implemented, remove mode and make searchBounds required
|
|
69
|
+
*/
|
|
70
|
+
return request<ApiSingleOrGroupedAreaArray, SingleOrGroupedArea>(
|
|
71
|
+
`/v1/choropleth/polygons/search?${getSearchParams({
|
|
72
|
+
language,
|
|
73
|
+
...search.searchBounds,
|
|
74
|
+
...(search.query && { query: search.query }),
|
|
75
|
+
...(search.searchPoint && { point: search.searchPoint }),
|
|
76
|
+
mode,
|
|
77
|
+
})}`,
|
|
78
|
+
).then(result => {
|
|
79
|
+
result.forEach(
|
|
80
|
+
elem => {
|
|
81
|
+
elem.boundingBox = JSON.parse(elem.boundingBox as unknown as string) as Polygon;
|
|
82
|
+
if (!elem.isGroup) {
|
|
83
|
+
elem.properties = JSON.parse(elem.properties as unknown as string) as Record<string, string>;
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
return result;
|
|
102
89
|
});
|
|
103
|
-
const path = `${pathname}?${query}`;
|
|
104
|
-
const options = { revivers: singleOrGroupedAreaRevivers };
|
|
105
|
-
|
|
106
|
-
type ApiSingleOrGroupedAreaArray = {
|
|
107
|
-
data: ApiSingleOrGroupedAreaData[];
|
|
108
|
-
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
109
|
-
|
|
110
|
-
return request<ApiSingleOrGroupedAreaArray, SingleOrGroupedArea>(path, null, null, options);
|
|
111
90
|
}
|
|
112
91
|
|
|
113
92
|
export type GroupedAreaChild = {
|
|
@@ -135,7 +114,7 @@ type ApiGroupedAreaChild = {
|
|
|
135
114
|
export type ApiGroupedAreaChildData = Flatten<Exclude<ApiGroupedAreaChild, ApiError>['data']>;
|
|
136
115
|
|
|
137
116
|
export const groupedAreaChildRevivers: Revivers<ApiGroupedAreaChild, GroupedAreaChild> = {
|
|
138
|
-
|
|
117
|
+
boundingBox: (data: ApiGroupedAreaChildData) => JSON.parse(data.bounding_box) as Polygon,
|
|
139
118
|
properties: (data: ApiGroupedAreaChildData) => JSON.parse(data.properties) as Record<string, string>,
|
|
140
119
|
};
|
|
141
120
|
|
|
@@ -145,84 +124,9 @@ export async function groupedAreaChildren(groupId: number, language: string): Pr
|
|
|
145
124
|
const path = `${pathname}?${query}`;
|
|
146
125
|
const options = { revivers: groupedAreaChildRevivers };
|
|
147
126
|
|
|
148
|
-
type
|
|
127
|
+
type ApiGroupedAreaChildArray = {
|
|
149
128
|
data: ApiGroupedAreaChildData[];
|
|
150
129
|
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
151
130
|
|
|
152
|
-
return request<
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export type MatchedGroup = {
|
|
156
|
-
id: number;
|
|
157
|
-
sml: number;
|
|
158
|
-
childrenCount: number;
|
|
159
|
-
matchField: string;
|
|
160
|
-
boundingBox: Polygon;
|
|
161
|
-
property: string;
|
|
162
|
-
name: string;
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
export type ApiMatchedGroup = {
|
|
166
|
-
data: {
|
|
167
|
-
id: number;
|
|
168
|
-
sml: number;
|
|
169
|
-
children_count: number;
|
|
170
|
-
match_field: string;
|
|
171
|
-
bounding_box: string;
|
|
172
|
-
property: string;
|
|
173
|
-
name: string;
|
|
174
|
-
};
|
|
175
|
-
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
176
|
-
|
|
177
|
-
export type ApiMatchedGroupData = Flatten<Exclude<ApiMatchedGroup, ApiError>['data']>;
|
|
178
|
-
|
|
179
|
-
export async function getGroupsByDataSample(
|
|
180
|
-
sample: Record<string, string[]>,
|
|
181
|
-
language: string,
|
|
182
|
-
rowCount: number,
|
|
183
|
-
): Promise<MatchedGroup[]> {
|
|
184
|
-
const path = `/v1/choropleth/groups/sample`;
|
|
185
|
-
const options = { revivers: boundingBoxRevivers };
|
|
186
|
-
|
|
187
|
-
type ApiMatchedGroupArray = {
|
|
188
|
-
data: ApiMatchedGroupData[];
|
|
189
|
-
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
190
|
-
|
|
191
|
-
return request<ApiMatchedGroupArray, MatchedGroup>(path, { sample, language, row_count: rowCount }, null, options);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export type BoundPolygon = {
|
|
195
|
-
index: number;
|
|
196
|
-
inputName: string;
|
|
197
|
-
id: number;
|
|
198
|
-
sml: number;
|
|
199
|
-
name: string;
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
export type ApiBoundPolygon = {
|
|
203
|
-
data: {
|
|
204
|
-
index: number;
|
|
205
|
-
input_name: string;
|
|
206
|
-
id: number;
|
|
207
|
-
sml: number;
|
|
208
|
-
name: string;
|
|
209
|
-
};
|
|
210
|
-
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
211
|
-
|
|
212
|
-
export type ApiBoundPolygonData = Flatten<Exclude<ApiBoundPolygon, ApiError>['data']>;
|
|
213
|
-
|
|
214
|
-
export async function getBoundPolygons(
|
|
215
|
-
groupId: number,
|
|
216
|
-
property: string,
|
|
217
|
-
data: string[],
|
|
218
|
-
language: string,
|
|
219
|
-
): Promise<BoundPolygon[]> {
|
|
220
|
-
const path = `/v1/choropleth/groups/bind`;
|
|
221
|
-
const body = { group_id: groupId, property, data, language };
|
|
222
|
-
|
|
223
|
-
type ApiBoundPolygonArray = {
|
|
224
|
-
data: ApiBoundPolygonData[];
|
|
225
|
-
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
226
|
-
|
|
227
|
-
return request<ApiBoundPolygonArray, BoundPolygon>(path, body);
|
|
131
|
+
return request<ApiGroupedAreaChildArray, GroupedAreaChild>(path, null, null, options);
|
|
228
132
|
}
|
package/src/api/mapstyleSet.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
type ApiCommonData,
|
|
3
|
+
type ApiError,
|
|
4
|
+
type ApiSuccess,
|
|
5
|
+
type Flatten,
|
|
6
|
+
type Revivers,
|
|
7
|
+
defaultListHeader,
|
|
8
|
+
getSearchParams,
|
|
9
|
+
request,
|
|
10
|
+
} from '../utils.js';
|
|
2
11
|
|
|
3
12
|
export type MapstyleSet = {
|
|
4
13
|
id: number;
|
|
@@ -46,3 +55,16 @@ export const mapstyleSetRevivers: Revivers<ApiMapstyleSet, MapstyleSet> = {
|
|
|
46
55
|
order: undefined,
|
|
47
56
|
custom_settings: undefined,
|
|
48
57
|
};
|
|
58
|
+
|
|
59
|
+
export async function listMapstyleSets(jobTypeId?: number): Promise<MapstyleSet[]> {
|
|
60
|
+
const pathname = `/v1/mapstyles/sets`;
|
|
61
|
+
const query = jobTypeId !== undefined ? getSearchParams({ search: { job_type_id: jobTypeId } }) : null;
|
|
62
|
+
const path = query ? `${pathname}?${query}` : pathname;
|
|
63
|
+
const options = { revivers: mapstyleSetRevivers };
|
|
64
|
+
|
|
65
|
+
type ApiMapstyleSetArray = {
|
|
66
|
+
data: ApiMapstyleSetData[];
|
|
67
|
+
} & Omit<ApiSuccess, 'data'> | ApiError;
|
|
68
|
+
|
|
69
|
+
return request<ApiMapstyleSetArray, MapstyleSet>(path, null, defaultListHeader, options);
|
|
70
|
+
}
|