@uxf/smart-address 11.80.4 → 11.103.1
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/{v1 → common/__tests__}/load-address-options.test.js +22 -14
- package/{v1 → common/__tests__}/load-zip-options.test.js +10 -5
- package/{v1 → common/__tests__}/search-zip.test.js +5 -4
- package/common/__tests__/search.test.js +24 -0
- package/common/create-loader.d.ts +4 -0
- package/common/create-loader.js +7 -0
- package/common/get-address-extended.d.ts +2 -0
- package/common/get-address-extended.js +9 -0
- package/common/get-address.d.ts +2 -0
- package/common/get-address.js +9 -0
- package/common/index.d.ts +1 -0
- package/common/index.js +17 -0
- package/common/load-address-options.d.ts +11 -0
- package/common/load-address-options.js +21 -0
- package/common/load-zip-options.d.ts +8 -0
- package/common/load-zip-options.js +14 -0
- package/common/search-zip.d.ts +2 -0
- package/common/search-zip.js +19 -0
- package/common/search.d.ts +10 -0
- package/common/search.js +25 -0
- package/common/types.d.ts +88 -0
- package/common/types.js +2 -0
- package/package.json +1 -1
- package/v1/create-address-loader.d.ts +2 -2
- package/v1/create-address-loader.js +2 -9
- package/v1/create-zip-loader.d.ts +2 -2
- package/v1/create-zip-loader.js +2 -6
- package/v1/get-address-extended.d.ts +1 -2
- package/v1/get-address-extended.js +2 -6
- package/v1/get-address.d.ts +1 -2
- package/v1/get-address.js +2 -6
- package/v1/get-city-part.js +2 -2
- package/v1/get-city.js +2 -2
- package/v1/get-momc.js +2 -2
- package/v1/get-mop.js +2 -2
- package/v1/get-street.js +1 -1
- package/v1/index.d.ts +6 -3
- package/v1/load-address-options.d.ts +4 -6
- package/v1/load-address-options.js +2 -12
- package/v1/load-zip-options.d.ts +4 -6
- package/v1/load-zip-options.js +2 -11
- package/v1/search-zip.d.ts +1 -2
- package/v1/search-zip.js +2 -13
- package/v1/search.d.ts +3 -5
- package/v1/search.js +2 -19
- package/v1/types.d.ts +1 -89
- package/v1/types.js +15 -0
- package/v2/__tests__/get-building-addresses.test.d.ts +1 -0
- package/v2/__tests__/get-building-addresses.test.js +49 -0
- package/v2/__tests__/search-city-part.test.d.ts +1 -0
- package/v2/__tests__/search-city-part.test.js +46 -0
- package/v2/create-address-loader.d.ts +10 -0
- package/v2/create-address-loader.js +7 -0
- package/v2/create-zip-loader.d.ts +7 -0
- package/v2/create-zip-loader.js +7 -0
- package/v2/get-address-extended.d.ts +2 -0
- package/v2/get-address-extended.js +5 -0
- package/v2/get-address.d.ts +1 -0
- package/v2/get-address.js +5 -0
- package/v2/get-building-addresses.d.ts +2 -0
- package/v2/get-building-addresses.js +9 -0
- package/v2/index.d.ts +11 -0
- package/v2/index.js +27 -0
- package/v2/load-address-options.d.ts +8 -0
- package/v2/load-address-options.js +5 -0
- package/v2/load-zip-options.d.ts +5 -0
- package/v2/load-zip-options.js +5 -0
- package/v2/search-city-part.d.ts +2 -0
- package/v2/search-city-part.js +18 -0
- package/v2/search-zip.d.ts +1 -0
- package/v2/search-zip.js +5 -0
- package/v2/search.d.ts +7 -0
- package/v2/search.js +5 -0
- package/v2/types.d.ts +48 -0
- package/v2/types.js +17 -0
- package/v1/search.test.js +0 -33
- /package/{v1 → common/__tests__}/load-address-options.test.d.ts +0 -0
- /package/{v1 → common/__tests__}/load-zip-options.test.d.ts +0 -0
- /package/{v1 → common/__tests__}/search-zip.test.d.ts +0 -0
- /package/{v1 → common/__tests__}/search.test.d.ts +0 -0
package/v1/index.d.ts
CHANGED
|
@@ -5,10 +5,10 @@ export declare const SmartAddress: {
|
|
|
5
5
|
limit?: number;
|
|
6
6
|
zip?: number;
|
|
7
7
|
getLabel?: (address: import("./types").Location) => string;
|
|
8
|
-
}) => (
|
|
8
|
+
}) => (term: string) => Promise<import("./types").Option[]>;
|
|
9
9
|
createZipLoader: (params: {
|
|
10
10
|
getLabel?: (address: import("./types").Location) => string;
|
|
11
|
-
}) => (
|
|
11
|
+
}) => (term: string) => Promise<import("./types").Option[]>;
|
|
12
12
|
getAddress: (id: number) => Promise<import("./types").Location>;
|
|
13
13
|
getAddressExtended: (id: number) => Promise<import("./types").LocationExtended>;
|
|
14
14
|
getCity: (id: number) => Promise<import("./types").Location>;
|
|
@@ -21,10 +21,12 @@ export declare const SmartAddress: {
|
|
|
21
21
|
level: number;
|
|
22
22
|
limit?: number;
|
|
23
23
|
zip?: number;
|
|
24
|
+
address?: string;
|
|
24
25
|
getLabel?: (address: import("./types").Location) => string;
|
|
25
26
|
}) => Promise<import("./types").Option[]>;
|
|
26
27
|
loadZipOptions: (params: {
|
|
27
28
|
term: string;
|
|
29
|
+
limit?: number;
|
|
28
30
|
getLabel?: (address: import("./types").Location) => string;
|
|
29
31
|
}) => Promise<import("./types").Option[]>;
|
|
30
32
|
search: (props: {
|
|
@@ -32,6 +34,7 @@ export declare const SmartAddress: {
|
|
|
32
34
|
level: number;
|
|
33
35
|
limit?: number;
|
|
34
36
|
zip?: number;
|
|
37
|
+
address?: string;
|
|
35
38
|
}) => Promise<import("./types").Location[]>;
|
|
36
|
-
searchZip: (term: string) => Promise<import("./types").Location[]>;
|
|
39
|
+
searchZip: (term: string, limit?: number) => Promise<import("./types").Location[]>;
|
|
37
40
|
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
type Params = {
|
|
1
|
+
export declare const loadAddressOptions: (params: {
|
|
3
2
|
term: string;
|
|
4
3
|
level: number;
|
|
5
4
|
limit?: number;
|
|
6
5
|
zip?: number;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export {};
|
|
6
|
+
address?: string;
|
|
7
|
+
getLabel?: (address: import("./types").Location) => string;
|
|
8
|
+
}) => Promise<import("./types").Option[]>;
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadAddressOptions = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
var _a, _b;
|
|
7
|
-
const limit = (_a = params.limit) !== null && _a !== void 0 ? _a : 10;
|
|
8
|
-
const getLabel = (_b = params.getLabel) !== null && _b !== void 0 ? _b : ((address) => `${address.ulice}, ${address.obec}`);
|
|
9
|
-
if (params.term.length === 0) {
|
|
10
|
-
return [];
|
|
11
|
-
}
|
|
12
|
-
const response = await (0, search_1.search)({ term: params.term, level: params.level, limit, zip: params.zip });
|
|
13
|
-
return response.map((a) => ({ id: a.id, label: getLabel(a) }));
|
|
14
|
-
};
|
|
15
|
-
exports.loadAddressOptions = loadAddressOptions;
|
|
4
|
+
const load_address_options_1 = require("../common/load-address-options");
|
|
5
|
+
exports.loadAddressOptions = (0, load_address_options_1.loadAddressOptionsGeneral)("/v1/search");
|
package/v1/load-zip-options.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
type Params = {
|
|
1
|
+
export declare const loadZipOptions: (params: {
|
|
3
2
|
term: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export {};
|
|
3
|
+
limit?: number;
|
|
4
|
+
getLabel?: (address: import("./types").Location) => string;
|
|
5
|
+
}) => Promise<import("./types").Option[]>;
|
package/v1/load-zip-options.js
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadZipOptions = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
var _a;
|
|
7
|
-
const getLabel = (_a = params.getLabel) !== null && _a !== void 0 ? _a : ((address) => `${address.psc}`);
|
|
8
|
-
if (params.term.length === 0) {
|
|
9
|
-
return [];
|
|
10
|
-
}
|
|
11
|
-
const response = await (0, search_zip_1.searchZip)(params.term);
|
|
12
|
-
return response.map((a) => ({ id: a.id, label: getLabel(a) }));
|
|
13
|
-
};
|
|
14
|
-
exports.loadZipOptions = loadZipOptions;
|
|
4
|
+
const load_zip_options_1 = require("../common/load-zip-options");
|
|
5
|
+
exports.loadZipOptions = (0, load_zip_options_1.loadZipOptionsGeneral)("/v1/zip/search");
|
package/v1/search-zip.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const searchZip: (term: string) => Promise<Location[]>;
|
|
1
|
+
export declare const searchZip: (term: string, limit?: number) => Promise<import("./types").Location[]>;
|
package/v1/search-zip.js
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.searchZip = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const searchZip = async (term) => {
|
|
7
|
-
if (term.length === 0 || !regexp.test(term)) {
|
|
8
|
-
return [];
|
|
9
|
-
}
|
|
10
|
-
const response = await fetch(config_1.smartAddressUrl + "/v1/zip/search?" + new URLSearchParams({ term: term }));
|
|
11
|
-
if (response.status !== 200) {
|
|
12
|
-
return [];
|
|
13
|
-
}
|
|
14
|
-
return JSON.parse(await response.text());
|
|
15
|
-
};
|
|
16
|
-
exports.searchZip = searchZip;
|
|
4
|
+
const search_zip_1 = require("../common/search-zip");
|
|
5
|
+
exports.searchZip = (0, search_zip_1.searchZipGeneral)("/v1/zip/search");
|
package/v1/search.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
type Props = {
|
|
1
|
+
export declare const search: (props: {
|
|
3
2
|
term: string;
|
|
4
3
|
level: number;
|
|
5
4
|
limit?: number;
|
|
6
5
|
zip?: number;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {};
|
|
6
|
+
address?: string;
|
|
7
|
+
}) => Promise<import("./types").Location[]>;
|
package/v1/search.js
CHANGED
|
@@ -1,22 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.search = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
var _a;
|
|
7
|
-
const limit = (_a = props.limit) !== null && _a !== void 0 ? _a : 10;
|
|
8
|
-
if (props.term.length === 0) {
|
|
9
|
-
return [];
|
|
10
|
-
}
|
|
11
|
-
const params = new URLSearchParams({
|
|
12
|
-
term: props.term,
|
|
13
|
-
level: props.level.toString(),
|
|
14
|
-
limit: limit.toString(),
|
|
15
|
-
});
|
|
16
|
-
if (props.zip) {
|
|
17
|
-
params.append("zip", props.zip.toString());
|
|
18
|
-
}
|
|
19
|
-
const response = await fetch(config_1.smartAddressUrl + "/v1/search?" + params);
|
|
20
|
-
return JSON.parse(await response.text());
|
|
21
|
-
};
|
|
22
|
-
exports.search = search;
|
|
4
|
+
const search_1 = require("../common/search");
|
|
5
|
+
exports.search = (0, search_1.searchGeneral)("/v1/search");
|
package/v1/types.d.ts
CHANGED
|
@@ -1,89 +1 @@
|
|
|
1
|
-
|
|
2
|
-
id: number;
|
|
3
|
-
nazev: string | null;
|
|
4
|
-
};
|
|
5
|
-
type Type = {
|
|
6
|
-
id: number;
|
|
7
|
-
nazev: string | null;
|
|
8
|
-
popis: string | null;
|
|
9
|
-
zkracenyNazev: string | null;
|
|
10
|
-
zacatekPlatnosti: string | null;
|
|
11
|
-
konecPlatnosti: string | null;
|
|
12
|
-
};
|
|
13
|
-
export type ObjectType = BasicType;
|
|
14
|
-
export type ObjectTypeBasic = BasicType;
|
|
15
|
-
export type BuildingType = Type;
|
|
16
|
-
export type ConstructionType = Type;
|
|
17
|
-
export type SewerConnectionType = Type;
|
|
18
|
-
export type GasConnectionType = Type;
|
|
19
|
-
export type WaterConnectionType = Type;
|
|
20
|
-
export type ElevatorType = Type;
|
|
21
|
-
export type HeatingType = Type;
|
|
22
|
-
export type BuildingUsageType = Type;
|
|
23
|
-
export type Option = {
|
|
24
|
-
id: number;
|
|
25
|
-
label: string;
|
|
26
|
-
};
|
|
27
|
-
export type Point = {
|
|
28
|
-
latitude: string;
|
|
29
|
-
longitude: string;
|
|
30
|
-
};
|
|
31
|
-
export type Location = {
|
|
32
|
-
id: number;
|
|
33
|
-
obecKod: number;
|
|
34
|
-
obecNazev: string | null;
|
|
35
|
-
obec: string | null;
|
|
36
|
-
momcKod: number | null;
|
|
37
|
-
momcNazev: string | null;
|
|
38
|
-
mopKod: number | null;
|
|
39
|
-
mopNazev: string | null;
|
|
40
|
-
castObceKod: number | null;
|
|
41
|
-
castObceNazev: string | null;
|
|
42
|
-
uliceKod: number | null;
|
|
43
|
-
uliceNazev: string | null;
|
|
44
|
-
ulice: string | null;
|
|
45
|
-
typSo: string | null;
|
|
46
|
-
cisloDomovni: number | null;
|
|
47
|
-
cisloOrientacni: number | null;
|
|
48
|
-
cisloOrientacniZnak: string | null;
|
|
49
|
-
psc: number | null;
|
|
50
|
-
search: string | null;
|
|
51
|
-
level: number | null;
|
|
52
|
-
gps: Point | null;
|
|
53
|
-
platiOd: string | null;
|
|
54
|
-
aktualizace: string | null;
|
|
55
|
-
okresKod: number | null;
|
|
56
|
-
okresNazev: string | null;
|
|
57
|
-
krajKod: number | null;
|
|
58
|
-
krajNazev: string | null;
|
|
59
|
-
};
|
|
60
|
-
export type LocationExtended = {
|
|
61
|
-
id: number;
|
|
62
|
-
distributorElektrinyKod: string | null;
|
|
63
|
-
distributorElektrinyId: number | null;
|
|
64
|
-
distributorPlynuKod: string | null;
|
|
65
|
-
distributorPlynuId: number | null;
|
|
66
|
-
typBudovy: BuildingType | null;
|
|
67
|
-
isknBudovaId: string | null;
|
|
68
|
-
druhKonstrukce: ConstructionType | null;
|
|
69
|
-
pocetBytu: number | null;
|
|
70
|
-
pocetPodlazi: number | null;
|
|
71
|
-
pripojeniKanalizace: SewerConnectionType | null;
|
|
72
|
-
pripojeniPlyn: GasConnectionType | null;
|
|
73
|
-
pripojeniVodovod: WaterConnectionType | null;
|
|
74
|
-
vybaveniVytahem: ElevatorType | null;
|
|
75
|
-
zpusobVytapeni: HeatingType | null;
|
|
76
|
-
zastavenaPlocha: number | null;
|
|
77
|
-
obestavenyProstor: number | null;
|
|
78
|
-
podlahovaPlocha: number | null;
|
|
79
|
-
stavebniObjektKod: string | null;
|
|
80
|
-
parcelaKod: string | null;
|
|
81
|
-
zpusobVyuzitiObjektu: BuildingUsageType | null;
|
|
82
|
-
createdAt: string | null;
|
|
83
|
-
updatedAt: string | null;
|
|
84
|
-
objectType: ObjectType | null;
|
|
85
|
-
objectTypeBasic: ObjectTypeBasic | null;
|
|
86
|
-
objectSize: string | null;
|
|
87
|
-
objectSizeSquare: number | null;
|
|
88
|
-
};
|
|
89
|
-
export {};
|
|
1
|
+
export * from "../common/types";
|
package/v1/types.js
CHANGED
|
@@ -1,2 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("../common/types"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config_1 = require("../../config");
|
|
4
|
+
const get_building_addresses_1 = require("../get-building-addresses");
|
|
5
|
+
global.fetch = jest.fn();
|
|
6
|
+
describe("getBuildingAddresses", () => {
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
jest.clearAllMocks();
|
|
9
|
+
});
|
|
10
|
+
it("should fetch building addresses for given id", async () => {
|
|
11
|
+
const mockLocations = [
|
|
12
|
+
{
|
|
13
|
+
id: 1,
|
|
14
|
+
obecKod: 123,
|
|
15
|
+
obecNazev: null,
|
|
16
|
+
obec: null,
|
|
17
|
+
momcKod: null,
|
|
18
|
+
momcNazev: null,
|
|
19
|
+
mopKod: null,
|
|
20
|
+
mopNazev: null,
|
|
21
|
+
castObceKod: null,
|
|
22
|
+
castObceNazev: null,
|
|
23
|
+
uliceKod: null,
|
|
24
|
+
uliceNazev: null,
|
|
25
|
+
ulice: "Main St",
|
|
26
|
+
typSo: null,
|
|
27
|
+
cisloDomovni: null,
|
|
28
|
+
cisloOrientacni: null,
|
|
29
|
+
cisloOrientacniZnak: null,
|
|
30
|
+
psc: null,
|
|
31
|
+
search: "",
|
|
32
|
+
level: 1,
|
|
33
|
+
gps: { latitude: 50.0755, longitude: 14.4378 },
|
|
34
|
+
platiOd: "2024-01-01",
|
|
35
|
+
aktualizace: "2024-10-01",
|
|
36
|
+
okresKod: 456,
|
|
37
|
+
okresNazev: "Prague",
|
|
38
|
+
krajKod: 789,
|
|
39
|
+
krajNazev: "Czech Republic",
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
fetch.mockResolvedValue({
|
|
43
|
+
json: jest.fn().mockResolvedValue(mockLocations),
|
|
44
|
+
});
|
|
45
|
+
const result = await (0, get_building_addresses_1.getBuildingAddresses)(123);
|
|
46
|
+
expect(fetch).toHaveBeenCalledWith(`${config_1.smartAddressUrl}/v2/address/123/building-addresses`);
|
|
47
|
+
expect(result).toEqual(mockLocations);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config_1 = require("../../config");
|
|
4
|
+
const search_city_part_1 = require("../search-city-part");
|
|
5
|
+
jest.mock("../../config", () => ({
|
|
6
|
+
smartAddressUrl: "http://example.com",
|
|
7
|
+
}));
|
|
8
|
+
describe("searchCityPart", () => {
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
global.fetch = jest.fn();
|
|
11
|
+
});
|
|
12
|
+
afterEach(() => {
|
|
13
|
+
jest.resetAllMocks();
|
|
14
|
+
});
|
|
15
|
+
it("should return an empty array for empty input", async () => {
|
|
16
|
+
const result = await (0, search_city_part_1.searchCityPart)("");
|
|
17
|
+
expect(result).toEqual([]);
|
|
18
|
+
});
|
|
19
|
+
it("should return an array of city parts for valid input", async () => {
|
|
20
|
+
const mockResponse = [
|
|
21
|
+
{
|
|
22
|
+
id: 1,
|
|
23
|
+
name: "Part 1",
|
|
24
|
+
obecKod: 111,
|
|
25
|
+
obecNazev: "City 1",
|
|
26
|
+
zips: ["12345"],
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
fetch.mockImplementation(() => Promise.resolve({
|
|
30
|
+
status: 200,
|
|
31
|
+
json: () => Promise.resolve(mockResponse),
|
|
32
|
+
}));
|
|
33
|
+
const result = await (0, search_city_part_1.searchCityPart)("Vrchlabí");
|
|
34
|
+
expect(result).toEqual(mockResponse);
|
|
35
|
+
expect(fetch).toHaveBeenCalledWith(`${config_1.smartAddressUrl}/v2/city-part/search?term=Vrchlab%C3%AD`);
|
|
36
|
+
});
|
|
37
|
+
it("should respect limit parameter", async () => {
|
|
38
|
+
const mockResponse = [{ id: 1 }];
|
|
39
|
+
fetch.mockImplementation(() => Promise.resolve({
|
|
40
|
+
status: 200,
|
|
41
|
+
json: () => Promise.resolve(mockResponse),
|
|
42
|
+
}));
|
|
43
|
+
await (0, search_city_part_1.searchCityPart)("Praha", 5);
|
|
44
|
+
expect(fetch).toHaveBeenCalledWith(`${config_1.smartAddressUrl}/v2/city-part/search?term=Praha&limit=5`);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Location } from "./types";
|
|
2
|
+
type Params = {
|
|
3
|
+
level: number;
|
|
4
|
+
limit?: number;
|
|
5
|
+
zip?: number;
|
|
6
|
+
address?: string;
|
|
7
|
+
getLabel?: (address: Location) => string;
|
|
8
|
+
};
|
|
9
|
+
export declare const createAddressLoader: (params: Params) => (term: string) => Promise<import("./types").Option[]>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAddressLoader = void 0;
|
|
4
|
+
const create_loader_1 = require("../common/create-loader");
|
|
5
|
+
const load_address_options_1 = require("./load-address-options");
|
|
6
|
+
const createAddressLoader = (params) => (0, create_loader_1.createLoaderGeneral)(load_address_options_1.loadAddressOptions, params);
|
|
7
|
+
exports.createAddressLoader = createAddressLoader;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createZipLoader = void 0;
|
|
4
|
+
const create_loader_1 = require("../common/create-loader");
|
|
5
|
+
const load_zip_options_1 = require("./load-zip-options");
|
|
6
|
+
const createZipLoader = (params) => (0, create_loader_1.createLoaderGeneral)(load_zip_options_1.loadZipOptions, params);
|
|
7
|
+
exports.createZipLoader = createZipLoader;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAddressExtended = void 0;
|
|
4
|
+
const get_address_extended_1 = require("../common/get-address-extended");
|
|
5
|
+
exports.getAddressExtended = (0, get_address_extended_1.getAddressExtendedGeneral)("/v2/address/");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getAddress: (id: number) => Promise<import("./types").Location>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBuildingAddresses = void 0;
|
|
4
|
+
const config_1 = require("../config");
|
|
5
|
+
const getBuildingAddresses = async (id) => {
|
|
6
|
+
const response = await fetch(`${config_1.smartAddressUrl}/v2/address/${id}/building-addresses`);
|
|
7
|
+
return await response.json();
|
|
8
|
+
};
|
|
9
|
+
exports.getBuildingAddresses = getBuildingAddresses;
|
package/v2/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./create-address-loader";
|
|
2
|
+
export * from "./create-zip-loader";
|
|
3
|
+
export * from "./get-address";
|
|
4
|
+
export * from "./get-address-extended";
|
|
5
|
+
export * from "./get-building-addresses";
|
|
6
|
+
export * from "./load-address-options";
|
|
7
|
+
export * from "./load-zip-options";
|
|
8
|
+
export * from "./search";
|
|
9
|
+
export * from "./search-city-part";
|
|
10
|
+
export * from "./search-zip";
|
|
11
|
+
export * from "./types";
|
package/v2/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./create-address-loader"), exports);
|
|
18
|
+
__exportStar(require("./create-zip-loader"), exports);
|
|
19
|
+
__exportStar(require("./get-address"), exports);
|
|
20
|
+
__exportStar(require("./get-address-extended"), exports);
|
|
21
|
+
__exportStar(require("./get-building-addresses"), exports);
|
|
22
|
+
__exportStar(require("./load-address-options"), exports);
|
|
23
|
+
__exportStar(require("./load-zip-options"), exports);
|
|
24
|
+
__exportStar(require("./search"), exports);
|
|
25
|
+
__exportStar(require("./search-city-part"), exports);
|
|
26
|
+
__exportStar(require("./search-zip"), exports);
|
|
27
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadAddressOptions = void 0;
|
|
4
|
+
const load_address_options_1 = require("../common/load-address-options");
|
|
5
|
+
exports.loadAddressOptions = (0, load_address_options_1.loadAddressOptionsGeneral)("/v2/search");
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadZipOptions = void 0;
|
|
4
|
+
const load_zip_options_1 = require("../common/load-zip-options");
|
|
5
|
+
exports.loadZipOptions = (0, load_zip_options_1.loadZipOptionsGeneral)("/v2/zip/search");
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.searchCityPart = void 0;
|
|
4
|
+
const config_1 = require("../config");
|
|
5
|
+
const searchCityPart = async (term, limit) => {
|
|
6
|
+
if (term.length === 0) {
|
|
7
|
+
return [];
|
|
8
|
+
}
|
|
9
|
+
const params = new URLSearchParams({
|
|
10
|
+
term,
|
|
11
|
+
});
|
|
12
|
+
if (limit) {
|
|
13
|
+
params.append("limit", limit.toString());
|
|
14
|
+
}
|
|
15
|
+
const response = await fetch(`${config_1.smartAddressUrl}/v2/city-part/search?${params.toString()}`);
|
|
16
|
+
return (await response.json());
|
|
17
|
+
};
|
|
18
|
+
exports.searchCityPart = searchCityPart;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const searchZip: (term: string, limit?: number) => Promise<import("./types").Location[]>;
|
package/v2/search-zip.js
ADDED
package/v2/search.d.ts
ADDED
package/v2/search.js
ADDED
package/v2/types.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export * from "../common/types";
|
|
2
|
+
import { BuildingType, BuildingUsageType, ConstructionType, ElevatorType, GasConnectionType, HeatingType, Location, ObjectType, ObjectTypeBasic, SewerConnectionType, WaterConnectionType } from "../common/types";
|
|
3
|
+
export type AddressExtendedBasicResponse = Location;
|
|
4
|
+
export type AddressExtendedAdministrativeResponse = {
|
|
5
|
+
id: number;
|
|
6
|
+
isknBudovaId: string | null;
|
|
7
|
+
stavebniObjektKod: string | null;
|
|
8
|
+
parcelaKod: string | null;
|
|
9
|
+
zpusobVyuzitiObjektu: BuildingUsageType | null;
|
|
10
|
+
objectType: ObjectType | null;
|
|
11
|
+
objectTypeBasic: ObjectTypeBasic | null;
|
|
12
|
+
};
|
|
13
|
+
export type AddressExtendedBuildingResponse = {
|
|
14
|
+
id: number;
|
|
15
|
+
typBudovy: BuildingType | null;
|
|
16
|
+
druhKonstrukce: ConstructionType | null;
|
|
17
|
+
pocetBytu: number | null;
|
|
18
|
+
pocetPodlazi: number | null;
|
|
19
|
+
pripojeniKanalizace: SewerConnectionType | null;
|
|
20
|
+
pripojeniVodovod: WaterConnectionType | null;
|
|
21
|
+
vybaveniVytahem: ElevatorType | null;
|
|
22
|
+
zastavenaPlocha: number | null;
|
|
23
|
+
obestavenyProstor: number | null;
|
|
24
|
+
podlahovaPlocha: number | null;
|
|
25
|
+
objectSize: string | null;
|
|
26
|
+
};
|
|
27
|
+
export type AddressExtendedEnergyResponse = {
|
|
28
|
+
id: number;
|
|
29
|
+
distributorElektrinyKod: string | null;
|
|
30
|
+
distributorElektrinyId: number | null;
|
|
31
|
+
distributorPlynuKod: string | null;
|
|
32
|
+
distributorPlynuId: number | null;
|
|
33
|
+
pripojeniPlyn: GasConnectionType | null;
|
|
34
|
+
zpusobVytapeni: HeatingType | null;
|
|
35
|
+
};
|
|
36
|
+
export type AddressExtended = {
|
|
37
|
+
zakladniAdresa: AddressExtendedBasicResponse;
|
|
38
|
+
administrativniUdaje: AddressExtendedAdministrativeResponse;
|
|
39
|
+
udajeBudovy: AddressExtendedBuildingResponse;
|
|
40
|
+
udajeEnergii: AddressExtendedEnergyResponse;
|
|
41
|
+
};
|
|
42
|
+
export type CityPart = {
|
|
43
|
+
id: number;
|
|
44
|
+
name: string;
|
|
45
|
+
obecKod: number;
|
|
46
|
+
obecNazev: string;
|
|
47
|
+
zips: string[];
|
|
48
|
+
};
|
package/v2/types.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("../common/types"), exports);
|