@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.
Files changed (80) hide show
  1. package/{v1 → common/__tests__}/load-address-options.test.js +22 -14
  2. package/{v1 → common/__tests__}/load-zip-options.test.js +10 -5
  3. package/{v1 → common/__tests__}/search-zip.test.js +5 -4
  4. package/common/__tests__/search.test.js +24 -0
  5. package/common/create-loader.d.ts +4 -0
  6. package/common/create-loader.js +7 -0
  7. package/common/get-address-extended.d.ts +2 -0
  8. package/common/get-address-extended.js +9 -0
  9. package/common/get-address.d.ts +2 -0
  10. package/common/get-address.js +9 -0
  11. package/common/index.d.ts +1 -0
  12. package/common/index.js +17 -0
  13. package/common/load-address-options.d.ts +11 -0
  14. package/common/load-address-options.js +21 -0
  15. package/common/load-zip-options.d.ts +8 -0
  16. package/common/load-zip-options.js +14 -0
  17. package/common/search-zip.d.ts +2 -0
  18. package/common/search-zip.js +19 -0
  19. package/common/search.d.ts +10 -0
  20. package/common/search.js +25 -0
  21. package/common/types.d.ts +88 -0
  22. package/common/types.js +2 -0
  23. package/package.json +1 -1
  24. package/v1/create-address-loader.d.ts +2 -2
  25. package/v1/create-address-loader.js +2 -9
  26. package/v1/create-zip-loader.d.ts +2 -2
  27. package/v1/create-zip-loader.js +2 -6
  28. package/v1/get-address-extended.d.ts +1 -2
  29. package/v1/get-address-extended.js +2 -6
  30. package/v1/get-address.d.ts +1 -2
  31. package/v1/get-address.js +2 -6
  32. package/v1/get-city-part.js +2 -2
  33. package/v1/get-city.js +2 -2
  34. package/v1/get-momc.js +2 -2
  35. package/v1/get-mop.js +2 -2
  36. package/v1/get-street.js +1 -1
  37. package/v1/index.d.ts +6 -3
  38. package/v1/load-address-options.d.ts +4 -6
  39. package/v1/load-address-options.js +2 -12
  40. package/v1/load-zip-options.d.ts +4 -6
  41. package/v1/load-zip-options.js +2 -11
  42. package/v1/search-zip.d.ts +1 -2
  43. package/v1/search-zip.js +2 -13
  44. package/v1/search.d.ts +3 -5
  45. package/v1/search.js +2 -19
  46. package/v1/types.d.ts +1 -89
  47. package/v1/types.js +15 -0
  48. package/v2/__tests__/get-building-addresses.test.d.ts +1 -0
  49. package/v2/__tests__/get-building-addresses.test.js +49 -0
  50. package/v2/__tests__/search-city-part.test.d.ts +1 -0
  51. package/v2/__tests__/search-city-part.test.js +46 -0
  52. package/v2/create-address-loader.d.ts +10 -0
  53. package/v2/create-address-loader.js +7 -0
  54. package/v2/create-zip-loader.d.ts +7 -0
  55. package/v2/create-zip-loader.js +7 -0
  56. package/v2/get-address-extended.d.ts +2 -0
  57. package/v2/get-address-extended.js +5 -0
  58. package/v2/get-address.d.ts +1 -0
  59. package/v2/get-address.js +5 -0
  60. package/v2/get-building-addresses.d.ts +2 -0
  61. package/v2/get-building-addresses.js +9 -0
  62. package/v2/index.d.ts +11 -0
  63. package/v2/index.js +27 -0
  64. package/v2/load-address-options.d.ts +8 -0
  65. package/v2/load-address-options.js +5 -0
  66. package/v2/load-zip-options.d.ts +5 -0
  67. package/v2/load-zip-options.js +5 -0
  68. package/v2/search-city-part.d.ts +2 -0
  69. package/v2/search-city-part.js +18 -0
  70. package/v2/search-zip.d.ts +1 -0
  71. package/v2/search-zip.js +5 -0
  72. package/v2/search.d.ts +7 -0
  73. package/v2/search.js +5 -0
  74. package/v2/types.d.ts +48 -0
  75. package/v2/types.js +17 -0
  76. package/v1/search.test.js +0 -33
  77. /package/{v1 → common/__tests__}/load-address-options.test.d.ts +0 -0
  78. /package/{v1 → common/__tests__}/load-zip-options.test.d.ts +0 -0
  79. /package/{v1 → common/__tests__}/search-zip.test.d.ts +0 -0
  80. /package/{v1 → common/__tests__}/search.test.d.ts +0 -0
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const load_address_options_1 = require("./load-address-options");
4
- const search_1 = require("./search");
5
- jest.mock("./search");
3
+ const load_address_options_1 = require("../../v1/load-address-options");
4
+ const search_1 = require("../search");
5
+ global.fetch = jest.fn();
6
+ jest.mock("../search");
6
7
  describe("loadAddressOptions", () => {
7
8
  beforeEach(() => {
8
9
  jest.clearAllMocks();
@@ -36,7 +37,7 @@ describe("loadAddressOptions", () => {
36
37
  psc: null,
37
38
  search: "",
38
39
  level: 1,
39
- gps: { latitude: "50.0755", longitude: "14.4378" },
40
+ gps: { latitude: 50.0755, longitude: 14.4378 },
40
41
  platiOd: "2024-01-01",
41
42
  aktualizace: "2024-10-01",
42
43
  okresKod: 456,
@@ -45,9 +46,12 @@ describe("loadAddressOptions", () => {
45
46
  krajNazev: "Czech Republic",
46
47
  },
47
48
  ];
48
- search_1.search.mockResolvedValue(mockResponse);
49
+ const mockSearch = jest.fn();
50
+ search_1.searchGeneral.mockReturnValue(mockSearch);
51
+ mockSearch.mockResolvedValue(mockResponse);
49
52
  await (0, load_address_options_1.loadAddressOptions)({ term, level });
50
- expect(search_1.search).toHaveBeenCalledWith({ term, level, limit: 10, zip: undefined });
53
+ expect(search_1.searchGeneral).toHaveBeenCalledWith("/v1/search");
54
+ expect(mockSearch).toHaveBeenCalledWith({ term, level, limit: 10, zip: undefined });
51
55
  });
52
56
  const term = "Prague";
53
57
  const level = 1;
@@ -57,7 +61,7 @@ describe("loadAddressOptions", () => {
57
61
  id: 1,
58
62
  obecKod: 123,
59
63
  obecNazev: null,
60
- obec: null,
64
+ obec: "Vrchlabi",
61
65
  momcKod: null,
62
66
  momcNazev: null,
63
67
  mopKod: null,
@@ -74,7 +78,7 @@ describe("loadAddressOptions", () => {
74
78
  psc: null,
75
79
  search: "",
76
80
  level: 1,
77
- gps: { latitude: "50.0755", longitude: "14.4378" },
81
+ gps: { latitude: 50.0755, longitude: 14.4378 },
78
82
  platiOd: "2024-01-01",
79
83
  aktualizace: "2024-10-01",
80
84
  okresKod: 456,
@@ -83,9 +87,11 @@ describe("loadAddressOptions", () => {
83
87
  krajNazev: "Czech Republic",
84
88
  },
85
89
  ];
86
- search_1.search.mockResolvedValue(mockResponse);
90
+ const mockSearch = jest.fn();
91
+ search_1.searchGeneral.mockReturnValue(mockSearch);
92
+ mockSearch.mockResolvedValue(mockResponse);
87
93
  const options = await (0, load_address_options_1.loadAddressOptions)({ term, level });
88
- expect(options).toEqual([{ id: 1, label: "Main St, null" }]);
94
+ expect(options).toEqual([{ id: 1, label: "Main St, Vrchlabi" }]);
89
95
  });
90
96
  it("should use custom getLabel function if provided", async () => {
91
97
  const mockResponse = [
@@ -93,7 +99,7 @@ describe("loadAddressOptions", () => {
93
99
  id: 1,
94
100
  obecKod: 123,
95
101
  obecNazev: null,
96
- obec: null,
102
+ obec: "Vrchlabi",
97
103
  momcKod: null,
98
104
  momcNazev: null,
99
105
  mopKod: null,
@@ -110,7 +116,7 @@ describe("loadAddressOptions", () => {
110
116
  psc: null,
111
117
  search: "",
112
118
  level: 1,
113
- gps: { latitude: "50.0755", longitude: "14.4378" },
119
+ gps: { latitude: 50.0755, longitude: 14.4378 },
114
120
  platiOd: "2024-01-01",
115
121
  aktualizace: "2024-10-01",
116
122
  okresKod: 456,
@@ -119,9 +125,11 @@ describe("loadAddressOptions", () => {
119
125
  krajNazev: "Czech Republic",
120
126
  },
121
127
  ];
122
- search_1.search.mockResolvedValue(mockResponse);
128
+ const mockSearch = jest.fn();
129
+ search_1.searchGeneral.mockReturnValue(mockSearch);
130
+ mockSearch.mockResolvedValue(mockResponse);
123
131
  const customGetLabel = (address) => `${address.obec} - ${address.ulice}`;
124
132
  const options = await (0, load_address_options_1.loadAddressOptions)({ term, level, getLabel: customGetLabel });
125
- expect(options).toEqual([{ id: 1, label: "null - Main St" }]);
133
+ expect(options).toEqual([{ id: 1, label: "Vrchlabi - Main St" }]);
126
134
  });
127
135
  });
@@ -1,15 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const load_zip_options_1 = require("./load-zip-options");
4
- const search_zip_1 = require("./search-zip");
5
- jest.mock("./search-zip");
3
+ const load_zip_options_1 = require("../../v1/load-zip-options");
4
+ const search_zip_1 = require("../search-zip");
5
+ global.fetch = jest.fn();
6
+ jest.mock("../search-zip");
6
7
  describe("loadZipOptions", () => {
7
8
  it("should return empty array when term is empty", async () => {
8
9
  const result = await (0, load_zip_options_1.loadZipOptions)({ term: "" });
9
10
  expect(result).toEqual([]);
10
11
  });
11
12
  it("should return formatted options with default label when term is provided", async () => {
12
- search_zip_1.searchZip.mockResolvedValueOnce([
13
+ const mockSearch = jest.fn();
14
+ search_zip_1.searchZipGeneral.mockReturnValue(mockSearch);
15
+ mockSearch.mockResolvedValueOnce([
13
16
  { id: 1, psc: 12345 },
14
17
  { id: 2, psc: 54321 },
15
18
  ]);
@@ -20,7 +23,9 @@ describe("loadZipOptions", () => {
20
23
  ]);
21
24
  });
22
25
  it("should return formatted options with custom label when getLabel is provided", async () => {
23
- search_zip_1.searchZip.mockResolvedValueOnce([
26
+ const mockSearch = jest.fn();
27
+ search_zip_1.searchZipGeneral.mockReturnValue(mockSearch);
28
+ mockSearch.mockResolvedValueOnce([
24
29
  { id: 1, psc: 12345 },
25
30
  { id: 2, psc: 54321 },
26
31
  ]);
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const config_1 = require("../config");
4
- const search_zip_1 = require("./search-zip");
5
- jest.mock("../config", () => ({
3
+ const config_1 = require("../../config");
4
+ const search_zip_1 = require("../../v1/search-zip");
5
+ global.fetch = jest.fn();
6
+ jest.mock("../../config", () => ({
6
7
  smartAddressUrl: "http://example.com",
7
8
  }));
8
9
  describe("searchZip", () => {
@@ -31,7 +32,7 @@ describe("searchZip", () => {
31
32
  ];
32
33
  fetch.mockImplementation(() => Promise.resolve({
33
34
  status: 200,
34
- text: () => Promise.resolve(JSON.stringify(mockResponse)),
35
+ json: () => Promise.resolve(mockResponse),
35
36
  }));
36
37
  const result = await (0, search_zip_1.searchZip)("12345");
37
38
  expect(result).toEqual(mockResponse);
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const config_1 = require("../../config");
4
+ const search_1 = require("../../v1/search");
5
+ global.fetch = jest.fn();
6
+ describe("SmartAddress v1 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 including address", async () => {
16
+ const mockResponse = [{ id: 1, name: "Test Location" }];
17
+ fetch.mockResolvedValue({
18
+ json: jest.fn().mockResolvedValue(mockResponse),
19
+ });
20
+ const result = await (0, search_1.search)({ term: "test", level: 2, limit: 5, zip: 12345, address: "some address" });
21
+ expect(fetch).toHaveBeenCalledWith(`${config_1.smartAddressUrl}/v1/search?term=test&level=2&limit=5&zip=12345&address=some+address`);
22
+ expect(result).toEqual(mockResponse);
23
+ });
24
+ });
@@ -0,0 +1,4 @@
1
+ import { Option } from "./types";
2
+ export declare const createLoaderGeneral: <Params extends object>(loadOptions: (params: Params & {
3
+ term: string;
4
+ }) => Promise<Option[]>, params: Params) => ((term: string) => Promise<Option[]>);
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createLoaderGeneral = void 0;
4
+ const createLoaderGeneral = (loadOptions, params) => {
5
+ return (term) => loadOptions({ ...params, term });
6
+ };
7
+ exports.createLoaderGeneral = createLoaderGeneral;
@@ -0,0 +1,2 @@
1
+ import { LocationExtended } from "./types";
2
+ export declare const getAddressExtendedGeneral: <TResponse = LocationExtended>(url: `/${string}/`) => (id: number) => Promise<TResponse>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAddressExtendedGeneral = void 0;
4
+ const config_1 = require("../config");
5
+ const getAddressExtendedGeneral = (url) => async (id) => {
6
+ const response = await fetch(`${config_1.smartAddressUrl}${url}${id}/extended`);
7
+ return await response.json();
8
+ };
9
+ exports.getAddressExtendedGeneral = getAddressExtendedGeneral;
@@ -0,0 +1,2 @@
1
+ import { Location } from "./types";
2
+ export declare const getAddressGeneral: (url: `/${string}/`) => (id: number) => Promise<Location>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAddressGeneral = void 0;
4
+ const config_1 = require("../config");
5
+ const getAddressGeneral = (url) => async (id) => {
6
+ const response = await fetch(config_1.smartAddressUrl + url + id);
7
+ return await response.json();
8
+ };
9
+ exports.getAddressGeneral = getAddressGeneral;
@@ -0,0 +1 @@
1
+ export * from "./types";
@@ -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("./types"), exports);
@@ -0,0 +1,11 @@
1
+ import { Location, Option } from "./types";
2
+ type Params = {
3
+ term: string;
4
+ level: number;
5
+ limit?: number;
6
+ zip?: number;
7
+ address?: string;
8
+ getLabel?: (address: Location) => string;
9
+ };
10
+ export declare const loadAddressOptionsGeneral: (url: `/${string}`) => (params: Params) => Promise<Option[]>;
11
+ export {};
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadAddressOptionsGeneral = void 0;
4
+ const search_1 = require("./search");
5
+ const loadAddressOptionsGeneral = (url) => async (params) => {
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) => { var _a, _b; return `${(_a = address.ulice) !== null && _a !== void 0 ? _a : ""}, ${(_b = address.obec) !== null && _b !== void 0 ? _b : ""}`; });
9
+ if (params.term.length === 0) {
10
+ return [];
11
+ }
12
+ const response = await (0, search_1.searchGeneral)(url)({
13
+ term: params.term,
14
+ level: params.level,
15
+ limit,
16
+ zip: params.zip,
17
+ address: params.address,
18
+ });
19
+ return response.map((a) => ({ id: a.id, label: getLabel(a) }));
20
+ };
21
+ exports.loadAddressOptionsGeneral = loadAddressOptionsGeneral;
@@ -0,0 +1,8 @@
1
+ import { Location, Option } from "./types";
2
+ type Params = {
3
+ term: string;
4
+ limit?: number;
5
+ getLabel?: (address: Location) => string;
6
+ };
7
+ export declare const loadZipOptionsGeneral: (url: `/${string}`) => (params: Params) => Promise<Option[]>;
8
+ export {};
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadZipOptionsGeneral = void 0;
4
+ const search_zip_1 = require("./search-zip");
5
+ const loadZipOptionsGeneral = (url) => async (params) => {
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.searchZipGeneral)(url)(params.term, params.limit);
12
+ return response.map((a) => ({ id: a.id, label: getLabel(a) }));
13
+ };
14
+ exports.loadZipOptionsGeneral = loadZipOptionsGeneral;
@@ -0,0 +1,2 @@
1
+ import { Location } from "./types";
2
+ export declare const searchZipGeneral: (url: `/${string}`) => (term: string, limit?: number) => Promise<Location[]>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.searchZipGeneral = void 0;
4
+ const config_1 = require("../config");
5
+ const regexp = /^([0-9]{1,5})$/;
6
+ const searchZipGeneral = (url) => async (term, limit) => {
7
+ if (term.length === 0 || !regexp.test(term)) {
8
+ return [];
9
+ }
10
+ const params = new URLSearchParams({
11
+ term: term,
12
+ });
13
+ if (limit) {
14
+ params.append("limit", limit.toString());
15
+ }
16
+ const response = await fetch(`${config_1.smartAddressUrl}${url}?${params}`);
17
+ return await response.json();
18
+ };
19
+ exports.searchZipGeneral = searchZipGeneral;
@@ -0,0 +1,10 @@
1
+ import { Location } from "./types";
2
+ type Props = {
3
+ term: string;
4
+ level: number;
5
+ limit?: number;
6
+ zip?: number;
7
+ address?: string;
8
+ };
9
+ export declare const searchGeneral: (url: `/${string}`) => (props: Props) => Promise<Location[]>;
10
+ export {};
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.searchGeneral = void 0;
4
+ const config_1 = require("../config");
5
+ const searchGeneral = (url) => async (props) => {
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
+ if (props.address) {
20
+ params.append("address", props.address);
21
+ }
22
+ const response = await fetch(`${config_1.smartAddressUrl}${url}?${params}`);
23
+ return await response.json();
24
+ };
25
+ exports.searchGeneral = searchGeneral;
@@ -0,0 +1,88 @@
1
+ export type BasicType = {
2
+ id: number;
3
+ nazev: string | null;
4
+ };
5
+ export 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: number;
29
+ longitude: number;
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
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/smart-address",
3
- "version": "11.80.4",
3
+ "version": "11.103.1",
4
4
  "description": "",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,9 +1,9 @@
1
- import { Location, Option } from "./types";
1
+ import { Location } from "./types";
2
2
  type Params = {
3
3
  level: number;
4
4
  limit?: number;
5
5
  zip?: number;
6
6
  getLabel?: (address: Location) => string;
7
7
  };
8
- export declare const createAddressLoader: (params: Params) => ((term: string) => Promise<Option[]>);
8
+ export declare const createAddressLoader: (params: Params) => (term: string) => Promise<import("./types").Option[]>;
9
9
  export {};
@@ -1,14 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createAddressLoader = void 0;
4
+ const create_loader_1 = require("../common/create-loader");
4
5
  const load_address_options_1 = require("./load-address-options");
5
- const createAddressLoader = (params) => {
6
- return (term) => (0, load_address_options_1.loadAddressOptions)({
7
- term,
8
- level: params.level,
9
- limit: params.limit,
10
- zip: params.zip,
11
- getLabel: params.getLabel,
12
- });
13
- };
6
+ const createAddressLoader = (params) => (0, create_loader_1.createLoaderGeneral)(load_address_options_1.loadAddressOptions, params);
14
7
  exports.createAddressLoader = createAddressLoader;
@@ -1,6 +1,6 @@
1
- import { Location, Option } from "./types";
1
+ import { Location } from "./types";
2
2
  type Params = {
3
3
  getLabel?: (address: Location) => string;
4
4
  };
5
- export declare const createZipLoader: (params: Params) => ((term: string) => Promise<Option[]>);
5
+ export declare const createZipLoader: (params: Params) => (term: string) => Promise<import("./types").Option[]>;
6
6
  export {};
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createZipLoader = void 0;
4
+ const create_loader_1 = require("../common/create-loader");
4
5
  const load_zip_options_1 = require("./load-zip-options");
5
- const createZipLoader = (params) => {
6
- return (term) => (0, load_zip_options_1.loadZipOptions)({
7
- term,
8
- getLabel: params.getLabel,
9
- });
10
- };
6
+ const createZipLoader = (params) => (0, create_loader_1.createLoaderGeneral)(load_zip_options_1.loadZipOptions, params);
11
7
  exports.createZipLoader = createZipLoader;
@@ -1,2 +1 @@
1
- import { LocationExtended } from "./types";
2
- export declare const getAddressExtended: (id: number) => Promise<LocationExtended>;
1
+ export declare const getAddressExtended: (id: number) => Promise<import("./types").LocationExtended>;
@@ -1,9 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAddressExtended = void 0;
4
- const config_1 = require("../config");
5
- const getAddressExtended = async (id) => {
6
- const response = await fetch(config_1.smartAddressUrl + "/v1/address/" + id + "/extended");
7
- return JSON.parse(await response.text());
8
- };
9
- exports.getAddressExtended = getAddressExtended;
4
+ const get_address_extended_1 = require("../common/get-address-extended");
5
+ exports.getAddressExtended = (0, get_address_extended_1.getAddressExtendedGeneral)("/v1/address/");
@@ -1,2 +1 @@
1
- import { Location } from "./types";
2
- export declare const getAddress: (id: number) => Promise<Location>;
1
+ export declare const getAddress: (id: number) => Promise<import("./types").Location>;
package/v1/get-address.js CHANGED
@@ -1,9 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAddress = void 0;
4
- const config_1 = require("../config");
5
- const getAddress = async (id) => {
6
- const response = await fetch(config_1.smartAddressUrl + "/v1/address/" + id);
7
- return JSON.parse(await response.text());
8
- };
9
- exports.getAddress = getAddress;
4
+ const get_address_1 = require("../common/get-address");
5
+ exports.getAddress = (0, get_address_1.getAddressGeneral)("/v1/address/");
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCityPart = void 0;
4
4
  const config_1 = require("../config");
5
5
  const getCityPart = async (id) => {
6
- const response = await fetch(config_1.smartAddressUrl + "/v1/address/city-part/" + id);
7
- return JSON.parse(await response.text());
6
+ const response = await fetch(`${config_1.smartAddressUrl}/v1/address/city-part/${id}`);
7
+ return await response.json();
8
8
  };
9
9
  exports.getCityPart = getCityPart;
package/v1/get-city.js CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCity = void 0;
4
4
  const config_1 = require("../config");
5
5
  const getCity = async (id) => {
6
- const response = await fetch(config_1.smartAddressUrl + "/v1/address/city/" + id);
7
- return JSON.parse(await response.text());
6
+ const response = await fetch(config_1.smartAddressUrl + `${config_1.smartAddressUrl}/v1/address/city/${id}`);
7
+ return await response.json();
8
8
  };
9
9
  exports.getCity = getCity;
package/v1/get-momc.js CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getMomc = void 0;
4
4
  const config_1 = require("../config");
5
5
  const getMomc = async (id) => {
6
- const response = await fetch(config_1.smartAddressUrl + "/v1/address/momc/" + id);
7
- return JSON.parse(await response.text());
6
+ const response = await fetch(`${config_1.smartAddressUrl}/v1/address/momc/${id}`);
7
+ return await response.json();
8
8
  };
9
9
  exports.getMomc = getMomc;
package/v1/get-mop.js CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getMop = void 0;
4
4
  const config_1 = require("../config");
5
5
  const getMop = async (id) => {
6
- const response = await fetch(config_1.smartAddressUrl + "/v1/address/mop/" + id);
7
- return JSON.parse(await response.text());
6
+ const response = await fetch(`${config_1.smartAddressUrl}/v1/address/mop/${id}`);
7
+ return await response.json();
8
8
  };
9
9
  exports.getMop = getMop;
package/v1/get-street.js CHANGED
@@ -4,6 +4,6 @@ exports.getStreet = void 0;
4
4
  const config_1 = require("../config");
5
5
  const getStreet = async (id) => {
6
6
  const response = await fetch(config_1.smartAddressUrl + "/v1/address/street/" + id);
7
- return JSON.parse(await response.text());
7
+ return await response.json();
8
8
  };
9
9
  exports.getStreet = getStreet;