quantaroute-geocoding 1.0.4 β 1.2.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/README.md +89 -24
- package/dist/client.d.ts +6 -49
- package/dist/client.js +1 -274
- package/dist/digipin-core.d.ts +16 -0
- package/dist/digipin-core.js +124 -0
- package/dist/index.d.ts +4 -7
- package/dist/index.js +12 -10
- package/dist/location-lookup.d.ts +6 -22
- package/dist/location-lookup.js +1 -133
- package/dist/offline.d.ts +0 -23
- package/dist/offline.js +15 -54
- package/dist/rasp.d.ts +75 -0
- package/dist/rasp.js +533 -0
- package/dist/security.d.ts +17 -0
- package/dist/security.js +1 -0
- package/dist/types.d.ts +0 -7
- package/dist/types.js +0 -4
- package/package.json +16 -14
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/location-lookup.d.ts.map +0 -1
- package/dist/location-lookup.js.map +0 -1
- package/dist/offline.d.ts.map +0 -1
- package/dist/offline.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
package/README.md
CHANGED
|
@@ -4,13 +4,19 @@ A **unique** Node.js/TypeScript library for geocoding addresses to DigiPin codes
|
|
|
4
4
|
|
|
5
5
|
## π Unique Features
|
|
6
6
|
|
|
7
|
+
### π **Enterprise-Grade Security** - *Runtime Protection & Code Security*
|
|
8
|
+
- π‘οΈ **RASP Protection**: Runtime Application Self-Protection with anti-debugging, integrity checks, and behavior monitoring
|
|
9
|
+
- π **Secure API Key Storage**: Encrypted storage with Symbol-based properties
|
|
10
|
+
- π **Request Signing**: HMAC-SHA256 signatures prevent tampering
|
|
11
|
+
- π **Code Obfuscation**: Production builds are automatically obfuscated
|
|
12
|
+
|
|
7
13
|
### π― **NEW: Location Lookup API** - *Service that even government doesn't provide!*
|
|
8
14
|
- πΊοΈ **Administrative Boundary Lookup**: Get state, division, locality, pincode, district, delivery status from coordinates
|
|
9
|
-
-
|
|
10
|
-
- π **36,000+ Postal Boundaries**: Complete coverage across India
|
|
15
|
+
- π **19,000+ Pincode Boundaries (with 154,000 post offices)**: Complete coverage across India
|
|
11
16
|
- β‘ **Sub-100ms Response**: Cached responses with database fallback
|
|
12
17
|
- π― **Government-Level Precision**: Accuracy that official services don't offer
|
|
13
18
|
- π **Batch Processing**: Up to 100 locations per request
|
|
19
|
+
- π **Population Density Data**: Mean, min, and max population density from Meta's 30-meter gridded data. [Deprecated]
|
|
14
20
|
|
|
15
21
|
### π **Core Features**
|
|
16
22
|
- π **Online API Integration**: Full access to QuantaRoute Geocoding API
|
|
@@ -27,11 +33,13 @@ A **unique** Node.js/TypeScript library for geocoding addresses to DigiPin codes
|
|
|
27
33
|
npm install quantaroute-geocoding
|
|
28
34
|
```
|
|
29
35
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
**What's included:**
|
|
37
|
+
- β
Official India Post DigiPin algorithm (vendored, no external dependencies)
|
|
38
|
+
- β
Complete offline DigiPin processing
|
|
39
|
+
- β
Location Lookup API client
|
|
40
|
+
- β
Geocoding & Reverse Geocoding
|
|
41
|
+
- β
Enterprise-grade security (RASP, code obfuscation)
|
|
42
|
+
- β
Full TypeScript support
|
|
35
43
|
|
|
36
44
|
## Quick Start
|
|
37
45
|
|
|
@@ -53,7 +61,6 @@ console.log(`Division: ${result.administrative_info.division}`); // New
|
|
|
53
61
|
console.log(`Locality: ${result.administrative_info.locality}`); // Nirman Bhawan SO
|
|
54
62
|
console.log(`District: ${result.administrative_info.district}`); // New Delhi
|
|
55
63
|
console.log(`Delivery: ${result.administrative_info.delivery}`); // Delivery
|
|
56
|
-
console.log(`Pop Density: ${result.administrative_info.mean_population_density}`); // 11234.56
|
|
57
64
|
console.log(`DigiPin: ${result.digipin}`); // 39J-438-TJC7
|
|
58
65
|
console.log(`Response Time: ${result.response_time_ms}ms`); // <100ms
|
|
59
66
|
|
|
@@ -65,7 +72,7 @@ console.log(`Division: ${digipinResult.administrative_info.division}`);
|
|
|
65
72
|
console.log(`Locality: ${digipinResult.administrative_info.locality}`);
|
|
66
73
|
console.log(`District: ${digipinResult.administrative_info.district}`);
|
|
67
74
|
|
|
68
|
-
// π Get live statistics (
|
|
75
|
+
// π Get live statistics (19,000+ boundaries with 154,000 post offices)
|
|
69
76
|
const stats = await client.getLocationStatistics();
|
|
70
77
|
console.log(`Total Boundaries: ${stats.totalBoundaries.toLocaleString()}`);
|
|
71
78
|
console.log(`Total States: ${stats.totalStates}`);
|
|
@@ -95,29 +102,78 @@ console.log(`House Name: ${reverseResult.addressComponents.amenity || reverseRes
|
|
|
95
102
|
|
|
96
103
|
### Offline Processing
|
|
97
104
|
|
|
105
|
+
**NEW: Official India Post DigiPin Algorithm Vendored!** π
|
|
106
|
+
|
|
107
|
+
`quantaroute-geocoding` now includes the **official DigiPin algorithm** directly - no external dependencies needed!
|
|
108
|
+
|
|
109
|
+
#### Using OfflineProcessor Class
|
|
110
|
+
|
|
98
111
|
```typescript
|
|
99
112
|
import { OfflineProcessor } from 'quantaroute-geocoding';
|
|
100
113
|
|
|
101
|
-
// Initialize offline processor
|
|
114
|
+
// Initialize offline processor (no dependencies needed!)
|
|
102
115
|
const processor = new OfflineProcessor();
|
|
103
116
|
|
|
104
|
-
// Convert coordinates to DigiPin (offline)
|
|
117
|
+
// Convert coordinates to DigiPin (offline, 100% accurate)
|
|
105
118
|
const offlineResult = processor.coordinatesToDigiPin(28.6139, 77.2090);
|
|
106
|
-
console.log(`DigiPin: ${offlineResult.digipin}`);
|
|
119
|
+
console.log(`DigiPin: ${offlineResult.digipin}`); // "39J-438-TJC7"
|
|
120
|
+
console.log(`Source: ${offlineResult.source}`); // "offline"
|
|
107
121
|
|
|
108
122
|
// Convert DigiPin to coordinates (offline)
|
|
109
123
|
const coordsResult = processor.digiPinToCoordinates("39J-438-TJC7");
|
|
110
|
-
console.log(`
|
|
124
|
+
console.log(`Latitude: ${coordsResult.coordinates.latitude}`);
|
|
125
|
+
console.log(`Longitude: ${coordsResult.coordinates.longitude}`);
|
|
111
126
|
|
|
112
127
|
// Validate DigiPin format
|
|
113
128
|
const validation = processor.validateDigiPin("39J-438-TJC7");
|
|
114
129
|
console.log(`Valid: ${validation.isValid}`);
|
|
130
|
+
if (!validation.isValid) {
|
|
131
|
+
console.log(`Errors: ${validation.errors.join(', ')}`);
|
|
132
|
+
}
|
|
115
133
|
|
|
116
134
|
// Calculate distance between coordinates
|
|
117
135
|
const distance = processor.calculateDistance(28.6139, 77.2090, 28.6150, 77.2100);
|
|
118
136
|
console.log(`Distance: ${distance.toFixed(2)} km`);
|
|
119
137
|
```
|
|
120
138
|
|
|
139
|
+
#### Using Core DigiPin Functions Directly
|
|
140
|
+
|
|
141
|
+
For simple use cases, you can use the core functions directly:
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
import {
|
|
145
|
+
getDigiPin,
|
|
146
|
+
getLatLngFromDigiPin,
|
|
147
|
+
isValidDigiPinFormat,
|
|
148
|
+
getBounds
|
|
149
|
+
} from 'quantaroute-geocoding';
|
|
150
|
+
|
|
151
|
+
// Convert coordinates to DigiPin
|
|
152
|
+
const digipin = getDigiPin(28.6139, 77.2090);
|
|
153
|
+
console.log('DigiPin:', digipin); // "39J-438-TJC7"
|
|
154
|
+
|
|
155
|
+
// Convert DigiPin to coordinates
|
|
156
|
+
const coords = getLatLngFromDigiPin("39J-438-TJC7");
|
|
157
|
+
console.log('Latitude:', coords.latitude); // "28.613900"
|
|
158
|
+
console.log('Longitude:', coords.longitude); // "77.209000"
|
|
159
|
+
|
|
160
|
+
// Validate DigiPin
|
|
161
|
+
const isValid = isValidDigiPinFormat("39J-438-TJC7");
|
|
162
|
+
console.log('Valid:', isValid); // true
|
|
163
|
+
|
|
164
|
+
// Get India bounds covered by DigiPin
|
|
165
|
+
const bounds = getBounds();
|
|
166
|
+
console.log('Bounds:', bounds);
|
|
167
|
+
// { minLat: 2.5, maxLat: 38.5, minLon: 63.5, maxLon: 99.5 }
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**Why This Matters:**
|
|
171
|
+
- β
**Zero Dependencies**: No need to install separate `digipin` packages
|
|
172
|
+
- β
**100% Offline**: Works without internet or API calls
|
|
173
|
+
- β
**Official Algorithm**: Same code as India Post's official implementation
|
|
174
|
+
- β
**Apache 2.0 License**: Open source from Government of India
|
|
175
|
+
- β
**Type-Safe**: Full TypeScript definitions included
|
|
176
|
+
|
|
121
177
|
### π Webhook Management
|
|
122
178
|
|
|
123
179
|
```typescript
|
|
@@ -263,9 +319,6 @@ interface LocationLookupResult {
|
|
|
263
319
|
country: string; // "India"
|
|
264
320
|
delivery?: string; // "Delivery"
|
|
265
321
|
district?: string; // "New Delhi"
|
|
266
|
-
mean_population_density?: number; // 11234.56
|
|
267
|
-
min_population_density?: number; // 5678.90
|
|
268
|
-
max_population_density?: number; // 15234.67
|
|
269
322
|
};
|
|
270
323
|
coordinates: {
|
|
271
324
|
latitude: number; // 28.6139
|
|
@@ -282,7 +335,7 @@ interface LocationLookupResult {
|
|
|
282
335
|
|
|
283
336
|
π― **Government-Level Precision**: Access to administrative boundaries that even government APIs don't provide at this level of detail and accessibility.
|
|
284
337
|
|
|
285
|
-
π **
|
|
338
|
+
π **19,000+ Boundaries (with 154,000 post offices)**: Complete coverage of Indian postal boundaries with sub-district level precision.
|
|
286
339
|
|
|
287
340
|
β‘ **Performance**: Sub-100ms cached responses, <500ms database queries.
|
|
288
341
|
|
|
@@ -404,9 +457,9 @@ const result: LocationLookupResult = await client.lookupLocationFromCoordinates(
|
|
|
404
457
|
|
|
405
458
|
| Tier | Requests/Minute | Monthly Limit | Batch Size | Boundaries |
|
|
406
459
|
|------|----------------|---------------|------------|------------|
|
|
407
|
-
| Free | 20 |
|
|
408
|
-
| Paid | 200 |
|
|
409
|
-
| Enterprise |
|
|
460
|
+
| Free | 20 | 25,000 | 50 | 19,000+ (with 154,000 post offices) |
|
|
461
|
+
| Paid | 200 | 50,000 | 100 | 19,000+ (with 154,000 post offices) |
|
|
462
|
+
| Enterprise | 10,000,000 | Unlimited | 100 | 19,000+ (with 154,000 post offices) |
|
|
410
463
|
|
|
411
464
|
**Performance Guarantees:**
|
|
412
465
|
- β‘ Cached responses: <100ms
|
|
@@ -438,7 +491,7 @@ Check out the `examples/` directory for more comprehensive examples:
|
|
|
438
491
|
|
|
439
492
|
β¨ **Government-Level Precision**: Administrative boundary data that even government APIs don't provide at this level of detail and accessibility.
|
|
440
493
|
|
|
441
|
-
π **Complete Coverage**:
|
|
494
|
+
π **Complete Coverage**: 19,000+ postal boundaries (with 154,000 post offices) across India with sub-district precision.
|
|
442
495
|
|
|
443
496
|
β‘ **Blazing Performance**: Sub-100ms cached responses, guaranteed <500ms database queries.
|
|
444
497
|
|
|
@@ -450,6 +503,19 @@ Check out the `examples/` directory for more comprehensive examples:
|
|
|
450
503
|
|
|
451
504
|
## Changelog
|
|
452
505
|
|
|
506
|
+
### [1.1.0] - 2025-11-25
|
|
507
|
+
#### π Security Enhancements (Major Update)
|
|
508
|
+
- π‘οΈ **RASP Protection**: Runtime Application Self-Protection with anti-debugging, integrity checks, and behavior monitoring
|
|
509
|
+
- π **Secure API Key Storage**: Encrypted storage with Symbol-based properties
|
|
510
|
+
- π **Request Signing**: HMAC-SHA256 signatures prevent tampering
|
|
511
|
+
- π **Code Obfuscation**: Production builds automatically obfuscated
|
|
512
|
+
- π« **Source Map Removal**: Prevents reverse engineering
|
|
513
|
+
|
|
514
|
+
### [1.0.4] - 2025-11-23
|
|
515
|
+
#### Added
|
|
516
|
+
- Enhanced reverse geocoding with detailed address components
|
|
517
|
+
- `address`, `displayName`, and `addressComponents` fields
|
|
518
|
+
|
|
453
519
|
### [1.0.3] - 2025-11-10
|
|
454
520
|
#### Added
|
|
455
521
|
- π **Webhook Management**: Register, list, delete, and test webhook endpoints
|
|
@@ -463,14 +529,13 @@ Check out the `examples/` directory for more comprehensive examples:
|
|
|
463
529
|
|
|
464
530
|
### [1.0.2] - 2025-11-01
|
|
465
531
|
#### Added
|
|
466
|
-
- π **Population Density Data**: Added mean, min, and max population density fields from Meta's 30-meter gridded data
|
|
532
|
+
- π **Population Density Data**: Added mean, min, and max population density fields from Meta's 30-meter gridded data [Deprecated]
|
|
467
533
|
- π **District Information**: Added district field for Indian district division as per official records
|
|
468
534
|
- β
**Delivery Status**: Added delivery field for pincode delivery status
|
|
469
535
|
- π **Complete Geographic Data**: Added state and country fields for comprehensive location information
|
|
470
536
|
|
|
471
537
|
#### Enhanced
|
|
472
|
-
- Improved administrative boundary data with complete coverage (
|
|
473
|
-
- All Location Lookup API responses now include population density and district information
|
|
538
|
+
- Improved administrative boundary data with complete coverage (19,000+ postal boundaries with 154,000 post offices)
|
|
474
539
|
|
|
475
540
|
### [1.0.1] - Previous Release
|
|
476
541
|
- Initial stable release with Location Lookup API
|
package/dist/client.d.ts
CHANGED
|
@@ -1,72 +1,29 @@
|
|
|
1
1
|
import { ClientConfig, GeocodeResult, ReverseGeocodeResult, LocationLookupResult, LocationStatistics, BatchLocationRequest, BatchLocationResult, WebhookEndpoint, CreateWebhookRequest, CreateWebhookResponse, TestWebhookResponse } from './types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* Revolutionary Node.js SDK for QuantaRoute Geocoding API with Location Lookup
|
|
6
|
-
*/
|
|
2
|
+
declare const CONFIG_SYMBOL: unique symbol;
|
|
3
|
+
declare const KEY_STORAGE_SYMBOL: unique symbol;
|
|
7
4
|
export declare class QuantaRouteClient {
|
|
8
5
|
private client;
|
|
9
|
-
private
|
|
6
|
+
private [CONFIG_SYMBOL];
|
|
7
|
+
private [KEY_STORAGE_SYMBOL];
|
|
10
8
|
constructor(config: ClientConfig);
|
|
11
9
|
private setupInterceptors;
|
|
10
|
+
private setupRequestSigning;
|
|
12
11
|
private makeRequest;
|
|
13
|
-
/**
|
|
14
|
-
* Geocode an address to DigiPin
|
|
15
|
-
*/
|
|
16
12
|
geocode(address: string): Promise<GeocodeResult>;
|
|
17
|
-
/**
|
|
18
|
-
* Convert coordinates to DigiPin
|
|
19
|
-
*/
|
|
20
13
|
coordinatesToDigiPin(latitude: number, longitude: number): Promise<GeocodeResult>;
|
|
21
|
-
/**
|
|
22
|
-
* Reverse geocode DigiPin to coordinates
|
|
23
|
-
*/
|
|
24
14
|
reverseGeocode(digipin: string): Promise<ReverseGeocodeResult>;
|
|
25
|
-
/**
|
|
26
|
-
* π REVOLUTIONARY: Get administrative boundaries from coordinates
|
|
27
|
-
*/
|
|
28
15
|
lookupLocationFromCoordinates(latitude: number, longitude: number): Promise<LocationLookupResult>;
|
|
29
|
-
/**
|
|
30
|
-
* π REVOLUTIONARY: Get administrative boundaries from DigiPin
|
|
31
|
-
*/
|
|
32
16
|
lookupLocationFromDigiPin(digipin: string): Promise<LocationLookupResult>;
|
|
33
|
-
/**
|
|
34
|
-
* π REVOLUTIONARY: Batch location lookup
|
|
35
|
-
*/
|
|
36
17
|
batchLocationLookup(locations: BatchLocationRequest[]): Promise<BatchLocationResult>;
|
|
37
|
-
/**
|
|
38
|
-
* π Get live location statistics
|
|
39
|
-
*/
|
|
40
18
|
getLocationStatistics(): Promise<LocationStatistics>;
|
|
41
|
-
/**
|
|
42
|
-
* Check API usage and limits
|
|
43
|
-
*/
|
|
44
19
|
getUsage(): Promise<any>;
|
|
45
|
-
/**
|
|
46
|
-
* Get API health status
|
|
47
|
-
*/
|
|
48
20
|
getHealth(): Promise<any>;
|
|
49
|
-
/**
|
|
50
|
-
* π Register a webhook endpoint
|
|
51
|
-
*/
|
|
52
21
|
registerWebhook(webhook: CreateWebhookRequest): Promise<CreateWebhookResponse>;
|
|
53
|
-
/**
|
|
54
|
-
* π List all webhook endpoints
|
|
55
|
-
*/
|
|
56
22
|
listWebhooks(): Promise<WebhookEndpoint[]>;
|
|
57
|
-
/**
|
|
58
|
-
* π Get a specific webhook endpoint (by finding it in the list)
|
|
59
|
-
*/
|
|
60
23
|
getWebhook(webhookId: string): Promise<WebhookEndpoint>;
|
|
61
|
-
/**
|
|
62
|
-
* π Delete a webhook endpoint
|
|
63
|
-
*/
|
|
64
24
|
deleteWebhook(webhookId: string): Promise<void>;
|
|
65
|
-
/**
|
|
66
|
-
* π Test a webhook endpoint
|
|
67
|
-
*/
|
|
68
25
|
testWebhook(webhookId: string): Promise<TestWebhookResponse>;
|
|
69
26
|
private validateCoordinates;
|
|
70
27
|
private validateDigiPin;
|
|
71
28
|
}
|
|
72
|
-
|
|
29
|
+
export {};
|