@uxf/smart-address 15.2.1 → 16.16.0

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 (78) hide show
  1. package/common/__tests__/create-loader.test.js +8 -8
  2. package/common/__tests__/load-address-options.test.js +11 -11
  3. package/common/__tests__/load-zip-options.test.js +8 -8
  4. package/common/__tests__/search-zip.test.js +8 -8
  5. package/common/__tests__/search.test.js +5 -5
  6. package/common/create-loader.d.ts +1 -1
  7. package/common/get-address-extended.d.ts +1 -1
  8. package/common/get-address-extended.js +2 -2
  9. package/common/get-address.d.ts +1 -1
  10. package/common/get-address.js +2 -2
  11. package/common/index.d.ts +1 -1
  12. package/common/index.js +1 -1
  13. package/common/load-address-options.d.ts +1 -1
  14. package/common/load-address-options.js +2 -2
  15. package/common/load-zip-options.d.ts +1 -1
  16. package/common/load-zip-options.js +2 -2
  17. package/common/search-zip.d.ts +1 -1
  18. package/common/search-zip.js +2 -2
  19. package/common/search.d.ts +1 -1
  20. package/common/search.js +2 -2
  21. package/package.json +1 -1
  22. package/v1/create-address-loader.d.ts +2 -2
  23. package/v1/create-address-loader.js +3 -3
  24. package/v1/create-zip-loader.d.ts +2 -2
  25. package/v1/create-zip-loader.js +3 -3
  26. package/v1/get-address-extended.d.ts +1 -1
  27. package/v1/get-address-extended.js +2 -2
  28. package/v1/get-address.d.ts +1 -1
  29. package/v1/get-address.js +2 -2
  30. package/v1/get-city-part.d.ts +1 -1
  31. package/v1/get-city-part.js +2 -2
  32. package/v1/get-city.d.ts +1 -1
  33. package/v1/get-city.js +2 -2
  34. package/v1/get-city.test.js +4 -4
  35. package/v1/get-momc.d.ts +1 -1
  36. package/v1/get-momc.js +2 -2
  37. package/v1/get-mop.d.ts +1 -1
  38. package/v1/get-mop.js +2 -2
  39. package/v1/get-street.d.ts +1 -1
  40. package/v1/get-street.js +2 -2
  41. package/v1/index.d.ts +23 -27
  42. package/v1/index.js +26 -26
  43. package/v1/load-address-options.d.ts +2 -2
  44. package/v1/load-address-options.js +2 -2
  45. package/v1/load-zip-options.d.ts +2 -2
  46. package/v1/load-zip-options.js +2 -2
  47. package/v1/search-zip.d.ts +1 -1
  48. package/v1/search-zip.js +2 -2
  49. package/v1/search.d.ts +1 -1
  50. package/v1/search.js +2 -2
  51. package/v1/types.d.ts +1 -1
  52. package/v1/types.js +1 -1
  53. package/v2/__tests__/get-building-addresses.test.js +4 -4
  54. package/v2/__tests__/search-city-part.test.js +8 -8
  55. package/v2/create-address-loader.d.ts +2 -2
  56. package/v2/create-address-loader.js +3 -3
  57. package/v2/create-zip-loader.d.ts +2 -2
  58. package/v2/create-zip-loader.js +3 -3
  59. package/v2/get-address-extended.d.ts +1 -1
  60. package/v2/get-address-extended.js +2 -2
  61. package/v2/get-address.d.ts +1 -1
  62. package/v2/get-address.js +2 -2
  63. package/v2/get-building-addresses.d.ts +1 -1
  64. package/v2/get-building-addresses.js +2 -2
  65. package/v2/index.d.ts +11 -11
  66. package/v2/index.js +11 -11
  67. package/v2/load-address-options.d.ts +2 -2
  68. package/v2/load-address-options.js +2 -2
  69. package/v2/load-zip-options.d.ts +2 -2
  70. package/v2/load-zip-options.js +2 -2
  71. package/v2/search-city-part.d.ts +1 -1
  72. package/v2/search-city-part.js +2 -2
  73. package/v2/search-zip.d.ts +1 -1
  74. package/v2/search-zip.js +2 -2
  75. package/v2/search.d.ts +1 -1
  76. package/v2/search.js +2 -2
  77. package/v2/types.d.ts +2 -2
  78. package/v2/types.js +1 -1
@@ -1,19 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const create_address_loader_1 = require("../../v1/create-address-loader");
4
- const create_zip_loader_1 = require("../../v1/create-zip-loader");
5
- const create_address_loader_2 = require("../../v2/create-address-loader");
6
- const create_zip_loader_2 = require("../../v2/create-zip-loader");
3
+ const create_address_loader_ts_1 = require("../../v1/create-address-loader.js");
4
+ const create_zip_loader_ts_1 = require("../../v1/create-zip-loader.js");
5
+ const create_address_loader_ts_2 = require("../../v2/create-address-loader.js");
6
+ const create_zip_loader_ts_2 = require("../../v2/create-zip-loader.js");
7
7
  const fetchMock = jest.fn(() => Promise.resolve({ json: () => Promise.resolve([]) }));
8
8
  beforeEach(() => {
9
9
  fetchMock.mockClear();
10
10
  global.fetch = fetchMock;
11
11
  });
12
12
  const cases = [
13
- { name: "v1 address loader", load: (0, create_address_loader_1.createAddressLoader)({ level: 1 }), term: "Praha" },
14
- { name: "v2 address loader", load: (0, create_address_loader_2.createAddressLoader)({ level: 1 }), term: "Praha" },
15
- { name: "v1 zip loader", load: (0, create_zip_loader_1.createZipLoader)({}), term: "11000" },
16
- { name: "v2 zip loader", load: (0, create_zip_loader_2.createZipLoader)({}), term: "11000" },
13
+ { name: "v1 address loader", load: (0, create_address_loader_ts_1.createAddressLoader)({ level: 1 }), term: "Praha" },
14
+ { name: "v2 address loader", load: (0, create_address_loader_ts_2.createAddressLoader)({ level: 1 }), term: "Praha" },
15
+ { name: "v1 zip loader", load: (0, create_zip_loader_ts_1.createZipLoader)({}), term: "11000" },
16
+ { name: "v2 zip loader", load: (0, create_zip_loader_ts_2.createZipLoader)({}), term: "11000" },
17
17
  ];
18
18
  cases.forEach(({ name, load, term }) => {
19
19
  test(`${name} passes the abort signal on to fetch`, async () => {
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const load_address_options_1 = require("../../v1/load-address-options");
4
- const search_1 = require("../search");
3
+ const load_address_options_ts_1 = require("../../v1/load-address-options.js");
4
+ const search_ts_1 = require("../search.js");
5
5
  global.fetch = jest.fn();
6
- jest.mock("../search");
6
+ jest.mock("../search.ts");
7
7
  describe("loadAddressOptions", () => {
8
8
  beforeEach(() => {
9
9
  jest.clearAllMocks();
10
10
  });
11
11
  it("should return an empty array if term is empty", async () => {
12
- const options = await (0, load_address_options_1.loadAddressOptions)({ term: "", level: 1 });
12
+ const options = await (0, load_address_options_ts_1.loadAddressOptions)({ term: "", level: 1 });
13
13
  expect(options).toEqual([]);
14
14
  });
15
15
  it("should call search with correct parameters", async () => {
@@ -47,10 +47,10 @@ describe("loadAddressOptions", () => {
47
47
  },
48
48
  ];
49
49
  const mockSearch = jest.fn();
50
- search_1.searchGeneral.mockReturnValue(mockSearch);
50
+ search_ts_1.searchGeneral.mockReturnValue(mockSearch);
51
51
  mockSearch.mockResolvedValue(mockResponse);
52
- await (0, load_address_options_1.loadAddressOptions)({ term, level });
53
- expect(search_1.searchGeneral).toHaveBeenCalledWith("/v1/search");
52
+ await (0, load_address_options_ts_1.loadAddressOptions)({ term, level });
53
+ expect(search_ts_1.searchGeneral).toHaveBeenCalledWith("/v1/search");
54
54
  expect(mockSearch).toHaveBeenCalledWith({ term, level, limit: 10, zip: undefined });
55
55
  });
56
56
  const term = "Prague";
@@ -88,9 +88,9 @@ describe("loadAddressOptions", () => {
88
88
  },
89
89
  ];
90
90
  const mockSearch = jest.fn();
91
- search_1.searchGeneral.mockReturnValue(mockSearch);
91
+ search_ts_1.searchGeneral.mockReturnValue(mockSearch);
92
92
  mockSearch.mockResolvedValue(mockResponse);
93
- const options = await (0, load_address_options_1.loadAddressOptions)({ term, level });
93
+ const options = await (0, load_address_options_ts_1.loadAddressOptions)({ term, level });
94
94
  expect(options).toEqual([{ id: 1, label: "Main St, Vrchlabi" }]);
95
95
  });
96
96
  it("should use custom getLabel function if provided", async () => {
@@ -126,10 +126,10 @@ describe("loadAddressOptions", () => {
126
126
  },
127
127
  ];
128
128
  const mockSearch = jest.fn();
129
- search_1.searchGeneral.mockReturnValue(mockSearch);
129
+ search_ts_1.searchGeneral.mockReturnValue(mockSearch);
130
130
  mockSearch.mockResolvedValue(mockResponse);
131
131
  const customGetLabel = (address) => `${address.obec} - ${address.ulice}`;
132
- const options = await (0, load_address_options_1.loadAddressOptions)({ term, level, getLabel: customGetLabel });
132
+ const options = await (0, load_address_options_ts_1.loadAddressOptions)({ term, level, getLabel: customGetLabel });
133
133
  expect(options).toEqual([{ id: 1, label: "Vrchlabi - Main St" }]);
134
134
  });
135
135
  });
@@ -1,22 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const load_zip_options_1 = require("../../v1/load-zip-options");
4
- const search_zip_1 = require("../search-zip");
3
+ const load_zip_options_ts_1 = require("../../v1/load-zip-options.js");
4
+ const search_zip_ts_1 = require("../search-zip.js");
5
5
  global.fetch = jest.fn();
6
- jest.mock("../search-zip");
6
+ jest.mock("../search-zip.ts");
7
7
  describe("loadZipOptions", () => {
8
8
  it("should return empty array when term is empty", async () => {
9
- const result = await (0, load_zip_options_1.loadZipOptions)({ term: "" });
9
+ const result = await (0, load_zip_options_ts_1.loadZipOptions)({ term: "" });
10
10
  expect(result).toEqual([]);
11
11
  });
12
12
  it("should return formatted options with default label when term is provided", async () => {
13
13
  const mockSearch = jest.fn();
14
- search_zip_1.searchZipGeneral.mockReturnValue(mockSearch);
14
+ search_zip_ts_1.searchZipGeneral.mockReturnValue(mockSearch);
15
15
  mockSearch.mockResolvedValueOnce([
16
16
  { id: 1, psc: 12345 },
17
17
  { id: 2, psc: 54321 },
18
18
  ]);
19
- const result = await (0, load_zip_options_1.loadZipOptions)({ term: "123" });
19
+ const result = await (0, load_zip_options_ts_1.loadZipOptions)({ term: "123" });
20
20
  expect(result).toEqual([
21
21
  { id: 1, label: "12345" },
22
22
  { id: 2, label: "54321" },
@@ -24,13 +24,13 @@ describe("loadZipOptions", () => {
24
24
  });
25
25
  it("should return formatted options with custom label when getLabel is provided", async () => {
26
26
  const mockSearch = jest.fn();
27
- search_zip_1.searchZipGeneral.mockReturnValue(mockSearch);
27
+ search_zip_ts_1.searchZipGeneral.mockReturnValue(mockSearch);
28
28
  mockSearch.mockResolvedValueOnce([
29
29
  { id: 1, psc: 12345 },
30
30
  { id: 2, psc: 54321 },
31
31
  ]);
32
32
  const customLabel = (address) => `Zip: ${address.psc}`;
33
- const result = await (0, load_zip_options_1.loadZipOptions)({ term: "123", getLabel: customLabel });
33
+ const result = await (0, load_zip_options_ts_1.loadZipOptions)({ term: "123", getLabel: customLabel });
34
34
  expect(result).toEqual([
35
35
  { id: 1, label: "Zip: 12345" },
36
36
  { id: 2, label: "Zip: 54321" },
@@ -1,9 +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("../../v1/search-zip");
3
+ const config_ts_1 = require("../../config.js");
4
+ const search_zip_ts_1 = require("../../v1/search-zip.js");
5
5
  global.fetch = jest.fn();
6
- jest.mock("../../config", () => ({
6
+ jest.mock("../../config.ts", () => ({
7
7
  smartAddressUrl: "http://example.com",
8
8
  }));
9
9
  describe("searchZip", () => {
@@ -14,15 +14,15 @@ describe("searchZip", () => {
14
14
  jest.resetAllMocks();
15
15
  });
16
16
  it("should return an empty array for empty input", async () => {
17
- const result = await (0, search_zip_1.searchZip)("");
17
+ const result = await (0, search_zip_ts_1.searchZip)("");
18
18
  expect(result).toEqual([]);
19
19
  });
20
20
  it("should return an empty array for non-numeric input", async () => {
21
- const result = await (0, search_zip_1.searchZip)("abc");
21
+ const result = await (0, search_zip_ts_1.searchZip)("abc");
22
22
  expect(result).toEqual([]);
23
23
  });
24
24
  it("should return an empty array for invalid zip code", async () => {
25
- const result = await (0, search_zip_1.searchZip)("123456");
25
+ const result = await (0, search_zip_ts_1.searchZip)("123456");
26
26
  expect(result).toEqual([]);
27
27
  });
28
28
  it("should return an array of locations for valid zip code", async () => {
@@ -34,8 +34,8 @@ describe("searchZip", () => {
34
34
  status: 200,
35
35
  json: () => Promise.resolve(mockResponse),
36
36
  }));
37
- const result = await (0, search_zip_1.searchZip)("12345");
37
+ const result = await (0, search_zip_ts_1.searchZip)("12345");
38
38
  expect(result).toEqual(mockResponse);
39
- expect(fetch).toHaveBeenCalledWith(`${config_1.smartAddressUrl}/v1/zip/search?term=12345`, { signal: undefined });
39
+ expect(fetch).toHaveBeenCalledWith(`${config_ts_1.smartAddressUrl}/v1/zip/search?term=12345`, { signal: undefined });
40
40
  });
41
41
  });
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const config_1 = require("../../config");
4
- const search_1 = require("../../v1/search");
3
+ const config_ts_1 = require("../../config.js");
4
+ const search_ts_1 = require("../../v1/search.js");
5
5
  global.fetch = jest.fn();
6
6
  describe("SmartAddress v1 search", () => {
7
7
  beforeEach(() => {
8
8
  jest.clearAllMocks();
9
9
  });
10
10
  it("should return an empty array when term is empty", async () => {
11
- const result = await (0, search_1.search)({ term: "", level: 1 });
11
+ const result = await (0, search_ts_1.search)({ term: "", level: 1 });
12
12
  expect(result).toEqual([]);
13
13
  expect(fetch).not.toHaveBeenCalled();
14
14
  });
@@ -17,8 +17,8 @@ describe("SmartAddress v1 search", () => {
17
17
  fetch.mockResolvedValue({
18
18
  json: jest.fn().mockResolvedValue(mockResponse),
19
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`, { signal: undefined });
20
+ const result = await (0, search_ts_1.search)({ term: "test", level: 2, limit: 5, zip: 12345, address: "some address" });
21
+ expect(fetch).toHaveBeenCalledWith(`${config_ts_1.smartAddressUrl}/v1/search?term=test&level=2&limit=5&zip=12345&address=some+address`, { signal: undefined });
22
22
  expect(result).toEqual(mockResponse);
23
23
  });
24
24
  });
@@ -1,4 +1,4 @@
1
- import { Option } from "./types";
1
+ import { Option } from "./types.ts";
2
2
  /**
3
3
  * A `loadOptions` for `Combobox`: `signal`, which the combobox passes, cancels a search it no longer waits for.
4
4
  */
@@ -1,2 +1,2 @@
1
- import { LocationExtended } from "./types";
1
+ import { LocationExtended } from "./types.ts";
2
2
  export declare const getAddressExtendedGeneral: <TResponse = LocationExtended>(url: `/${string}/`) => (id: number) => Promise<TResponse>;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAddressExtendedGeneral = void 0;
4
- const config_1 = require("../config");
4
+ const config_ts_1 = require("../config.js");
5
5
  const getAddressExtendedGeneral = (url) => async (id) => {
6
- const response = await fetch(`${config_1.smartAddressUrl}${url}${id}/extended`);
6
+ const response = await fetch(`${config_ts_1.smartAddressUrl}${url}${id}/extended`);
7
7
  return await response.json();
8
8
  };
9
9
  exports.getAddressExtendedGeneral = getAddressExtendedGeneral;
@@ -1,2 +1,2 @@
1
- import { Location } from "./types";
1
+ import { Location } from "./types.ts";
2
2
  export declare const getAddressGeneral: (url: `/${string}/`) => (id: number) => Promise<Location>;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAddressGeneral = void 0;
4
- const config_1 = require("../config");
4
+ const config_ts_1 = require("../config.js");
5
5
  const getAddressGeneral = (url) => async (id) => {
6
- const response = await fetch(config_1.smartAddressUrl + url + id);
6
+ const response = await fetch(config_ts_1.smartAddressUrl + url + id);
7
7
  return await response.json();
8
8
  };
9
9
  exports.getAddressGeneral = getAddressGeneral;
package/common/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./types";
1
+ export * from "./types.ts";
package/common/index.js CHANGED
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types"), exports);
17
+ __exportStar(require("./types.js"), exports);
@@ -1,4 +1,4 @@
1
- import { Location, Option } from "./types";
1
+ import { Location, Option } from "./types.ts";
2
2
  type Params = {
3
3
  term: string;
4
4
  level: number;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.loadAddressOptionsGeneral = void 0;
4
- const search_1 = require("./search");
4
+ const search_ts_1 = require("./search.js");
5
5
  const loadAddressOptionsGeneral = (url) => async (params) => {
6
6
  var _a, _b;
7
7
  const limit = (_a = params.limit) !== null && _a !== void 0 ? _a : 10;
@@ -9,7 +9,7 @@ const loadAddressOptionsGeneral = (url) => async (params) => {
9
9
  if (params.term.length === 0) {
10
10
  return [];
11
11
  }
12
- const response = await (0, search_1.searchGeneral)(url)({
12
+ const response = await (0, search_ts_1.searchGeneral)(url)({
13
13
  term: params.term,
14
14
  level: params.level,
15
15
  limit,
@@ -1,4 +1,4 @@
1
- import { Location, Option } from "./types";
1
+ import { Location, Option } from "./types.ts";
2
2
  type Params = {
3
3
  term: string;
4
4
  limit?: number;
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.loadZipOptionsGeneral = void 0;
4
- const search_zip_1 = require("./search-zip");
4
+ const search_zip_ts_1 = require("./search-zip.js");
5
5
  const loadZipOptionsGeneral = (url) => async (params) => {
6
6
  var _a;
7
7
  const getLabel = (_a = params.getLabel) !== null && _a !== void 0 ? _a : ((address) => `${address.psc}`);
8
8
  if (params.term.length === 0) {
9
9
  return [];
10
10
  }
11
- const response = await (0, search_zip_1.searchZipGeneral)(url)(params.term, params.limit, { signal: params.signal });
11
+ const response = await (0, search_zip_ts_1.searchZipGeneral)(url)(params.term, params.limit, { signal: params.signal });
12
12
  return response.map((a) => ({ id: a.id, label: getLabel(a) }));
13
13
  };
14
14
  exports.loadZipOptionsGeneral = loadZipOptionsGeneral;
@@ -1,4 +1,4 @@
1
- import { Location } from "./types";
1
+ import { Location } from "./types.ts";
2
2
  export declare const searchZipGeneral: (url: `/${string}`) => (term: string, limit?: number, options?: {
3
3
  signal?: AbortSignal;
4
4
  }) => Promise<Location[]>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.searchZipGeneral = void 0;
4
- const config_1 = require("../config");
4
+ const config_ts_1 = require("../config.js");
5
5
  const regexp = /^([0-9]{1,5})$/;
6
6
  const searchZipGeneral = (url) => async (term, limit, options) => {
7
7
  if (term.length === 0 || !regexp.test(term)) {
@@ -13,7 +13,7 @@ const searchZipGeneral = (url) => async (term, limit, options) => {
13
13
  if (limit) {
14
14
  params.append("limit", limit.toString());
15
15
  }
16
- const response = await fetch(`${config_1.smartAddressUrl}${url}?${params}`, { signal: options === null || options === void 0 ? void 0 : options.signal });
16
+ const response = await fetch(`${config_ts_1.smartAddressUrl}${url}?${params}`, { signal: options === null || options === void 0 ? void 0 : options.signal });
17
17
  return await response.json();
18
18
  };
19
19
  exports.searchZipGeneral = searchZipGeneral;
@@ -1,4 +1,4 @@
1
- import { Location } from "./types";
1
+ import { Location } from "./types.ts";
2
2
  type Props = {
3
3
  term: string;
4
4
  level: number;
package/common/search.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.searchGeneral = void 0;
4
- const config_1 = require("../config");
4
+ const config_ts_1 = require("../config.js");
5
5
  const searchGeneral = (url) => async (props) => {
6
6
  var _a;
7
7
  const limit = (_a = props.limit) !== null && _a !== void 0 ? _a : 10;
@@ -19,7 +19,7 @@ const searchGeneral = (url) => async (props) => {
19
19
  if (props.address) {
20
20
  params.append("address", props.address);
21
21
  }
22
- const response = await fetch(`${config_1.smartAddressUrl}${url}?${params}`, { signal: props.signal });
22
+ const response = await fetch(`${config_ts_1.smartAddressUrl}${url}?${params}`, { signal: props.signal });
23
23
  return await response.json();
24
24
  };
25
25
  exports.searchGeneral = searchGeneral;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/smart-address",
3
- "version": "15.2.1",
3
+ "version": "16.16.0",
4
4
  "description": "Typed client helpers for the Czech Smart Address API: address and ZIP search, autocomplete loaders, address details",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,4 +1,4 @@
1
- import { Location } from "./types";
1
+ import { Location } from "./types.ts";
2
2
  type Params = {
3
3
  level: number;
4
4
  limit?: number;
@@ -7,5 +7,5 @@ type Params = {
7
7
  };
8
8
  export declare const createAddressLoader: (params: Params) => (term: string, options?: {
9
9
  signal?: AbortSignal;
10
- }) => Promise<import("./types").Option[]>;
10
+ }) => Promise<import("./types.ts").Option[]>;
11
11
  export {};
@@ -1,7 +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");
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);
4
+ const create_loader_ts_1 = require("../common/create-loader.js");
5
+ const load_address_options_ts_1 = require("./load-address-options.js");
6
+ const createAddressLoader = (params) => (0, create_loader_ts_1.createLoaderGeneral)(load_address_options_ts_1.loadAddressOptions, params);
7
7
  exports.createAddressLoader = createAddressLoader;
@@ -1,8 +1,8 @@
1
- import { Location } from "./types";
1
+ import { Location } from "./types.ts";
2
2
  type Params = {
3
3
  getLabel?: (address: Location) => string;
4
4
  };
5
5
  export declare const createZipLoader: (params: Params) => (term: string, options?: {
6
6
  signal?: AbortSignal;
7
- }) => Promise<import("./types").Option[]>;
7
+ }) => Promise<import("./types.ts").Option[]>;
8
8
  export {};
@@ -1,7 +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");
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);
4
+ const create_loader_ts_1 = require("../common/create-loader.js");
5
+ const load_zip_options_ts_1 = require("./load-zip-options.js");
6
+ const createZipLoader = (params) => (0, create_loader_ts_1.createLoaderGeneral)(load_zip_options_ts_1.loadZipOptions, params);
7
7
  exports.createZipLoader = createZipLoader;
@@ -1 +1 @@
1
- export declare const getAddressExtended: (id: number) => Promise<import("./types").LocationExtended>;
1
+ export declare const getAddressExtended: (id: number) => Promise<import("./types.ts").LocationExtended>;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
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)("/v1/address/");
4
+ const get_address_extended_ts_1 = require("../common/get-address-extended.js");
5
+ exports.getAddressExtended = (0, get_address_extended_ts_1.getAddressExtendedGeneral)("/v1/address/");
@@ -1 +1 @@
1
- export declare const getAddress: (id: number) => Promise<import("./types").Location>;
1
+ export declare const getAddress: (id: number) => Promise<import("./types.ts").Location>;
package/v1/get-address.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAddress = void 0;
4
- const get_address_1 = require("../common/get-address");
5
- exports.getAddress = (0, get_address_1.getAddressGeneral)("/v1/address/");
4
+ const get_address_ts_1 = require("../common/get-address.js");
5
+ exports.getAddress = (0, get_address_ts_1.getAddressGeneral)("/v1/address/");
@@ -1,2 +1,2 @@
1
- import { Location } from "./types";
1
+ import { Location } from "./types.ts";
2
2
  export declare const getCityPart: (id: number) => Promise<Location>;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCityPart = void 0;
4
- const config_1 = require("../config");
4
+ const config_ts_1 = require("../config.js");
5
5
  const getCityPart = async (id) => {
6
- const response = await fetch(`${config_1.smartAddressUrl}/v1/address/city-part/${id}`);
6
+ const response = await fetch(`${config_ts_1.smartAddressUrl}/v1/address/city-part/${id}`);
7
7
  return await response.json();
8
8
  };
9
9
  exports.getCityPart = getCityPart;
package/v1/get-city.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { Location } from "./types";
1
+ import { Location } from "./types.ts";
2
2
  export declare const getCity: (id: number) => Promise<Location>;
package/v1/get-city.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCity = void 0;
4
- const config_1 = require("../config");
4
+ const config_ts_1 = require("../config.js");
5
5
  const getCity = async (id) => {
6
- const response = await fetch(`${config_1.smartAddressUrl}/v1/address/city/${id}`);
6
+ const response = await fetch(`${config_ts_1.smartAddressUrl}/v1/address/city/${id}`);
7
7
  return await response.json();
8
8
  };
9
9
  exports.getCity = getCity;
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  /** @jest-environment node */
4
- const config_1 = require("../config");
5
- const get_city_1 = require("./get-city");
4
+ const config_ts_1 = require("../config.js");
5
+ const get_city_ts_1 = require("./get-city.js");
6
6
  afterEach(() => {
7
7
  jest.restoreAllMocks();
8
8
  });
9
9
  test("asks the city endpoint once, with the base URL once", async () => {
10
10
  const fetchMock = jest.spyOn(global, "fetch").mockResolvedValue(new Response("{}"));
11
- await (0, get_city_1.getCity)(42);
12
- expect(fetchMock).toHaveBeenCalledWith(`${config_1.smartAddressUrl}/v1/address/city/42`);
11
+ await (0, get_city_ts_1.getCity)(42);
12
+ expect(fetchMock).toHaveBeenCalledWith(`${config_ts_1.smartAddressUrl}/v1/address/city/42`);
13
13
  });
package/v1/get-momc.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { Location } from "./types";
1
+ import { Location } from "./types.ts";
2
2
  export declare const getMomc: (id: number) => Promise<Location>;
package/v1/get-momc.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getMomc = void 0;
4
- const config_1 = require("../config");
4
+ const config_ts_1 = require("../config.js");
5
5
  const getMomc = async (id) => {
6
- const response = await fetch(`${config_1.smartAddressUrl}/v1/address/momc/${id}`);
6
+ const response = await fetch(`${config_ts_1.smartAddressUrl}/v1/address/momc/${id}`);
7
7
  return await response.json();
8
8
  };
9
9
  exports.getMomc = getMomc;
package/v1/get-mop.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { Location } from "./types";
1
+ import { Location } from "./types.ts";
2
2
  export declare const getMop: (id: number) => Promise<Location>;
package/v1/get-mop.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getMop = void 0;
4
- const config_1 = require("../config");
4
+ const config_ts_1 = require("../config.js");
5
5
  const getMop = async (id) => {
6
- const response = await fetch(`${config_1.smartAddressUrl}/v1/address/mop/${id}`);
6
+ const response = await fetch(`${config_ts_1.smartAddressUrl}/v1/address/mop/${id}`);
7
7
  return await response.json();
8
8
  };
9
9
  exports.getMop = getMop;
@@ -1,2 +1,2 @@
1
- import { Location } from "./types";
1
+ import { Location } from "./types.ts";
2
2
  export declare const getStreet: (id: number) => Promise<Location>;
package/v1/get-street.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getStreet = void 0;
4
- const config_1 = require("../config");
4
+ const config_ts_1 = require("../config.js");
5
5
  const getStreet = async (id) => {
6
- const response = await fetch(config_1.smartAddressUrl + "/v1/address/street/" + id);
6
+ const response = await fetch(config_ts_1.smartAddressUrl + "/v1/address/street/" + id);
7
7
  return await response.json();
8
8
  };
9
9
  exports.getStreet = getStreet;
package/v1/index.d.ts CHANGED
@@ -1,40 +1,36 @@
1
- export type { BuildingType, BuildingUsageType, ConstructionType, ElevatorType, GasConnectionType, HeatingType, Location, LocationExtended, ObjectType, ObjectTypeBasic, Point, SewerConnectionType, WaterConnectionType, } from "./types";
1
+ import { createAddressLoader } from "./create-address-loader.ts";
2
+ import { createZipLoader } from "./create-zip-loader.ts";
3
+ import { getCityPart } from "./get-city-part.ts";
4
+ import { getCity } from "./get-city.ts";
5
+ import { getMomc } from "./get-momc.ts";
6
+ import { getMop } from "./get-mop.ts";
7
+ import { getStreet } from "./get-street.ts";
8
+ export type { BuildingType, BuildingUsageType, ConstructionType, ElevatorType, GasConnectionType, HeatingType, Location, LocationExtended, ObjectType, ObjectTypeBasic, Point, SewerConnectionType, WaterConnectionType, } from "./types.ts";
2
9
  export declare const SmartAddress: {
3
- createAddressLoader: (params: {
4
- level: number;
5
- limit?: number;
6
- zip?: number;
7
- getLabel?: (address: import("./types").Location) => string;
8
- }) => (term: string, options?: {
9
- signal?: AbortSignal;
10
- }) => Promise<import("./types").Option[]>;
11
- createZipLoader: (params: {
12
- getLabel?: (address: import("./types").Location) => string;
13
- }) => (term: string, options?: {
14
- signal?: AbortSignal;
15
- }) => Promise<import("./types").Option[]>;
16
- getAddress: (id: number) => Promise<import("./types").Location>;
17
- getAddressExtended: (id: number) => Promise<import("./types").LocationExtended>;
18
- getCity: (id: number) => Promise<import("./types").Location>;
19
- getCityPart: (id: number) => Promise<import("./types").Location>;
20
- getMomc: (id: number) => Promise<import("./types").Location>;
21
- getMop: (id: number) => Promise<import("./types").Location>;
22
- getStreet: (id: number) => Promise<import("./types").Location>;
10
+ createAddressLoader: typeof createAddressLoader;
11
+ createZipLoader: typeof createZipLoader;
12
+ getAddress: (id: number) => Promise<import("./types.ts").Location>;
13
+ getAddressExtended: (id: number) => Promise<import("./types.ts").LocationExtended>;
14
+ getCity: typeof getCity;
15
+ getCityPart: typeof getCityPart;
16
+ getMomc: typeof getMomc;
17
+ getMop: typeof getMop;
18
+ getStreet: typeof getStreet;
23
19
  loadAddressOptions: (params: {
24
20
  term: string;
25
21
  level: number;
26
22
  limit?: number;
27
23
  zip?: number;
28
24
  address?: string;
29
- getLabel?: (address: import("./types").Location) => string;
25
+ getLabel?: (address: import("./types.ts").Location) => string;
30
26
  signal?: AbortSignal;
31
- }) => Promise<import("./types").Option[]>;
27
+ }) => Promise<import("./types.ts").Option[]>;
32
28
  loadZipOptions: (params: {
33
29
  term: string;
34
30
  limit?: number;
35
- getLabel?: (address: import("./types").Location) => string;
31
+ getLabel?: (address: import("./types.ts").Location) => string;
36
32
  signal?: AbortSignal;
37
- }) => Promise<import("./types").Option[]>;
33
+ }) => Promise<import("./types.ts").Option[]>;
38
34
  search: (props: {
39
35
  term: string;
40
36
  level: number;
@@ -42,8 +38,8 @@ export declare const SmartAddress: {
42
38
  zip?: number;
43
39
  address?: string;
44
40
  signal?: AbortSignal;
45
- }) => Promise<import("./types").Location[]>;
41
+ }) => Promise<import("./types.ts").Location[]>;
46
42
  searchZip: (term: string, limit?: number, options?: {
47
43
  signal?: AbortSignal;
48
- }) => Promise<import("./types").Location[]>;
44
+ }) => Promise<import("./types.ts").Location[]>;
49
45
  };
package/v1/index.js CHANGED
@@ -1,31 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SmartAddress = void 0;
4
- const create_address_loader_1 = require("./create-address-loader");
5
- const create_zip_loader_1 = require("./create-zip-loader");
6
- const get_address_1 = require("./get-address");
7
- const get_address_extended_1 = require("./get-address-extended");
8
- const get_city_1 = require("./get-city");
9
- const get_city_part_1 = require("./get-city-part");
10
- const get_momc_1 = require("./get-momc");
11
- const get_mop_1 = require("./get-mop");
12
- const get_street_1 = require("./get-street");
13
- const load_address_options_1 = require("./load-address-options");
14
- const load_zip_options_1 = require("./load-zip-options");
15
- const search_1 = require("./search");
16
- const search_zip_1 = require("./search-zip");
4
+ const create_address_loader_ts_1 = require("./create-address-loader.js");
5
+ const create_zip_loader_ts_1 = require("./create-zip-loader.js");
6
+ const get_address_extended_ts_1 = require("./get-address-extended.js");
7
+ const get_address_ts_1 = require("./get-address.js");
8
+ const get_city_part_ts_1 = require("./get-city-part.js");
9
+ const get_city_ts_1 = require("./get-city.js");
10
+ const get_momc_ts_1 = require("./get-momc.js");
11
+ const get_mop_ts_1 = require("./get-mop.js");
12
+ const get_street_ts_1 = require("./get-street.js");
13
+ const load_address_options_ts_1 = require("./load-address-options.js");
14
+ const load_zip_options_ts_1 = require("./load-zip-options.js");
15
+ const search_zip_ts_1 = require("./search-zip.js");
16
+ const search_ts_1 = require("./search.js");
17
17
  exports.SmartAddress = {
18
- createAddressLoader: create_address_loader_1.createAddressLoader,
19
- createZipLoader: create_zip_loader_1.createZipLoader,
20
- getAddress: get_address_1.getAddress,
21
- getAddressExtended: get_address_extended_1.getAddressExtended,
22
- getCity: get_city_1.getCity,
23
- getCityPart: get_city_part_1.getCityPart,
24
- getMomc: get_momc_1.getMomc,
25
- getMop: get_mop_1.getMop,
26
- getStreet: get_street_1.getStreet,
27
- loadAddressOptions: load_address_options_1.loadAddressOptions,
28
- loadZipOptions: load_zip_options_1.loadZipOptions,
29
- search: search_1.search,
30
- searchZip: search_zip_1.searchZip,
18
+ createAddressLoader: create_address_loader_ts_1.createAddressLoader,
19
+ createZipLoader: create_zip_loader_ts_1.createZipLoader,
20
+ getAddress: get_address_ts_1.getAddress,
21
+ getAddressExtended: get_address_extended_ts_1.getAddressExtended,
22
+ getCity: get_city_ts_1.getCity,
23
+ getCityPart: get_city_part_ts_1.getCityPart,
24
+ getMomc: get_momc_ts_1.getMomc,
25
+ getMop: get_mop_ts_1.getMop,
26
+ getStreet: get_street_ts_1.getStreet,
27
+ loadAddressOptions: load_address_options_ts_1.loadAddressOptions,
28
+ loadZipOptions: load_zip_options_ts_1.loadZipOptions,
29
+ search: search_ts_1.search,
30
+ searchZip: search_zip_ts_1.searchZip,
31
31
  };
@@ -4,6 +4,6 @@ export declare const loadAddressOptions: (params: {
4
4
  limit?: number;
5
5
  zip?: number;
6
6
  address?: string;
7
- getLabel?: (address: import("./types").Location) => string;
7
+ getLabel?: (address: import("./types.ts").Location) => string;
8
8
  signal?: AbortSignal;
9
- }) => Promise<import("./types").Option[]>;
9
+ }) => Promise<import("./types.ts").Option[]>;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
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)("/v1/search");
4
+ const load_address_options_ts_1 = require("../common/load-address-options.js");
5
+ exports.loadAddressOptions = (0, load_address_options_ts_1.loadAddressOptionsGeneral)("/v1/search");
@@ -1,6 +1,6 @@
1
1
  export declare const loadZipOptions: (params: {
2
2
  term: string;
3
3
  limit?: number;
4
- getLabel?: (address: import("./types").Location) => string;
4
+ getLabel?: (address: import("./types.ts").Location) => string;
5
5
  signal?: AbortSignal;
6
- }) => Promise<import("./types").Option[]>;
6
+ }) => Promise<import("./types.ts").Option[]>;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
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)("/v1/zip/search");
4
+ const load_zip_options_ts_1 = require("../common/load-zip-options.js");
5
+ exports.loadZipOptions = (0, load_zip_options_ts_1.loadZipOptionsGeneral)("/v1/zip/search");
@@ -1,3 +1,3 @@
1
1
  export declare const searchZip: (term: string, limit?: number, options?: {
2
2
  signal?: AbortSignal;
3
- }) => Promise<import("./types").Location[]>;
3
+ }) => Promise<import("./types.ts").Location[]>;
package/v1/search-zip.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.searchZip = void 0;
4
- const search_zip_1 = require("../common/search-zip");
5
- exports.searchZip = (0, search_zip_1.searchZipGeneral)("/v1/zip/search");
4
+ const search_zip_ts_1 = require("../common/search-zip.js");
5
+ exports.searchZip = (0, search_zip_ts_1.searchZipGeneral)("/v1/zip/search");
package/v1/search.d.ts CHANGED
@@ -5,4 +5,4 @@ export declare const search: (props: {
5
5
  zip?: number;
6
6
  address?: string;
7
7
  signal?: AbortSignal;
8
- }) => Promise<import("./types").Location[]>;
8
+ }) => Promise<import("./types.ts").Location[]>;
package/v1/search.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.search = void 0;
4
- const search_1 = require("../common/search");
5
- exports.search = (0, search_1.searchGeneral)("/v1/search");
4
+ const search_ts_1 = require("../common/search.js");
5
+ exports.search = (0, search_ts_1.searchGeneral)("/v1/search");
package/v1/types.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "../common/types";
1
+ export * from "../common/types.ts";
package/v1/types.js CHANGED
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("../common/types"), exports);
17
+ __exportStar(require("../common/types.js"), exports);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const config_1 = require("../../config");
4
- const get_building_addresses_1 = require("../get-building-addresses");
3
+ const config_ts_1 = require("../../config.js");
4
+ const get_building_addresses_ts_1 = require("../get-building-addresses.js");
5
5
  global.fetch = jest.fn();
6
6
  describe("getBuildingAddresses", () => {
7
7
  beforeEach(() => {
@@ -42,8 +42,8 @@ describe("getBuildingAddresses", () => {
42
42
  fetch.mockResolvedValue({
43
43
  json: jest.fn().mockResolvedValue(mockLocations),
44
44
  });
45
- const result = await (0, get_building_addresses_1.getBuildingAddresses)(123);
46
- expect(fetch).toHaveBeenCalledWith(`${config_1.smartAddressUrl}/v2/address/123/building-addresses`);
45
+ const result = await (0, get_building_addresses_ts_1.getBuildingAddresses)(123);
46
+ expect(fetch).toHaveBeenCalledWith(`${config_ts_1.smartAddressUrl}/v2/address/123/building-addresses`);
47
47
  expect(result).toEqual(mockLocations);
48
48
  });
49
49
  });
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
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", () => ({
3
+ const config_ts_1 = require("../../config.js");
4
+ const search_city_part_ts_1 = require("../search-city-part.js");
5
+ jest.mock("../../config.ts", () => ({
6
6
  smartAddressUrl: "http://example.com",
7
7
  }));
8
8
  describe("searchCityPart", () => {
@@ -13,7 +13,7 @@ describe("searchCityPart", () => {
13
13
  jest.resetAllMocks();
14
14
  });
15
15
  it("should return an empty array for empty input", async () => {
16
- const result = await (0, search_city_part_1.searchCityPart)("");
16
+ const result = await (0, search_city_part_ts_1.searchCityPart)("");
17
17
  expect(result).toEqual([]);
18
18
  });
19
19
  it("should return an array of city parts for valid input", async () => {
@@ -30,9 +30,9 @@ describe("searchCityPart", () => {
30
30
  status: 200,
31
31
  json: () => Promise.resolve(mockResponse),
32
32
  }));
33
- const result = await (0, search_city_part_1.searchCityPart)("Vrchlabí");
33
+ const result = await (0, search_city_part_ts_1.searchCityPart)("Vrchlabí");
34
34
  expect(result).toEqual(mockResponse);
35
- expect(fetch).toHaveBeenCalledWith(`${config_1.smartAddressUrl}/v2/city-part/search?term=Vrchlab%C3%AD`);
35
+ expect(fetch).toHaveBeenCalledWith(`${config_ts_1.smartAddressUrl}/v2/city-part/search?term=Vrchlab%C3%AD`);
36
36
  });
37
37
  it("should respect limit parameter", async () => {
38
38
  const mockResponse = [{ id: 1 }];
@@ -40,7 +40,7 @@ describe("searchCityPart", () => {
40
40
  status: 200,
41
41
  json: () => Promise.resolve(mockResponse),
42
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`);
43
+ await (0, search_city_part_ts_1.searchCityPart)("Praha", 5);
44
+ expect(fetch).toHaveBeenCalledWith(`${config_ts_1.smartAddressUrl}/v2/city-part/search?term=Praha&limit=5`);
45
45
  });
46
46
  });
@@ -1,4 +1,4 @@
1
- import { Location } from "./types";
1
+ import { Location } from "./types.ts";
2
2
  type Params = {
3
3
  level: number;
4
4
  limit?: number;
@@ -8,5 +8,5 @@ type Params = {
8
8
  };
9
9
  export declare const createAddressLoader: (params: Params) => (term: string, options?: {
10
10
  signal?: AbortSignal;
11
- }) => Promise<import("./types").Option[]>;
11
+ }) => Promise<import("./types.ts").Option[]>;
12
12
  export {};
@@ -1,7 +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");
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);
4
+ const create_loader_ts_1 = require("../common/create-loader.js");
5
+ const load_address_options_ts_1 = require("./load-address-options.js");
6
+ const createAddressLoader = (params) => (0, create_loader_ts_1.createLoaderGeneral)(load_address_options_ts_1.loadAddressOptions, params);
7
7
  exports.createAddressLoader = createAddressLoader;
@@ -1,9 +1,9 @@
1
- import { Location } from "./types";
1
+ import { Location } from "./types.ts";
2
2
  type Params = {
3
3
  limit?: number;
4
4
  getLabel?: (address: Location) => string;
5
5
  };
6
6
  export declare const createZipLoader: (params: Params) => (term: string, options?: {
7
7
  signal?: AbortSignal;
8
- }) => Promise<import("./types").Option[]>;
8
+ }) => Promise<import("./types.ts").Option[]>;
9
9
  export {};
@@ -1,7 +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");
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);
4
+ const create_loader_ts_1 = require("../common/create-loader.js");
5
+ const load_zip_options_ts_1 = require("./load-zip-options.js");
6
+ const createZipLoader = (params) => (0, create_loader_ts_1.createLoaderGeneral)(load_zip_options_ts_1.loadZipOptions, params);
7
7
  exports.createZipLoader = createZipLoader;
@@ -1,2 +1,2 @@
1
- import { AddressExtended } from "./types";
1
+ import { AddressExtended } from "./types.ts";
2
2
  export declare const getAddressExtended: (id: number) => Promise<AddressExtended>;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
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/");
4
+ const get_address_extended_ts_1 = require("../common/get-address-extended.js");
5
+ exports.getAddressExtended = (0, get_address_extended_ts_1.getAddressExtendedGeneral)("/v2/address/");
@@ -1 +1 @@
1
- export declare const getAddress: (id: number) => Promise<import("./types").Location>;
1
+ export declare const getAddress: (id: number) => Promise<import("./types.ts").Location>;
package/v2/get-address.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAddress = void 0;
4
- const get_address_1 = require("../common/get-address");
5
- exports.getAddress = (0, get_address_1.getAddressGeneral)("/v2/address/");
4
+ const get_address_ts_1 = require("../common/get-address.js");
5
+ exports.getAddress = (0, get_address_ts_1.getAddressGeneral)("/v2/address/");
@@ -1,2 +1,2 @@
1
- import { Location } from "./types";
1
+ import { Location } from "./types.ts";
2
2
  export declare const getBuildingAddresses: (id: number) => Promise<Location[]>;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getBuildingAddresses = void 0;
4
- const config_1 = require("../config");
4
+ const config_ts_1 = require("../config.js");
5
5
  const getBuildingAddresses = async (id) => {
6
- const response = await fetch(`${config_1.smartAddressUrl}/v2/address/${id}/building-addresses`);
6
+ const response = await fetch(`${config_ts_1.smartAddressUrl}/v2/address/${id}/building-addresses`);
7
7
  return await response.json();
8
8
  };
9
9
  exports.getBuildingAddresses = getBuildingAddresses;
package/v2/index.d.ts CHANGED
@@ -1,11 +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";
1
+ export * from "./create-address-loader.ts";
2
+ export * from "./create-zip-loader.ts";
3
+ export * from "./get-address.ts";
4
+ export * from "./get-address-extended.ts";
5
+ export * from "./get-building-addresses.ts";
6
+ export * from "./load-address-options.ts";
7
+ export * from "./load-zip-options.ts";
8
+ export * from "./search.ts";
9
+ export * from "./search-city-part.ts";
10
+ export * from "./search-zip.ts";
11
+ export * from "./types.ts";
package/v2/index.js CHANGED
@@ -14,14 +14,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
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);
17
+ __exportStar(require("./create-address-loader.js"), exports);
18
+ __exportStar(require("./create-zip-loader.js"), exports);
19
+ __exportStar(require("./get-address.js"), exports);
20
+ __exportStar(require("./get-address-extended.js"), exports);
21
+ __exportStar(require("./get-building-addresses.js"), exports);
22
+ __exportStar(require("./load-address-options.js"), exports);
23
+ __exportStar(require("./load-zip-options.js"), exports);
24
+ __exportStar(require("./search.js"), exports);
25
+ __exportStar(require("./search-city-part.js"), exports);
26
+ __exportStar(require("./search-zip.js"), exports);
27
+ __exportStar(require("./types.js"), exports);
@@ -4,6 +4,6 @@ export declare const loadAddressOptions: (params: {
4
4
  limit?: number;
5
5
  zip?: number;
6
6
  address?: string;
7
- getLabel?: (address: import("./types").Location) => string;
7
+ getLabel?: (address: import("./types.ts").Location) => string;
8
8
  signal?: AbortSignal;
9
- }) => Promise<import("./types").Option[]>;
9
+ }) => Promise<import("./types.ts").Option[]>;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
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");
4
+ const load_address_options_ts_1 = require("../common/load-address-options.js");
5
+ exports.loadAddressOptions = (0, load_address_options_ts_1.loadAddressOptionsGeneral)("/v2/search");
@@ -1,6 +1,6 @@
1
1
  export declare const loadZipOptions: (params: {
2
2
  term: string;
3
3
  limit?: number;
4
- getLabel?: (address: import("./types").Location) => string;
4
+ getLabel?: (address: import("./types.ts").Location) => string;
5
5
  signal?: AbortSignal;
6
- }) => Promise<import("./types").Option[]>;
6
+ }) => Promise<import("./types.ts").Option[]>;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
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");
4
+ const load_zip_options_ts_1 = require("../common/load-zip-options.js");
5
+ exports.loadZipOptions = (0, load_zip_options_ts_1.loadZipOptionsGeneral)("/v2/zip/search");
@@ -1,2 +1,2 @@
1
- import { CityPart } from "./types";
1
+ import { CityPart } from "./types.ts";
2
2
  export declare const searchCityPart: (term: string, limit?: number) => Promise<CityPart[]>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.searchCityPart = void 0;
4
- const config_1 = require("../config");
4
+ const config_ts_1 = require("../config.js");
5
5
  const searchCityPart = async (term, limit) => {
6
6
  if (term.length === 0) {
7
7
  return [];
@@ -12,7 +12,7 @@ const searchCityPart = async (term, limit) => {
12
12
  if (limit) {
13
13
  params.append("limit", limit.toString());
14
14
  }
15
- const response = await fetch(`${config_1.smartAddressUrl}/v2/city-part/search?${params.toString()}`);
15
+ const response = await fetch(`${config_ts_1.smartAddressUrl}/v2/city-part/search?${params.toString()}`);
16
16
  return (await response.json());
17
17
  };
18
18
  exports.searchCityPart = searchCityPart;
@@ -1,3 +1,3 @@
1
1
  export declare const searchZip: (term: string, limit?: number, options?: {
2
2
  signal?: AbortSignal;
3
- }) => Promise<import("./types").Location[]>;
3
+ }) => Promise<import("./types.ts").Location[]>;
package/v2/search-zip.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.searchZip = void 0;
4
- const search_zip_1 = require("../common/search-zip");
5
- exports.searchZip = (0, search_zip_1.searchZipGeneral)("/v2/zip/search");
4
+ const search_zip_ts_1 = require("../common/search-zip.js");
5
+ exports.searchZip = (0, search_zip_ts_1.searchZipGeneral)("/v2/zip/search");
package/v2/search.d.ts CHANGED
@@ -5,4 +5,4 @@ export declare const search: (props: {
5
5
  zip?: number;
6
6
  address?: string;
7
7
  signal?: AbortSignal;
8
- }) => Promise<import("./types").Location[]>;
8
+ }) => Promise<import("./types.ts").Location[]>;
package/v2/search.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.search = void 0;
4
- const search_1 = require("../common/search");
5
- exports.search = (0, search_1.searchGeneral)("/v2/search");
4
+ const search_ts_1 = require("../common/search.js");
5
+ exports.search = (0, search_ts_1.searchGeneral)("/v2/search");
package/v2/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export * from "../common/types";
2
- import { BuildingType, BuildingUsageType, ConstructionType, ElevatorType, GasConnectionType, HeatingType, Location, ObjectType, ObjectTypeBasic, SewerConnectionType, WaterConnectionType } from "../common/types";
1
+ export * from "../common/types.ts";
2
+ import { BuildingType, BuildingUsageType, ConstructionType, ElevatorType, GasConnectionType, HeatingType, Location, ObjectType, ObjectTypeBasic, SewerConnectionType, WaterConnectionType } from "../common/types.ts";
3
3
  export type AddressExtendedBasicResponse = Location;
4
4
  export type AddressExtendedAdministrativeResponse = {
5
5
  id: number;
package/v2/types.js CHANGED
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("../common/types"), exports);
17
+ __exportStar(require("../common/types.js"), exports);