Vite + TypeScript PWA that mirrors the Android app's core features: - Pre-processed shelter data (build-time UTM33N→WGS84 conversion) - Leaflet map with shelter markers, user location, and offline tiles - Canvas compass arrow (ported from DirectionArrowView.kt) - IndexedDB shelter cache with 7-day staleness check - Service worker with CacheFirst tiles and precached app shell - i18n for en, nb, nn (ported from Android strings.xml) - iOS/Android compass handling with low-pass filter - Respects user map interaction (no auto-snap on pan/zoom) - Build revision cache-breaker for reliable SW updates Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
90 lines
2.5 KiB
TypeScript
90 lines
2.5 KiB
TypeScript
import { RequestData } from './StorableRequest.js';
|
|
import '../_version.js';
|
|
export interface UnidentifiedQueueStoreEntry {
|
|
requestData: RequestData;
|
|
timestamp: number;
|
|
id?: number;
|
|
queueName?: string;
|
|
metadata?: object;
|
|
}
|
|
export interface QueueStoreEntry extends UnidentifiedQueueStoreEntry {
|
|
id: number;
|
|
}
|
|
/**
|
|
* A class to interact directly an IndexedDB created specifically to save and
|
|
* retrieve QueueStoreEntries. This class encapsulates all the schema details
|
|
* to store the representation of a Queue.
|
|
*
|
|
* @private
|
|
*/
|
|
export declare class QueueDb {
|
|
private _db;
|
|
/**
|
|
* Add QueueStoreEntry to underlying db.
|
|
*
|
|
* @param {UnidentifiedQueueStoreEntry} entry
|
|
*/
|
|
addEntry(entry: UnidentifiedQueueStoreEntry): Promise<void>;
|
|
/**
|
|
* Returns the first entry id in the ObjectStore.
|
|
*
|
|
* @return {number | undefined}
|
|
*/
|
|
getFirstEntryId(): Promise<number | undefined>;
|
|
/**
|
|
* Get all the entries filtered by index
|
|
*
|
|
* @param queueName
|
|
* @return {Promise<QueueStoreEntry[]>}
|
|
*/
|
|
getAllEntriesByQueueName(queueName: string): Promise<QueueStoreEntry[]>;
|
|
/**
|
|
* Returns the number of entries filtered by index
|
|
*
|
|
* @param queueName
|
|
* @return {Promise<number>}
|
|
*/
|
|
getEntryCountByQueueName(queueName: string): Promise<number>;
|
|
/**
|
|
* Deletes a single entry by id.
|
|
*
|
|
* @param {number} id the id of the entry to be deleted
|
|
*/
|
|
deleteEntry(id: number): Promise<void>;
|
|
/**
|
|
*
|
|
* @param queueName
|
|
* @returns {Promise<QueueStoreEntry | undefined>}
|
|
*/
|
|
getFirstEntryByQueueName(queueName: string): Promise<QueueStoreEntry | undefined>;
|
|
/**
|
|
*
|
|
* @param queueName
|
|
* @returns {Promise<QueueStoreEntry | undefined>}
|
|
*/
|
|
getLastEntryByQueueName(queueName: string): Promise<QueueStoreEntry | undefined>;
|
|
/**
|
|
* Returns either the first or the last entries, depending on direction.
|
|
* Filtered by index.
|
|
*
|
|
* @param {IDBCursorDirection} direction
|
|
* @param {IDBKeyRange} query
|
|
* @return {Promise<QueueStoreEntry | undefined>}
|
|
* @private
|
|
*/
|
|
getEndEntryFromIndex(query: IDBKeyRange, direction: IDBCursorDirection): Promise<QueueStoreEntry | undefined>;
|
|
/**
|
|
* Returns an open connection to the database.
|
|
*
|
|
* @private
|
|
*/
|
|
private getDb;
|
|
/**
|
|
* Upgrades QueueDB
|
|
*
|
|
* @param {IDBPDatabase<QueueDBSchema>} db
|
|
* @param {number} oldVersion
|
|
* @private
|
|
*/
|
|
private _upgradeDb;
|
|
}
|