@uxf/smart-address 11.80.4 → 11.122.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/README.md +109 -45
- 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
|
@@ -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);
|
package/v1/search.test.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const config_1 = require("../config");
|
|
4
|
-
const search_1 = require("./search");
|
|
5
|
-
global.fetch = jest.fn();
|
|
6
|
-
describe("search", () => {
|
|
7
|
-
beforeEach(() => {
|
|
8
|
-
jest.clearAllMocks();
|
|
9
|
-
});
|
|
10
|
-
it("should return an empty array when term is empty", async () => {
|
|
11
|
-
const result = await (0, search_1.search)({ term: "", level: 1 });
|
|
12
|
-
expect(result).toEqual([]);
|
|
13
|
-
expect(fetch).not.toHaveBeenCalled();
|
|
14
|
-
});
|
|
15
|
-
it("should call fetch with correct parameters and return data", async () => {
|
|
16
|
-
const mockResponse = [{ id: 1, name: "Test Location" }];
|
|
17
|
-
fetch.mockResolvedValue({
|
|
18
|
-
text: jest.fn().mockResolvedValue(JSON.stringify(mockResponse)),
|
|
19
|
-
});
|
|
20
|
-
const result = await (0, search_1.search)({ term: "test", level: 2, limit: 5, zip: 12345 });
|
|
21
|
-
expect(fetch).toHaveBeenCalledWith(`${config_1.smartAddressUrl}/v1/search?term=test&level=2&limit=5&zip=12345`);
|
|
22
|
-
expect(result).toEqual(mockResponse);
|
|
23
|
-
});
|
|
24
|
-
it("should call fetch without zip when zip is not provided", async () => {
|
|
25
|
-
const mockResponse = [{ id: 2, name: "Another Location" }];
|
|
26
|
-
fetch.mockResolvedValue({
|
|
27
|
-
text: jest.fn().mockResolvedValue(JSON.stringify(mockResponse)),
|
|
28
|
-
});
|
|
29
|
-
const result = await (0, search_1.search)({ term: "another test", level: 1 });
|
|
30
|
-
expect(fetch).toHaveBeenCalledWith(`${config_1.smartAddressUrl}/v1/search?term=another+test&level=1&limit=10`);
|
|
31
|
-
expect(result).toEqual(mockResponse);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|