@sphereon/ssi-sdk.geolocation-store
Version:
70 lines (65 loc) • 2.99 kB
text/typescript
import { IAgentPlugin, IPluginMethodMap } from '@veramo/core';
import { IKeyValueStore, IValueData } from '@sphereon/ssi-sdk.kv-store-temp';
declare const geolocationStoreMethods: Array<string>;
/**
* {@inheritDoc IGeolocationStore}
*/
declare class GeolocationStore implements IAgentPlugin {
readonly schema: any;
private readonly defaultStoreId;
private readonly defaultNamespace;
private readonly _dnsLookupStore;
readonly methods: IGeolocationStore;
constructor(args: {
defaultStoreId?: string;
defaultNamespace?: string;
dnsLookupStore?: Map<string, IKeyValueStore<GeolocationStoreLocation>> | IKeyValueStore<GeolocationStoreLocation>;
});
private geolocationStorePersistLocation;
private geolocationStoreHasLocation;
private geolocationStoreRemoveLocation;
private geolocationStoreClearAllLocations;
private geolocationStoreGetLocation;
private store;
private storeIdStr;
private geolocationStoreDefaultLocationStore;
private namespaceStr;
private prefix;
}
interface IGeolocationStore extends IPluginMethodMap {
geolocationStoreDefaultLocationStore(): Promise<GeolocationStoreLocationResult>;
geolocationStorePersistLocation(args: GeolocationStoreLocationPersistArgs): Promise<GeolocationStoreLocationResultIValueData>;
geolocationStoreHasLocation(args: GeolocationStoreArgs): Promise<boolean>;
geolocationStoreRemoveLocation(args: GeolocationStoreArgs): Promise<boolean>;
geolocationStoreClearAllLocations(args: GeolocationStoreClearAllLocationsArgs): Promise<boolean>;
geolocationStoreGetLocation(args: GeolocationStoreArgs): Promise<GeolocationStoreLocationResultOrUndefined>;
}
type GeolocationStoreLocation = {
continent?: string;
country?: string;
};
type GeolocationStorePersistArgs = {
ipOrHostname: string;
overwriteExisting?: boolean;
validation?: boolean;
ttl?: number;
storeId?: string;
namespace?: string;
};
type GeolocationStoreArgs = {
ipOrHostname: string;
storeId: string;
namespace: string;
};
type GeolocationStoreClearAllLocationsArgs = Pick<GeolocationStoreArgs, 'storeId'>;
type GeolocationStoreLocationPersistArgs = GeolocationStorePersistArgs & {
locationArgs: GeolocationStoreLocation;
};
type GeolocationStoreLocationResult = IKeyValueStore<GeolocationStoreLocation>;
type GeolocationStoreLocationResultOrUndefined = GeolocationStoreLocation | undefined;
type GeolocationStoreLocationResultIValueData = IValueData<GeolocationStoreLocation>;
/**
* @public
*/
declare const schema: any;
export { GeolocationStore, type GeolocationStoreArgs, type GeolocationStoreClearAllLocationsArgs, type GeolocationStoreLocation, type GeolocationStoreLocationPersistArgs, type GeolocationStoreLocationResult, type GeolocationStoreLocationResultIValueData, type GeolocationStoreLocationResultOrUndefined, type GeolocationStorePersistArgs, type IGeolocationStore, geolocationStoreMethods, schema };