@springfield/ham-radio-api 18.0.2 → 18.1.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.
package/dist/index.d.ts CHANGED
@@ -38,6 +38,7 @@ export * from "./spectrum/channel.js";
38
38
  export * from "./spectrum/mode.js";
39
39
  export * from "./spectrum/privilege.js";
40
40
  export * from "./antenna/type.js";
41
+ export * from "./station/geo-point.js";
41
42
  export * from "./station/radio-station.js";
42
43
  export * from "./station/antenna.js";
43
44
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0CAA0C,CAAC;AACzD,cAAc,+BAA+B,CAAC;AAE9C,cAAc,oBAAoB,CAAC;AAEnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AA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8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AAExC,cAAc,mBAAmB,CAAC;AAElC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -38,6 +38,7 @@ export * from "./spectrum/channel.js";
38
38
  export * from "./spectrum/mode.js";
39
39
  export * from "./spectrum/privilege.js";
40
40
  export * from "./antenna/type.js";
41
+ export * from "./station/geo-point.js";
41
42
  export * from "./station/radio-station.js";
42
43
  export * from "./station/antenna.js";
43
44
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0CAA0C,CAAC;AACzD,cAAc,+BAA+B,CAAC;AAE9C,cAAc,oBAAoB,CAAC;AAEnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAA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Ac,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AAEtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AAExC,cAAc,mBAAmB,CAAC;AAElC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Canonical geographic point for station sites and related APIs.
3
+ *
4
+ * **Decision (issue #19):** coordinates are {@link GeoPoint} with signed decimal
5
+ * degrees on WGS84. SQLite stores two REAL columns (`latitude`, `longitude`).
6
+ * GeoJSON Point (`[longitude, latitude]`, RFC 7946) is used only at map/API
7
+ * boundaries — no GeoJSON blobs in the database and no spatial extensions or
8
+ * indexes. Maidenhead grid squares are a derived display format, stored only
9
+ * where exchanged (station `gridsquare`, QSO grids). String sources such as
10
+ * Callook are parsed at the edge; lat/lon in this package are always numbers.
11
+ */
12
+ export declare const MIN_LATITUDE = -90;
13
+ export declare const MAX_LATITUDE = 90;
14
+ export declare const MIN_LONGITUDE = -180;
15
+ export declare const MAX_LONGITUDE = 180;
16
+ /**
17
+ * A point on the WGS84 ellipsoid as signed decimal degrees (south / west negative).
18
+ */
19
+ export interface GeoPoint {
20
+ latitude: number;
21
+ longitude: number;
22
+ }
23
+ /**
24
+ * Returns whether `value` is a {@link GeoPoint} with finite coordinates inside
25
+ * {@link MIN_LATITUDE}–{@link MAX_LATITUDE} and {@link MIN_LONGITUDE}–{@link MAX_LONGITUDE}.
26
+ */
27
+ export declare function isGeoPoint(value: unknown): value is GeoPoint;
28
+ //# sourceMappingURL=geo-point.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geo-point.d.ts","sourceRoot":"","sources":["../../src/station/geo-point.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,MAAM,CAAC;AAChC,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,aAAa,OAAO,CAAC;AAClC,eAAO,MAAM,aAAa,MAAM,CAAC;AAEjC;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAgB5D"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Canonical geographic point for station sites and related APIs.
3
+ *
4
+ * **Decision (issue #19):** coordinates are {@link GeoPoint} with signed decimal
5
+ * degrees on WGS84. SQLite stores two REAL columns (`latitude`, `longitude`).
6
+ * GeoJSON Point (`[longitude, latitude]`, RFC 7946) is used only at map/API
7
+ * boundaries — no GeoJSON blobs in the database and no spatial extensions or
8
+ * indexes. Maidenhead grid squares are a derived display format, stored only
9
+ * where exchanged (station `gridsquare`, QSO grids). String sources such as
10
+ * Callook are parsed at the edge; lat/lon in this package are always numbers.
11
+ */
12
+ export const MIN_LATITUDE = -90;
13
+ export const MAX_LATITUDE = 90;
14
+ export const MIN_LONGITUDE = -180;
15
+ export const MAX_LONGITUDE = 180;
16
+ /**
17
+ * Returns whether `value` is a {@link GeoPoint} with finite coordinates inside
18
+ * {@link MIN_LATITUDE}–{@link MAX_LATITUDE} and {@link MIN_LONGITUDE}–{@link MAX_LONGITUDE}.
19
+ */
20
+ export function isGeoPoint(value) {
21
+ if (typeof value !== "object" || value === null) {
22
+ return false;
23
+ }
24
+ const candidate = value;
25
+ return (typeof candidate.latitude === "number" &&
26
+ typeof candidate.longitude === "number" &&
27
+ Number.isFinite(candidate.latitude) &&
28
+ Number.isFinite(candidate.longitude) &&
29
+ candidate.latitude >= MIN_LATITUDE &&
30
+ candidate.latitude <= MAX_LATITUDE &&
31
+ candidate.longitude >= MIN_LONGITUDE &&
32
+ candidate.longitude <= MAX_LONGITUDE);
33
+ }
34
+ //# sourceMappingURL=geo-point.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geo-point.js","sourceRoot":"","sources":["../../src/station/geo-point.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,CAAC;AAChC,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAC/B,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAG,CAAC;AAClC,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC;AAUjC;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,SAAS,GAAG,KAAiB,CAAC;IACpC,OAAO,CACL,OAAO,SAAS,CAAC,QAAQ,KAAK,QAAQ;QACtC,OAAO,SAAS,CAAC,SAAS,KAAK,QAAQ;QACvC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC;QACnC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC;QACpC,SAAS,CAAC,QAAQ,IAAI,YAAY;QAClC,SAAS,CAAC,QAAQ,IAAI,YAAY;QAClC,SAAS,CAAC,SAAS,IAAI,aAAa;QACpC,SAAS,CAAC,SAAS,IAAI,aAAa,CACrC,CAAC;AACJ,CAAC"}
@@ -1,11 +1,9 @@
1
+ import type { GeoPoint } from "./geo-point.js";
1
2
  /**
2
3
  * Default Home site id. HamBench always has at least this station.
3
4
  */
4
5
  export declare const HOME_STATION_ID = "station-home";
5
- export declare const MIN_LATITUDE = -90;
6
- export declare const MAX_LATITUDE = 90;
7
- export declare const MIN_LONGITUDE = -180;
8
- export declare const MAX_LONGITUDE = 180;
6
+ export { MAX_LATITUDE, MAX_LONGITUDE, MIN_LATITUDE, MIN_LONGITUDE, } from "./geo-point.js";
9
7
  /**
10
8
  * Whether the operator last edited the Maidenhead grid or the coordinates.
11
9
  *
@@ -19,12 +17,10 @@ export type StationLocationSource = "grid" | "coordinates";
19
17
  * Latitude and longitude are signed decimal degrees (south / west negative).
20
18
  * UIs may collect them as degrees, minutes, and decimal seconds.
21
19
  */
22
- export interface RadioStation {
20
+ export interface RadioStation extends Partial<GeoPoint> {
23
21
  id: string;
24
22
  nickname: string;
25
23
  gridsquare?: string;
26
- latitude?: number;
27
- longitude?: number;
28
24
  locationSource?: StationLocationSource;
29
25
  createdAt: number;
30
26
  updatedAt: number;
@@ -1 +1 @@
1
- {"version":3,"file":"radio-station.d.ts","sourceRoot":"","sources":["../../src/station/radio-station.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAE9C,eAAO,MAAM,YAAY,MAAM,CAAC;AAChC,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,aAAa,OAAO,CAAC;AAClC,eAAO,MAAM,aAAa,MAAM,CAAC;AAEjC;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,aAAa,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB"}
1
+ {"version":3,"file":"radio-station.d.ts","sourceRoot":"","sources":["../../src/station/radio-station.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAE9C,OAAO,EACL,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,GACd,MAAM,gBAAgB,CAAC;AAExB;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,aAAa,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,WAAW,YAAa,SAAQ,OAAO,CAAC,QAAQ,CAAC;IACrD,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -2,8 +2,5 @@
2
2
  * Default Home site id. HamBench always has at least this station.
3
3
  */
4
4
  export const HOME_STATION_ID = "station-home";
5
- export const MIN_LATITUDE = -90;
6
- export const MAX_LATITUDE = 90;
7
- export const MIN_LONGITUDE = -180;
8
- export const MAX_LONGITUDE = 180;
5
+ export { MAX_LATITUDE, MAX_LONGITUDE, MIN_LATITUDE, MIN_LONGITUDE, } from "./geo-point.js";
9
6
  //# sourceMappingURL=radio-station.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio-station.js","sourceRoot":"","sources":["../../src/station/radio-station.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC;AAE9C,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,CAAC;AAChC,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAC/B,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAG,CAAC;AAClC,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC"}
1
+ {"version":3,"file":"radio-station.js","sourceRoot":"","sources":["../../src/station/radio-station.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,cAAc,CAAC;AAE9C,OAAO,EACL,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,GACd,MAAM,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@springfield/ham-radio-api",
3
- "version": "18.0.2",
3
+ "version": "18.1.0",
4
4
  "author": "Bryan Hunt",
5
5
  "license": "MIT",
6
6
  "files": [
package/src/index.ts CHANGED
@@ -43,5 +43,6 @@ export * from "./spectrum/privilege.js";
43
43
 
44
44
  export * from "./antenna/type.js";
45
45
 
46
+ export * from "./station/geo-point.js";
46
47
  export * from "./station/radio-station.js";
47
48
  export * from "./station/antenna.js";
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Canonical geographic point for station sites and related APIs.
3
+ *
4
+ * **Decision (issue #19):** coordinates are {@link GeoPoint} with signed decimal
5
+ * degrees on WGS84. SQLite stores two REAL columns (`latitude`, `longitude`).
6
+ * GeoJSON Point (`[longitude, latitude]`, RFC 7946) is used only at map/API
7
+ * boundaries — no GeoJSON blobs in the database and no spatial extensions or
8
+ * indexes. Maidenhead grid squares are a derived display format, stored only
9
+ * where exchanged (station `gridsquare`, QSO grids). String sources such as
10
+ * Callook are parsed at the edge; lat/lon in this package are always numbers.
11
+ */
12
+ export const MIN_LATITUDE = -90;
13
+ export const MAX_LATITUDE = 90;
14
+ export const MIN_LONGITUDE = -180;
15
+ export const MAX_LONGITUDE = 180;
16
+
17
+ /**
18
+ * A point on the WGS84 ellipsoid as signed decimal degrees (south / west negative).
19
+ */
20
+ export interface GeoPoint {
21
+ latitude: number;
22
+ longitude: number;
23
+ }
24
+
25
+ /**
26
+ * Returns whether `value` is a {@link GeoPoint} with finite coordinates inside
27
+ * {@link MIN_LATITUDE}–{@link MAX_LATITUDE} and {@link MIN_LONGITUDE}–{@link MAX_LONGITUDE}.
28
+ */
29
+ export function isGeoPoint(value: unknown): value is GeoPoint {
30
+ if (typeof value !== "object" || value === null) {
31
+ return false;
32
+ }
33
+
34
+ const candidate = value as GeoPoint;
35
+ return (
36
+ typeof candidate.latitude === "number" &&
37
+ typeof candidate.longitude === "number" &&
38
+ Number.isFinite(candidate.latitude) &&
39
+ Number.isFinite(candidate.longitude) &&
40
+ candidate.latitude >= MIN_LATITUDE &&
41
+ candidate.latitude <= MAX_LATITUDE &&
42
+ candidate.longitude >= MIN_LONGITUDE &&
43
+ candidate.longitude <= MAX_LONGITUDE
44
+ );
45
+ }
@@ -1,12 +1,16 @@
1
+ import type { GeoPoint } from "./geo-point.js";
2
+
1
3
  /**
2
4
  * Default Home site id. HamBench always has at least this station.
3
5
  */
4
6
  export const HOME_STATION_ID = "station-home";
5
7
 
6
- export const MIN_LATITUDE = -90;
7
- export const MAX_LATITUDE = 90;
8
- export const MIN_LONGITUDE = -180;
9
- export const MAX_LONGITUDE = 180;
8
+ export {
9
+ MAX_LATITUDE,
10
+ MAX_LONGITUDE,
11
+ MIN_LATITUDE,
12
+ MIN_LONGITUDE,
13
+ } from "./geo-point.js";
10
14
 
11
15
  /**
12
16
  * Whether the operator last edited the Maidenhead grid or the coordinates.
@@ -22,12 +26,10 @@ export type StationLocationSource = "grid" | "coordinates";
22
26
  * Latitude and longitude are signed decimal degrees (south / west negative).
23
27
  * UIs may collect them as degrees, minutes, and decimal seconds.
24
28
  */
25
- export interface RadioStation {
29
+ export interface RadioStation extends Partial<GeoPoint> {
26
30
  id: string;
27
31
  nickname: string;
28
32
  gridsquare?: string;
29
- latitude?: number;
30
- longitude?: number;
31
33
  locationSource?: StationLocationSource;
32
34
  createdAt: number;
33
35
  updatedAt: number;