commit fcd02b944ae60b75faba23b7caca1c91cd440aa6
parent f5112520e24dc310df3c277199b247506b267688
Author: triesap <triesap@radroots.dev>
Date: Thu, 20 Nov 2025 15:47:49 +0000
geocoder: update geocoding types to geolocation point model and update `sql.js` version
Diffstat:
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/geocoder/package.json b/geocoder/package.json
@@ -34,6 +34,6 @@
"dependencies": {
"@radroots/utils": "*",
"@radroots/types-bindings": "*",
- "sql.js": "1.12.0"
+ "sql.js": "1.13.0"
}
}
\ No newline at end of file
diff --git a/geocoder/src/geocoder.ts b/geocoder/src/geocoder.ts
@@ -1,4 +1,4 @@
-import { err_msg, type GeolocationCoordinatesPoint } from "@radroots/utils";
+import { err_msg, type GeolocationPoint } from "@radroots/utils";
import type { Database } from "sql.js";
import type { GeocoderReverseResult, IGeocoder, IGeocoderConnectResolve, IGeocoderCountryCenter, IGeocoderCountryCenterResolve, IGeocoderCountryListResolve, IGeocoderCountryListResult, IGeocoderCountryResolve, IGeocoderReverseOpts, IGeocoderReverseResolve } from "./types.js";
import { parse_geocode_country_center_result, parse_geocode_country_list_result, parse_geocode_reverse_result } from "./utils.js";
@@ -30,7 +30,7 @@ export class Geocoder implements IGeocoder {
};
}
- public async reverse(point: GeolocationCoordinatesPoint, opts?: IGeocoderReverseOpts): Promise<IGeocoderReverseResolve> {
+ public async reverse(point: GeolocationPoint, opts?: IGeocoderReverseOpts): Promise<IGeocoderReverseResolve> {
try {
if (!this._db) return err_msg(`*-db`);
const limit = typeof opts?.limit === `boolean` ? `` : opts?.limit ? Math.round(opts.limit) : `1`;
diff --git a/geocoder/src/types.ts b/geocoder/src/types.ts
@@ -1,5 +1,5 @@
import { IError } from "@radroots/types-bindings";
-import type { GeolocationCoordinatesPoint, ResultObj, ResultsList } from "@radroots/utils";
+import type { GeolocationPoint, ResultObj, ResultsList } from "@radroots/utils";
export type GeocoderIError =
| `*-result`
@@ -29,17 +29,17 @@ export type IGeocoderCountryCenter = {
country_id: string;
};
-export type IGeocoderCountryListResult = GeolocationCoordinatesPoint & { country_id: string; country: string };
+export type IGeocoderCountryListResult = GeolocationPoint & { country_id: string; country: string };
export type IGeocoderConnectResolve = true | IError<GeocoderIError>;
export type IGeocoderReverseResolve = ResultsList<GeocoderReverseResult> | IError<GeocoderIError>;
export type IGeocoderCountryResolve = ResultsList<GeocoderReverseResult> | IError<GeocoderIError>;
export type IGeocoderCountryListResolve = ResultsList<IGeocoderCountryListResult> | IError<GeocoderIError>;
-export type IGeocoderCountryCenterResolve = ResultObj<GeolocationCoordinatesPoint> | IError<GeocoderIError>;
+export type IGeocoderCountryCenterResolve = ResultObj<GeolocationPoint> | IError<GeocoderIError>;
export type IGeocoder = {
connect(wasm_path: string): Promise<IGeocoderConnectResolve>;
- reverse(point: GeolocationCoordinatesPoint, opts?: IGeocoderReverseOpts): Promise<IGeocoderReverseResolve>;
+ reverse(point: GeolocationPoint, opts?: IGeocoderReverseOpts): Promise<IGeocoderReverseResolve>;
country(opts: IGeocoderCountryCenter): Promise<IGeocoderCountryResolve>;
country_list(): Promise<IGeocoderCountryListResolve>;
country_center(opts: IGeocoderCountryCenter): Promise<IGeocoderCountryCenterResolve>;
diff --git a/geocoder/src/utils.ts b/geocoder/src/utils.ts
@@ -1,4 +1,4 @@
-import type { GeolocationCoordinatesPoint } from "@radroots/utils";
+import type { GeolocationPoint } from "@radroots/utils";
import type { GeocoderReverseResult, IGeocoderCountryListResult } from "./types.js";
export const parse_geocode_reverse_result = (obj: any): GeocoderReverseResult | undefined => {
@@ -47,7 +47,7 @@ export const parse_geocode_country_list_result = (obj: any): IGeocoderCountryLis
return undefined;
};
-export const parse_geocode_country_center_result = (obj: any): GeolocationCoordinatesPoint | undefined => {
+export const parse_geocode_country_center_result = (obj: any): GeolocationPoint | undefined => {
if (typeof obj !== `object` || !obj) return undefined;
const { latitude_c: lat, longitude_c: lng } = obj;
if (