From 7274574f647174dbc8b8d216a90d52b1c5fd2dd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Mon, 26 Jan 2026 19:21:42 +0700 Subject: [PATCH] 1.1.0 --- dist/places.d.ts | 101 +++++++++++++++++++++++++++++++--------------- package-lock.json | 4 +- package.json | 2 +- 3 files changed, 72 insertions(+), 35 deletions(-) diff --git a/dist/places.d.ts b/dist/places.d.ts index 4e767a8..138c499 100644 --- a/dist/places.d.ts +++ b/dist/places.d.ts @@ -57,43 +57,80 @@ declare const placeSchema: { }; readonly required: readonly ["id", "title", "lat", "lon", "geohash", "createdAt"]; }; -type Place = FromSchema & { +/** + * Represents a Place object. + * + * Core properties enforced by schema: + * - `id`: Unique identifier (ULID) + * - `title`: Name of the place + * - `lat`: Latitude + * - `lon`: Longitude + * - `geohash`: Geohash for indexing + * - `createdAt`: ISO date string + * + * Optional properties: + * - `description`: Text description + * - `zoom`: Map zoom level + * - `url`: Related URL + * - `osmId`, `osmType`, `osmTags`: OpenStreetMap data + * - `tags`: Array of string tags + * - `updatedAt`: ISO date string + */ +export type Place = FromSchema & { [key: string]: any; }; +export interface PlacesClient { + /** + * Store a place. + * Generates ID and Geohash if missing. + * Path structure: // + * + * @param placeData - The data of the place to store. + * @returns The stored place object. + */ + store(placeData: Partial): Promise; + /** + * Remove a place. + * Requires geohash to locate the folder. + * + * @param id - The ID of the place to remove. + * @param geohash - The geohash of the place. + */ + remove(id: string, geohash: string): Promise; + /** + * Get a single place. + * Requires geohash to locate the folder. + * + * @param id - The ID of the place to retrieve. + * @param geohash - The geohash of the place. + * @returns The place object. + */ + get(id: string, geohash: string): Promise; + /** + * 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. + * + * @param prefix - The geohash prefix to filter by. + * @returns A map of objects found at the prefix. + */ + listByPrefix(prefix: string): Promise; + /** + * 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). + * @returns An array of places. + */ + getPlaces(prefixes?: string[]): Promise; +} declare const _default: { name: string; builder: (privateClient: BaseClient) => { - exports: { - /** - * Store a place. - * Generates ID and Geohash if missing. - * Path structure: // - */ - store: (placeData: Partial) => Promise; - /** - * Remove a place. - * Requires geohash to locate the folder. - */ - remove: (id: string, geohash: string) => Promise; - /** - * Get a single place. - * Requires geohash to locate the folder. - */ - get: (id: string, geohash: string) => Promise; - /** - * 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; - /** - * 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; - }; + exports: PlacesClient; }; }; export default _default; diff --git a/package-lock.json b/package-lock.json index bb40c14..da6ebb1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@remotestorage/module-places", - "version": "1.0.0", + "version": "1.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@remotestorage/module-places", - "version": "1.0.0", + "version": "1.1.0", "license": "MIT", "dependencies": { "latlon-geohash": "^2.0.0", diff --git a/package.json b/package.json index 5a0d4bc..db888da 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@remotestorage/module-places", - "version": "1.0.0", + "version": "1.1.0", "description": "Manage favorite/saved places", "main": "dist/places.js", "types": "dist/places.d.ts",