100 lines
3.2 KiB
TypeScript
100 lines
3.2 KiB
TypeScript
import BaseClient from 'remotestoragejs/release/types/baseclient';
|
|
import { FromSchema } from 'json-schema-to-ts';
|
|
declare const placeSchema: {
|
|
readonly type: "object";
|
|
readonly properties: {
|
|
readonly id: {
|
|
readonly type: "string";
|
|
};
|
|
readonly title: {
|
|
readonly type: "string";
|
|
};
|
|
readonly lat: {
|
|
readonly type: "number";
|
|
};
|
|
readonly lon: {
|
|
readonly type: "number";
|
|
};
|
|
readonly geohash: {
|
|
readonly type: "string";
|
|
};
|
|
readonly zoom: {
|
|
readonly type: "number";
|
|
};
|
|
readonly url: {
|
|
readonly type: "string";
|
|
};
|
|
readonly osmId: {
|
|
readonly type: "string";
|
|
};
|
|
readonly osmType: {
|
|
readonly type: "string";
|
|
};
|
|
readonly osmTags: {
|
|
readonly type: "object";
|
|
readonly additionalProperties: {
|
|
readonly type: "string";
|
|
};
|
|
};
|
|
readonly description: {
|
|
readonly type: "string";
|
|
};
|
|
readonly tags: {
|
|
readonly type: "array";
|
|
readonly items: {
|
|
readonly type: "string";
|
|
};
|
|
readonly default: readonly [];
|
|
};
|
|
readonly createdAt: {
|
|
readonly type: "string";
|
|
readonly format: "date-time";
|
|
};
|
|
readonly updatedAt: {
|
|
readonly type: "string";
|
|
readonly format: "date-time";
|
|
};
|
|
};
|
|
readonly required: readonly ["id", "title", "lat", "lon", "geohash", "createdAt"];
|
|
};
|
|
type Place = FromSchema<typeof placeSchema> & {
|
|
[key: string]: any;
|
|
};
|
|
declare const _default: {
|
|
name: string;
|
|
builder: (privateClient: BaseClient) => {
|
|
exports: {
|
|
/**
|
|
* Store a place.
|
|
* Generates ID and Geohash if missing.
|
|
* Path structure: <geohash-prefix-2>/<geohash-prefix-2>/<id>
|
|
*/
|
|
store: (placeData: Partial<Place>) => Promise<Place>;
|
|
/**
|
|
* Remove a place.
|
|
* Requires geohash to locate the folder.
|
|
*/
|
|
remove: (id: string, geohash: string) => Promise<import("remotestoragejs/release/types/interfaces/queued_request_response").QueuedRequestResponse>;
|
|
/**
|
|
* Get a single place.
|
|
* Requires geohash to locate the folder.
|
|
*/
|
|
get: (id: string, geohash: string) => Promise<unknown>;
|
|
/**
|
|
* List places matching a geohash prefix.
|
|
* Supports 2-char ("ab") or 4-char ("abcd") prefixes.
|
|
* If 2-char, it returns the sub-folders (prefixes), not places.
|
|
* If 4-char, it returns the places in that sector.
|
|
*/
|
|
listByPrefix: (prefix: string) => Promise<unknown>;
|
|
/**
|
|
* Get places from specific prefixes.
|
|
* @param prefixes Optional array of 4-character geohash prefixes to load (e.g. ['w1q7', 'w1q8']).
|
|
* If not provided, it will attempt to scan ALL prefixes (recursive).
|
|
*/
|
|
getPlaces: (prefixes?: string[]) => Promise<Place[]>;
|
|
};
|
|
};
|
|
};
|
|
export default _default;
|