@memberjunction/geo-core 5.34.1 → 5.35.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/GeoCodeSyncService.d.ts +14 -16
- package/dist/GeoCodeSyncService.d.ts.map +1 -1
- package/dist/GeoCodeSyncService.js +47 -80
- package/dist/GeoCodeSyncService.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/providers/BaseGeocodingProvider.d.ts +37 -0
- package/dist/providers/BaseGeocodingProvider.d.ts.map +1 -0
- package/dist/providers/BaseGeocodingProvider.js +71 -0
- package/dist/providers/BaseGeocodingProvider.js.map +1 -0
- package/dist/providers/GeocodingProviderRegistry.d.ts +51 -0
- package/dist/providers/GeocodingProviderRegistry.d.ts.map +1 -0
- package/dist/providers/GeocodingProviderRegistry.js +125 -0
- package/dist/providers/GeocodingProviderRegistry.js.map +1 -0
- package/dist/providers/GeocodioGeocodingProvider.d.ts +17 -0
- package/dist/providers/GeocodioGeocodingProvider.d.ts.map +1 -0
- package/dist/providers/GeocodioGeocodingProvider.js +109 -0
- package/dist/providers/GeocodioGeocodingProvider.js.map +1 -0
- package/dist/providers/GoogleGeocodingProvider.d.ts +22 -0
- package/dist/providers/GoogleGeocodingProvider.d.ts.map +1 -0
- package/dist/providers/GoogleGeocodingProvider.js +110 -0
- package/dist/providers/GoogleGeocodingProvider.js.map +1 -0
- package/dist/providers/HereGeocodingProvider.d.ts +20 -0
- package/dist/providers/HereGeocodingProvider.d.ts.map +1 -0
- package/dist/providers/HereGeocodingProvider.js +107 -0
- package/dist/providers/HereGeocodingProvider.js.map +1 -0
- package/dist/providers/index.d.ts +7 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +7 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/types.d.ts +76 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +2 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { GeocodePrecision } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Forward (address-to-coordinates) geocoding request.
|
|
4
|
+
* Providers receive both a pre-built single-line address string and the
|
|
5
|
+
* structured components (when available). Providers may use either form
|
|
6
|
+
* depending on their API shape.
|
|
7
|
+
*/
|
|
8
|
+
export interface GeocodeRequest {
|
|
9
|
+
/** Pre-built single-line address, e.g. "123 Main St, Springfield, IL 62701, USA". */
|
|
10
|
+
AddressString: string;
|
|
11
|
+
/** Optional structured components. Empty/missing when not provided. */
|
|
12
|
+
Address?: string;
|
|
13
|
+
City?: string;
|
|
14
|
+
StateProvince?: string;
|
|
15
|
+
PostalCode?: string;
|
|
16
|
+
Country?: string;
|
|
17
|
+
/** ISO 3166-1 alpha-2 country code (e.g. "US"), used for region-bias / routing. */
|
|
18
|
+
CountryCode?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Reverse (coordinates-to-address) geocoding request.
|
|
22
|
+
*/
|
|
23
|
+
export interface ReverseGeocodeRequest {
|
|
24
|
+
Latitude: number;
|
|
25
|
+
Longitude: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Provider-agnostic geocoding result. Providers normalize their native
|
|
29
|
+
* response into this shape. Confidence is normalized to 0.0–1.0; precision
|
|
30
|
+
* uses the GeocodePrecision enum from the persistence layer.
|
|
31
|
+
*/
|
|
32
|
+
export interface ProviderGeocodeResult {
|
|
33
|
+
Latitude: number;
|
|
34
|
+
Longitude: number;
|
|
35
|
+
Precision: GeocodePrecision;
|
|
36
|
+
/** Normalized 0.0–1.0 confidence score. null if the provider doesn't surface one. */
|
|
37
|
+
Confidence: number | null;
|
|
38
|
+
FormattedAddress: string | null;
|
|
39
|
+
/** ISO 3166-1 alpha-2 country code returned by the provider. */
|
|
40
|
+
CountryCode: string | null;
|
|
41
|
+
/** State/province code/abbreviation returned by the provider. */
|
|
42
|
+
StateProvinceCode: string | null;
|
|
43
|
+
StateProvinceName: string | null;
|
|
44
|
+
City: string | null;
|
|
45
|
+
PostalCode: string | null;
|
|
46
|
+
/** Street line 1 if the provider parsed it out. */
|
|
47
|
+
Line1: string | null;
|
|
48
|
+
/** Street line 2 (apt/unit/suite) if the provider parsed it out. */
|
|
49
|
+
Line2: string | null;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Common interface all geocoding providers implement. New providers are
|
|
53
|
+
* registered via GeocodingProviderRegistry.Register() — no core changes needed.
|
|
54
|
+
*/
|
|
55
|
+
export interface IGeocodingProvider {
|
|
56
|
+
/** Stable identifier used in config and the GeocodingSource enum (e.g. 'google', 'geocodio', 'here'). */
|
|
57
|
+
readonly Name: string;
|
|
58
|
+
/**
|
|
59
|
+
* 'global' if the provider supports all countries, otherwise an array of
|
|
60
|
+
* ISO 3166-1 alpha-2 codes. Used for routing decisions when a country is
|
|
61
|
+
* known up-front.
|
|
62
|
+
*/
|
|
63
|
+
readonly SupportedCountries: 'global' | readonly string[];
|
|
64
|
+
/**
|
|
65
|
+
* True if the provider's free tier / ToS permits indefinite persistent
|
|
66
|
+
* storage of geocoding results. Used to gate use for RecordGeoCode persistence.
|
|
67
|
+
*/
|
|
68
|
+
readonly AllowsPersistentStorage: boolean;
|
|
69
|
+
/** True if API credentials are configured and the provider is ready to call. */
|
|
70
|
+
IsConfigured(): boolean;
|
|
71
|
+
/** Forward geocode. Returns null when the provider can't resolve the address. Throws on transient API errors. */
|
|
72
|
+
Geocode(req: GeocodeRequest): Promise<ProviderGeocodeResult | null>;
|
|
73
|
+
/** Reverse geocode. Returns null when the provider can't resolve coordinates. Throws on transient API errors. */
|
|
74
|
+
ReverseGeocode(req: ReverseGeocodeRequest): Promise<ProviderGeocodeResult | null>;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMapp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AM,WAAW,kBAAkB;IAC/B,yGAAyG;IACzG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,kBAAkB,EAAE,QAAQ,GAAG,SAAS,MAAM,EAAE,CAAC;IAC1D;;;OAGG;IACH,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC;IAC1C,gFAAgF;IAChF,YAAY,IAAI,OAAO,CAAC;IACxB,iHAAiH;IACjH,OAAO,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAAC;IACpE,iHAAiH;IACjH,cAAc,CAAC,GAAG,EAAE,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAAC;CACrF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/providers/types.ts"],"names":[],"mappings":""}
|
package/dist/types.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export type GeocodeStatus = 'success' | 'failed' | 'pending';
|
|
|
19
19
|
/**
|
|
20
20
|
* Source that produced the geocode.
|
|
21
21
|
*/
|
|
22
|
-
export type GeocodingSource = 'google' | 'reference_data' | 'manual' | 'ip_geolocation' | 'native' | 'reverse';
|
|
22
|
+
export type GeocodingSource = 'google' | 'geocodio' | 'here' | 'reference_data' | 'manual' | 'ip_geolocation' | 'native' | 'reverse';
|
|
23
23
|
/**
|
|
24
24
|
* Result from a geocoding operation.
|
|
25
25
|
*/
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC5B,wFAAwF;IACxF,YAAY,EAAE,SAAS,CAAC;IACxB,qEAAqE;IACrE,MAAM,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,g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M,CAAC;IACrB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/geo-core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.35.0",
|
|
5
5
|
"description": "MemberJunction: Core geo-spatial types, interfaces, and GeoCodeSyncService for geocoding lifecycle management",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"author": "MemberJunction.com",
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@memberjunction/global": "5.
|
|
21
|
-
"@memberjunction/core": "5.
|
|
22
|
-
"@memberjunction/core-entities": "5.
|
|
20
|
+
"@memberjunction/global": "5.35.0",
|
|
21
|
+
"@memberjunction/core": "5.35.0",
|
|
22
|
+
"@memberjunction/core-entities": "5.35.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/node": "^24.10.11",
|