openlr_decoder
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -14,19 +14,7 @@ import { OpenLRDecodeOptions } from "./src/openLRDecode"; | ||
} | ||
/** | ||
* @function initStorage - Initialise a connection to a backend storage | ||
* @param storageOptions - The storage backend solution to use | ||
* @returns {Promise} - A void Promise to wait for the initialisation to complete | ||
*/ | ||
export declare function initStorage(storageOptions: storageOptions): Promise<unknown>; | ||
/** | ||
* @function decodeOpenLR - Decode an OpenLR reference to a target network model | ||
* @param openLRRef {string} - The OpenLR reference to decode | ||
* @param options {object} - Options for the OpenLR decoding. The radius to search for candidate nodes in meters. The tolerance for matching link bearings in degrees. | ||
* @returns {Promise} - Returns a promise with the decode result | ||
*/ | ||
export declare function decodeOpenLR(openLRRef: string, options: OpenLRDecodeOptions): Promise<{ | ||
route: { | ||
export interface decodedRoute { | ||
route: Array<{ | ||
length: number; | ||
linkid: string; | ||
}[]; | ||
}>; | ||
routeLength: number; | ||
@@ -36,3 +24,4 @@ nodes: string[]; | ||
openLRDistance: number; | ||
} | { | ||
} | ||
export interface decodeFail { | ||
route: null; | ||
@@ -43,7 +32,20 @@ routeLength: null; | ||
openLRDistance: number; | ||
}>; | ||
} | ||
/** | ||
* @function initStorage - Initialise a connection to a backend storage | ||
* @param storageOptions - The storage backend solution to use | ||
* @returns {Promise} - A Promise to wait for the initialisation to complete - the content is dependent on the storage backend in use | ||
*/ | ||
export declare function initStorage(storageOptions: storageOptions): Promise<unknown>; | ||
/** | ||
* @function decodeOpenLR - Decode an OpenLR reference to a target network model | ||
* @param openLRRef {string} - The OpenLR reference to decode | ||
* @param options {object} - Options for the OpenLR decoding. The radius to search for candidate nodes in meters. The tolerance for matching link bearings in degrees. | ||
* @returns {Promise} - Returns a promise with the decode result | ||
*/ | ||
export declare function decodeOpenLR(openLRRef: string, options: OpenLRDecodeOptions): Promise<decodedRoute | decodeFail>; | ||
/** | ||
* @function closeConnection - Enables client to close connection to backend storage to exit node event loop | ||
* @returns {Promise} - A void Promise to wait for the initialisation to complete | ||
* @returns {Promise} - A Promise to wait for the disconnect to complete - the content is dependent on the storage backend in use | ||
*/ | ||
export declare function closeConnection(): Promise<unknown>; |
@@ -23,3 +23,3 @@ "use strict"; | ||
* @param storageOptions - The storage backend solution to use | ||
* @returns {Promise} - A void Promise to wait for the initialisation to complete | ||
* @returns {Promise} - A Promise to wait for the initialisation to complete - the content is dependent on the storage backend in use | ||
*/ | ||
@@ -47,3 +47,3 @@ function initStorage(storageOptions) { | ||
* @function closeConnection - Enables client to close connection to backend storage to exit node event loop | ||
* @returns {Promise} - A void Promise to wait for the initialisation to complete | ||
* @returns {Promise} - A Promise to wait for the disconnect to complete - the content is dependent on the storage backend in use | ||
*/ | ||
@@ -50,0 +50,0 @@ function closeConnection() { |
35
index.ts
/* istanbul ignore file */ | ||
import {decodeOpenLRReference, OpenLRDecodeOptions} from "./src/openLRDecode"; | ||
import {configureStorage} from "./src/storage"; | ||
import { decodeOpenLRReference, OpenLRDecodeOptions } from "./src/openLRDecode"; | ||
import { configureStorage } from "./src/storage"; | ||
export{OpenLRDecodeOptions} from "./src/openLRDecode"; | ||
export { OpenLRDecodeOptions } from "./src/openLRDecode"; | ||
@@ -20,8 +20,27 @@ export enum storageBackends { | ||
export interface decodedRoute { | ||
route: Array<{ | ||
length: number; | ||
linkid: string; | ||
}>; | ||
routeLength: number; | ||
nodes: string[]; | ||
openLRRef: string; | ||
openLRDistance: number; | ||
} | ||
export interface decodeFail { | ||
route: null; | ||
routeLength: null; | ||
nodes: null; | ||
openLRRef: string; | ||
openLRDistance: number; | ||
} | ||
/** | ||
* @function initStorage - Initialise a connection to a backend storage | ||
* @param storageOptions - The storage backend solution to use | ||
* @returns {Promise} - A void Promise to wait for the initialisation to complete | ||
* @returns {Promise} - A Promise to wait for the initialisation to complete - the content is dependent on the storage backend in use | ||
*/ | ||
export async function initStorage(storageOptions: storageOptions): Promise<unknown>{ | ||
export async function initStorage(storageOptions: storageOptions): Promise<unknown> { | ||
new configureStorage(storageOptions); | ||
@@ -37,3 +56,3 @@ return configureStorage.init(storageOptions); | ||
*/ | ||
export async function decodeOpenLR(openLRRef: string, options: OpenLRDecodeOptions): Promise<{route: {length: number;linkid: string;}[]; routeLength: number; nodes: string[]; openLRRef: string; openLRDistance: number} | {route: null; routeLength: null;nodes: null; openLRRef: string; openLRDistance: number}>{ | ||
export async function decodeOpenLR(openLRRef: string, options: OpenLRDecodeOptions): Promise<decodedRoute | decodeFail> { | ||
return decodeOpenLRReference(openLRRef, options); | ||
@@ -44,6 +63,6 @@ } | ||
* @function closeConnection - Enables client to close connection to backend storage to exit node event loop | ||
* @returns {Promise} - A void Promise to wait for the initialisation to complete | ||
* @returns {Promise} - A Promise to wait for the disconnect to complete - the content is dependent on the storage backend in use | ||
*/ | ||
export async function closeConnection(): Promise<unknown>{ | ||
export async function closeConnection(): Promise<unknown> { | ||
return configureStorage.close(); | ||
} |
{ | ||
"name": "openlr_decoder", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "A general purpose road network OpenLR decoding solution", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
73244
769
0